Page 1 of 1

Question regarding the Order property

Posted: Thu Apr 19, 2007 6:32 pm
by 8739068
I am trying to understand how the ValueList.Order property works.

If I do something like the following:

Steema.TeeChart.Styles.Line lseries = new Steema.TeeChart.Styles.Line();
chart.Series.Add(lseries);
lseries.YValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
lseries.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
lseries.Add(mypointsX, mypointsY);

Where (mypointsX and mypointsY are each double[] that have exactly the same number of elements.

How does the ordering occur?

The 2 array of doubles are related where mypointsX[0] and mypointsY[0] define a point to plot in the chart. It does not make sense to me that you can order lseries.Xvalues and lseries.Yvalues. If they are ordered separately, then you lose the 1:1 relationship between the array of doubles.

I am probabaly way off base here and overlooking something obvious.

Can someone clarify the behavior?

Posted: Fri Apr 20, 2007 10:18 am
by 9348258
Hi Mikes

Using the code below here it keeps the 1:1 relationship between the points. The only difference is the way the line is plotted. You can also try not sorting the series and you'll notice the difference.

Code: Select all

 private void Form1_Load(object sender, EventArgs e)
        {
            double[] mypointsX = new double[] { 0, 0.5, 1, 1.5 };
            double[] mypointsY = new double[] { 5, 0, 15, 10 };
            
            Steema.TeeChart.Styles.Line lseries = new Steema.TeeChart.Styles.Line();
            tChart1.Series.Add(lseries);
            lseries.YValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
            lseries.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
            lseries.Add(mypointsX, mypointsY);
            lseries.XValues.Sort();
            lseries.YValues.Sort();

            lseries.Marks.Visible = true;
            lseries.Marks.Style = Steema.TeeChart.Styles.MarksStyles.XY;         

        }