【发布时间】:2011-10-18 05:49:27
【问题描述】:
我使用以下方法创建了 ScatterSeries 图表:
public ScatterPlot()
{
InitializeComponent();
ScatterSeries a = new ScatterSeries();
a.Title = "Series A";
a.IndependentValuePath = "Key";
a.DependentValuePath = "Value";
scatterplot.Series.Add(a);
((ScatterSeries)scatterplot.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)
};
}
我有一个字典,其中每个数据点都映射到一个单独的文本标签。我想知道是否可以建立一个绑定,这样当我将鼠标移到一个点上时,我会得到文本标签而不是实际数字?有关如何执行此操作的任何建议?
【问题讨论】:
标签: c# wpf wpf-controls wpftoolkit