chart control to table/dataGrid

Hi, I'm trying to convert data from chartControl to a table.
So Series1(x,y) data points will go to a table or datagrid where I can view the information in a different view.



Attachment: New_Compressed_(zipped)_Folder_9e455e76.zip

3 Replies

CE Cesar May 12, 2020 09:34 PM UTC

I was able to get the problem figured out using this line of code

dataGridView1.Rows.Add(chartControl1.Series[0].Points[0].X, chartControl1.Series[0].Points[1].YValues);

The only problem now is that I get "System.Double[]" for the y value.
Any suggestions?


SJ Suyamburaja Jayakumar Syncfusion Team May 14, 2020 03:50 AM UTC

Hi Cesar, 
 
Greetings from Syncfusion.  
 
Currently we are working on the requirement and we will update the complete details on or before May 15, 2020. 
 
Regards, 
Suyamburaja J. 



DD Devakumar Dhanapoosanam Syncfusion Team May 21, 2020 10:43 AM UTC

Hi Cesar, 
 
Sorry for the delay. 
 
We have checked the reported query and when set the chart DataPoint values the YValues is of type Array as you have mentioned, and you can resolve this by using the array index for the corresponding YValue set for the series for showing in the DataGrid. Please refer the below for more details setting the YValue first index value for the datagrid, 
 
CodeSnippet: 
List<SalesData> ChartData = new List<SalesData>(); 
 
for (int i = 0; i < chart.Series[0].Points.Count; i++) 
{ 
       ChartData.Add(new SalesData() { XValue = chart.Series[0].Points[i].X,  
                        YValue = chart.Series[0].Points[i].YValues[0] }); 
} 
 
sfDataGrid.DataSource = ChartData; 
 
… 
public class SalesData 
{ 
        public double XValue { get; set; } 
        public double YValue { get; set; } 
 
        public SalesData() 
        { 
 
        } 
} 
 
Screenshot: 
 
 
 
Please let me know if you need any further assistance. 
 
Regards, 
Devakumar D 


Loader.
Up arrow icon