2014-06-14 26 views
1

我想呈現給提供一系列用戶列表以供選擇(點擊傳說也許直接?) 該地塊將只顯示所選擇的系列WPF OxyPlot:如何給用戶選擇要顯示哪個系列?

什麼是實現這一目標的最佳方式是什麼?

+0

顯然,它的東西,是由Oxyplot團隊考慮,但尚未實現:https://github.com/oxyplot/oxyplot/issues/315 – gwenzek

回答

2

我建議你使用代表這些系列的複選框。當用戶選中複選框時,您可以將新的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; 
} 
+0

是。那是我最終做的 – GabiMe

相關問題