他,
我有一个图表,至极在运行时创建的,这可能是折线图,条形图或饼图类型。
基本上我想要的是对图上的线条更加的对比度,这意味着我应该上线使用不同的颜色。
对于条形图我使用StylePalette属性设置至极的色彩将在图表中使用,它的正常工作,但对于线它没有任何效果。
作为一个折线图我想这因为我想要使用的线可以说2种颜色。
Style style = new Style(typeof(Control));
Setter st = new Setter(Control.ForegroundProperty, new SolidColorBrush(Colors.Red));
style.Setters.Add(st);
Style style2 = new Style(typeof(Control));
Setter st2 = new Setter(Control.ForegroundProperty, new SolidColorBrush(Colors.Green));
style2.Setters.Add(st2);
StylePalette palette = new StylePalette();
palette.Add(style);
palette.Add(style2);
m_oChart.StylePalette = palette;
而这在XAML文件:
<chartingToolkit:Chart x:Name="m_oChart" Style="{StaticResource ChartStyleLegendBottom}" d:IsHidden="True">
<chartingToolkit:Chart.StylePalette>
<visualizationToolkit:StylePalette>
<Style TargetType="Control">
<Setter Property="Background" Value="Gray"/>
</Style>
<Style TargetType="Control">
<Setter Property="Background" Value="Black"/>
</Style>
</visualizationToolkit:StylePalette>
</chartingToolkit:Chart.StylePalette>
</chartingToolkit:Chart>
请注意,我试图为背景和前景propertys也都在XAML和代码隐藏的一面。
我这个根据这个链接来实现:
http://forums.silverlight.net/forums/t/58894.aspx
基本上我想要的是对图上的线条更加的对比度,这意味着我应该上线使用不同的颜色。 我用这个例子来证明我面对在这种特殊情况的问题。
是否有人有这个问题? 没有人有任何解决方案?