WPF实现柱状图,隐藏ColumnSeries的title,如何实现
各位高人我使用wpf做柱状图,ColumnSeries的title如何隐藏掉,代码如下:
<chartingToolkit:Chart Grid.Row="0" Background="LightSteelBlue" Margin="10" Name="ColumnChartDefault">
<chartingToolkit:Chart.Axes>
<chartingToolkit:LinearAxis Orientation="Y" Minimum="0" Maximum="100"></chartingToolkit:LinearAxis>
</chartingToolkit:Chart.Axes>
<chartingToolkit:ColumnSeries Name="defaultColumnSeries" Title="sssss" IndependentValueBinding="{Binding Path=Name}" DependentValueBinding="{Binding Path=Score}">
<chartingToolkit:ColumnSeries.DataPointStyle>
<Style TargetType="chartingToolkit:ColumnDataPoint">
<Setter Property="Background" Value="SkyBlue"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="chartingToolkit:ColumnDataPoint">
<Grid>
<Rectangle Fill="{TemplateBinding Background}" Stroke="Black"/>
<Grid Background="LightBlue" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Top">
<TextBlock Text="{TemplateBinding FormattedDependentValue}" FontWeight="Light" FontSize="20" Margin="0,-27,0,0" VerticalAlignment="Bottom" HorizontalAlignment="Center" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</chartingToolkit:ColumnSeries.DataPointStyle>
</chartingToolkit:ColumnSeries>
</chartingToolkit:Chart>
[解决办法]
showInLegend = false;
[解决办法]
你这个Chart是哪种Chart,我还以为是visifire的,不过应该也有差不多类似的属性吧
[解决办法]
<chartingToolkit:Chart Grid.Row="0" Background="LightSteelBlue" Margin="10" Name="ColumnChartDefault">
<chartingToolkit:Chart.LegendStyle>
<Style TargetType="Control">
<Setter Property="Width" Value="0"/>
<Setter Property="Height" Value="0"/>
</Style>
</chartingToolkit:Chart.LegendStyle>
<chartingToolkit:Chart.Axes>
<chartingToolkit:LinearAxis Orientation="Y" Minimum="0" Maximum="100"></chartingToolkit:LinearAxis> </chartingToolkit:Chart.Axes>
把红色那段样式加进去就可以了,修改LegendStyle,将Legend的宽高设为0,就可以消掉Legend.昨天有事情走开了,晚上回去试了下,这样应该是可以的。
[解决办法]
好吧。。我还是不会用代码框。。。
加上这段
<chartingToolkit:Chart.LegendStyle>
<Style TargetType="Control">
<Setter Property="Width" Value="0"/>
<Setter Property="Height" Value="0"/>
</Style>
</chartingToolkit:Chart.LegendStyle>