簡體   English   中英

WPF工具包散點圖

[英]wpf toolkit scatter chart

這個wpf工具包讓我從未如此煩惱。 文檔不存在!

您到底如何連接散點圖中的線?

我需要產生一個在多個序列之間線性的圖。 我使用Excels散點圖對需要做的事情進行了原型設計,但是我一生都無法弄清楚如何連接工具箱中的點。

這是代碼,我是否缺少選項?

<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)
};

散點圖不會將點與線連接起來。 使用LineSeries應該連接點。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM