Swapping Axis
Posted: Fri Apr 20, 2007 4:14 pm
Is there a way to swap axes with out removing a series rebuilding it and re-adding it? In other words, I would like to be able to do the equivalent below in a more efficient manner.
Is there a way to do it for a Steema.TeeChart.Styles.Surface?
For example:
Steema.TeeChart.Styles.Line series = new Steema.TeeChart.Styles.Line();
tChart1.Series.Add(series);
series.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
double[] x = new double[] { 10, 4, 8, 20, 18, 2, 6, 12, 16, 14};
double[] y = new double[] { 10, 25, 12.5, 5, 5.556, 50, 16.667, 8.333, 6.25, 7.1428};series.Add(x, y);
series.XValues.Sort();
series.YValues.Sort();
tChart1.Refresh();
.
.
.
// Now lets swap the x & y axis
tChart1.Series.Clear();
Steema.TeeChart.Styles.Line series = new Steema.TeeChart.Styles.Line();
tChart1.Series.Add(series);
series.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
double[] x = new double[] { 10, 4, 8, 20, 18, 2, 6, 12, 16, 14};
double[] y = new double[] { 10, 25, 12.5, 5, 5.556, 50, 16.667, 8.333, 6.25, 7.1428};series.Add(y, x); //NOTICE: swapped X & Y
series.XValues.Sort();
series.YValues.Sort();
tChart1.Refresh();
Is there a way to do it for a Steema.TeeChart.Styles.Surface?
For example:
Steema.TeeChart.Styles.Line series = new Steema.TeeChart.Styles.Line();
tChart1.Series.Add(series);
series.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
double[] x = new double[] { 10, 4, 8, 20, 18, 2, 6, 12, 16, 14};
double[] y = new double[] { 10, 25, 12.5, 5, 5.556, 50, 16.667, 8.333, 6.25, 7.1428};series.Add(x, y);
series.XValues.Sort();
series.YValues.Sort();
tChart1.Refresh();
.
.
.
// Now lets swap the x & y axis
tChart1.Series.Clear();
Steema.TeeChart.Styles.Line series = new Steema.TeeChart.Styles.Line();
tChart1.Series.Add(series);
series.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
double[] x = new double[] { 10, 4, 8, 20, 18, 2, 6, 12, 16, 14};
double[] y = new double[] { 10, 25, 12.5, 5, 5.556, 50, 16.667, 8.333, 6.25, 7.1428};series.Add(y, x); //NOTICE: swapped X & Y
series.XValues.Sort();
series.YValues.Sort();
tChart1.Refresh();