How to plot MULTIPLE LineSeries on an OxyPlot chart?

前端 未结 3 1676
予麋鹿
予麋鹿 2021-02-07 14:51

I apologize for asking so many OxyPlot questions, but I seem to be really struggling with using the OxyPlot chart control.

My project is in WPF format so I was original

3条回答
  •  [愿得一人]
    2021-02-07 15:37

    Here is how you can achieve a similar result in XAML especially if you are using the MVVM approach.

    ViewModel:

    public ObservableCollection DataPointList1 {get;set;}
    public ObservableCollection DataPointList2 {get;set;}
    public ObservableCollection DataPointList3 {get;set;}
    public ObservableCollection DataPointList4 {get;set;}
    

    Using a for loop like below populates DataPointList1 to DataPointList4 with the appropriate datasets.

    for (int i = 0; i < dataList.Count; i++)
    {
        DataPointList1 .Add(new DataPoint{dataList[i].XValue,dataList[i].YValue });
    }
    

    XAML:

        xmlns:oxy="http://oxyplot.org/wpf"
    
    
        
            
           
      
      
           
           
           
           
       
    
    

提交回复
热议问题