我想向用户呈现可用系列的列表,以供选择(也许直接单击图例?)该图将仅显示所选系列
实现这一目标的最佳方法是什么?
我建议您使用代表这些系列的复选框。用户选中复选框时,可以将新的LineSeries或任何其他系列添加到PlotModel / PlotView。
checkbox1代表series1。checkbox2代表series2。等等..
例如:
Plotview pv = new PlotView(); // you can also use plotmodel instead of plotview.
pv.Width = 480.0;
pv.Height = 272.0;
pv.Title = graphname;
private void checkbox4_Checked(object sender, RoutedEventArgs e)
{
var LineChart = new LineSeries();
pv.Series.Add(LineChart);
LineChart.DataFieldX = "X";
LineChart.DataFieldY = "Y";
List<Vector> coords = new List<Vector>();
//Add X and Y values to this list. Or you can use any other way you want.
LineChart.ItemsSource = coords; //Feed it to itemsource
LineChart.Title = name;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句