This is a migrated thread and some comments may be shown as answers.

Multiple Axes Mode when LineSeries Datasource is Datatable

2 Answers 121 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
George C.
Top achievements
Rank 2
Iron
Veteran
George C. asked on 06 Dec 2020, 05:43 AM

Greetings,

I have 2 data tables. Both of them have 2 columns. The first column is in common which is " Name" column. The second column is "Numerical Values" (each data table has its own different values in the second column). I need to make comparison between these two data tables via RadChartView and LineSeries. So the horizontal axes should represent the common column (Names), and the vertical axes should represent 2 LineSeries Diagram, each corresponding to a data table.

I use the code below to draw diagram of one data table :

Dim lineSeria As New LineSeries()
lineSeria.DataSource = dataTable1
lineSeria.ValueMember = "Values"
lineSeria.CategoryMember = "Names"
ChartView.Series.Add(lineSeria) 'ChartView is a RadChartView

 

How can I use RadchartView's Multiple axes mode to draw the second diagram along with the first one together for making a comparison ?

P.S I've read about Multi Axes mode in documentations. But my case is different as I use a data table as LineSeries datasource.

 

Thanks in advance.

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 07 Dec 2020, 03:12 PM

Hello, George,

If I understand you correctly you would like to plot two LineSeries with equal names and different values in the RadChartView. In order to achieve this, you can add LineSeries and bind each of them to the desired data source. I prepared a sample example with two LineSeries that are bound to two different DataTables as per your requirement:

 public RadForm1()
 {
     InitializeComponent();

     //Table 1
     DataTable table1 = new DataTable();
     table1.Columns.Add("Name", typeof(string));
     table1.Columns.Add("Values", typeof(int));
     table1.Rows.Add("Name1", 32);
     table1.Rows.Add("Name2", 55);
     table1.Rows.Add("Name3", 45);
     LineSeries lineSeria = new LineSeries();
     lineSeria.ValueMember = "Values";
     lineSeria.CategoryMember = "Name";
     lineSeria.DataSource = table1;
     radChartView1.Series.Add(lineSeria);

     // Table 2
     DataTable table2 = new DataTable();
     table2.Columns.Add("Name", typeof(string));
     table2.Columns.Add("Values", typeof(int));
     table2.Rows.Add("Name1", 15);
     table2.Rows.Add("Name2", 5);
     table2.Rows.Add("Name3", 31);
     LineSeries lineSeria2 = new LineSeries();
     lineSeria2.ValueMember = "Values";
     lineSeria2.CategoryMember = "Name";
     lineSeria2.DataSource = table2;
     radChartView1.Series.Add(lineSeria2);

 }

 

Could you please give us some more details on how exactly you want to use multiple axes?

I hope this helps. Should you have other questions do not hesitate to contact me.

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
George C.
Top achievements
Rank 2
Iron
Veteran
answered on 07 Dec 2020, 06:04 PM
Exactly what I was looking for! Thanks
Tags
ChartView
Asked by
George C.
Top achievements
Rank 2
Iron
Veteran
Answers by
Nadya | Tech Support Engineer
Telerik team
George C.
Top achievements
Rank 2
Iron
Veteran
Share this question
or