ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  SurfaceChart and setAutoScale
Posted by Albert on Oct-23-2013 23:19
Hello,
I've a data set that I'm plotting on a SurfaceChart.
The ranges for X, Y and Data are as follow:
X {13000 ; 55000}
Y {3000 : 30000}
Data {15 : 245}

My problem is that X and Y axis plots start from 0 while I'd like them to start at their lowest
value.
I had the same problem for the top end of the axis (for some reason I was seeing values of
60000 and 80000) but I managed to solve it using axis.setAutoScale(...).

Anyhow, I can't make the 3D plot to start at (13000, 3000) instead of (0, 0).
What am I doing wrong?

SurfaceChart *c = new SurfaceChart(x,y);

        c->xAxis()->setAutoScale(0, 0, 0);
        c->yAxis()->setAutoScale(0, 0, 0);

        c->setData(*xArray, *yArray, *dataArray );
chart->setChart(c);

I tried every combination of values in setAutoScale(...) but nothing solved the issue.

Thank you

  Re: SurfaceChart and setAutoScale
Posted by Peter Kwan on Oct-24-2013 03:52
Hi Albert,

By default, if ChartDirector is used to automatically labels the axis, it may not start the axis at the lowest data value. For example, if your lowest data value is 13187.091273587, ChartDirector may not start the axis there. It is because ChartDirector prefers to put labels at the axis end points, but it would put "nice labels", such as one label every 1000 units or 5000 units, etc., but not a label at 13187.091273587.

Suppose based on your data range and axis length, ChartDirector decides to put one label per 5000 units. In this case, the axis will be labelled as 10000, 15000, 20000, 25000, ..... So it will start from 10000 instead of 13187.091273587, because 10000 is a good label position.

For your y-axis, if the data is from 3000 to 30000, and if your axis is very long so that there is enough space for 28 labels, ChartDirector may put one label per 1000 units, and so the axis will be from 3000 to 30000. However, if your axis is not long enough for 28 labels, and ChartDirector ends up using one label per 5000 units, the axis will be 0, 5000, 10000, ..... Therefore it can start from 0.

If you want to use your lowest and highest data values as the axis end points, in addition to setAutoScale, you may use:

c->xAxis()->setRounding(false, false);
c->yAxis()->setRounding(false, false);

With the above code, ChartDirector will not insist to start and end the axis at a label position.

If the above still cannot solve the problem, would you mind to attach a sample chart to help me understand the issue? (I need to see exactly how the axis is labelled, the axis length, your data distribution, etc.)

Hope this can help.

Regards
Peter Kwan

  Re: SurfaceChart and setAutoScale
Posted by Albert on Oct-24-2013 18:14
Hello Peter,
yes that solved the issue. I don't know how I could not see that function in the reference.

Thank you very very much!