8
私はいくつかのチャートを持っており、DataPointsを使用しないLineSeriesをダイナミックに追加したいと思います。私は、データポイントを隠すために見つけた唯一の方法は次のとおりです。私はこれを行うときwpfツールキットラインチャート(ポイントとラインカラーが異なる)
Style style = new Style(typeof(LineDataPoint));
style.Setters.Add(new Setter(LineDataPoint.TemplateProperty, null));
var series = new LineSeries()
{
Title = name,
DependentValuePath = "Y",
IndependentValuePath = "X",
ItemsSource = new ObservableCollection<FloatingPoint>(),
DataPointStyle = style,
};
は、残念ながら、すべての行が黄色になると、私は自分の色を変更することはできません。 は、私はこれを実行しようとしました:
Style style = new Style(typeof(LineDataPoint));
style.Setters.Add(new Setter(LineDataPoint.TemplateProperty, null));
SolidColorBrush brush = new SolidColorBrush(Colors.Red);
var series = new LineSeries()
{
Title = name,
DependentValuePath = "Y",
IndependentValuePath = "X",
ItemsSource = new ObservableCollection<FloatingPoint>(),
DataPointStyle = style,
Background = brush,
};
しかし、それは助けにはならない - 私は線の色を変更することはできません...私は
series.Background = brush;
+1恐ろしい!どうもありがとう! – Legend
これは受け入れられた回答である必要があります。 +1して問題を解決してください。これはXAMLでも同様に機能します。 –