WPFツールキット散布図
-
28-10-2019 - |
質問
私はこのWPFツールキットにそれほどイライラしたことがありません。ドキュメントはそこにありません! argh。
地球上で散布図内の線をどのように接続できますか?
複数のシリーズにわたって線形のグラフを作成する必要があります。 Excels Sprcition Chartを使用して行う必要があることをプロトタイプで順調に進めましたが、私の人生では、ツールキットのドットを接続する方法を理解することはできません。
これがコードです、オプションがありませんか?
<my:Chart Name="myChart" Margin="5,5,5,5" Opacity="1" Width="525">
</my:Chart>
ScatterSeries a = new ScatterSeries();
a.Title = "a";
a.IndependentValuePath = "Key";
a.DependentValuePath = "Value";
myChart.Series.Add(a);
a = new ScatterSeries();
a.Title = "b";
a.IndependentValuePath = "Key";
a.DependentValuePath = "Value";
myChart.Series.Add(a);
((ScatterSeries)myChart.Series[0]).ItemsSource = new KeyValuePair<DateTime, int>[]
{
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(1), 0),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(2), 150),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(3), 150),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(4), 0),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(5), 0),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(8), 130),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(9), 130),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(10), 0),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(11), 0),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(15), 225),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(16), 225),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(17), 0)
};
((ScatterSeries)myChart.Series[1]).ItemsSource = new KeyValuePair<DateTime, int>[]
{
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(-21), 0),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(-5), 750),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(3), 750),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(7), 0),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(9), 0),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(10), 330),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(19), 330),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(20), 0),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(21), 0),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(25), 525),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(26), 525),
new KeyValuePair<DateTime, int>(DateTime.Now.AddMonths(27), 0)
};
解決
散布図は、ドットを線で接続しません。代わりにラインシリーズを使用すると、ドットを接続する必要があります。
所属していません StackOverflow