Hello Jacek,
Our
RadChart supports up to two Y axes:
radChart1.PlotArea.YAxis and
radChart1.PlotArea.YAxis2.
Here is a short example that demonstrates the use of the second YAxis:
| 1 |
public partial class Form1 : Form |
| 2 |
{ |
| 3 |
private int[][] data = new int[][] { |
| 4 |
new int[] { 10, 3, 12, 3, 7, 6, 4, 9 }, |
| 5 |
new int[] { 1000, 3000, 2000, 14000, 12000, 21000, 3500 }, |
| 6 |
new int[] { 12, 3, 44, 7, 8, 9, 10, 11 } |
| 7 |
}; |
| 8 |
|
| 9 |
public Form1() |
| 10 |
{ |
| 11 |
DataTable table = CreateTableFromData(data); |
| 12 |
|
| 13 |
InitializeComponent(); |
| 14 |
|
| 15 |
this.radChart1.DataSource = table; |
| 16 |
this.radChart1.DataBind(); |
| 17 |
|
| 18 |
this.radChart1.Series[1].YAxisType = ChartYAxisType.Secondary; |
| 19 |
} |
| 20 |
|
| 21 |
private static DataTable CreateTableFromData(int[][] data) |
| 22 |
{ |
| 23 |
int columnCount = data.Length; |
| 24 |
int recordCount = int.MaxValue; |
| 25 |
|
| 26 |
if (columnCount <= 0) return null; |
| 27 |
|
| 28 |
DataTable table = new DataTable(); |
| 29 |
|
| 30 |
for (int i = 0; i < columnCount; i++) |
| 31 |
{ |
| 32 |
table.Columns.Add(string.Format("data_{0}", i)); |
| 33 |
recordCount = Math.Min(recordCount, data[i].Length); |
| 34 |
} |
| 35 |
|
| 36 |
if (recordCount <= 0) return null; |
| 37 |
|
| 38 |
|
| 39 |
for (int i = 0; i < recordCount; i++) |
| 40 |
{ |
| 41 |
DataRow row = table.NewRow(); |
| 42 |
|
| 43 |
for ( int j = 0; j < columnCount; j++ ) |
| 44 |
row[string.Format("data_{0}", j)] = data[j][i]; |
| 45 |
|
| 46 |
table.Rows.Add(row); |
| 47 |
} |
| 48 |
|
| 49 |
return table; |
| 50 |
} |
| 51 |
} |
The
CreateTableFromData method is of no importance to the example, it just creates DataTable out of an array (copying the data into rows).
Look at line 18, where I set Series[1] to use the secondary YAxis.
Let me know if that example helps or you need different functionality.
Regards,
Evtim
the Telerik team