|
About XYCHART |
Posted by jianweichen on May-05-2017 18:22 |
|
My X axis data are {0.27,0.46,0.80,1.35,1.75,2.22,2.74,3.26,3.74,4.15,4.32,4.46,4.58,4.76 ,4.81}. Y axis data are{120,100,80,60,50,40,30 ,20,10,0,-5,-10,-15,-25,-30}. I want to set the XYCHART x axis data as {0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5}. How I can input my data to draw XYCHART, the two x axis are different. |
Re: About XYCHART |
Posted by Peter Kwan on May-06-2017 01:44 |
|
Hi ianweichen,
If you want the x-axis scale to be 0, 0.5, 1, 1.5, .... 5.5, the code is (in C++):
//Set x-axis scale to 0 to 5.5, with a tick every 0.5 unit
c->xAxis()->setLinearScale(0, 5.5, 0.5);
If you do specify the x-axis scale, ChartDirector will automatically determine the scale. It will consider many factors, including:
- the x-data range
- the minimum pixel spacing between labels (configurable with Axis.setTickDensity)
- the minimum data value spacing between labels (configurable with Axis.setMinTickInc)
- extending the scale to ensure there is scale margins or to ensure the axis includes 0 (configurable with Axis.setAutoScale)
- extending the scale to ensure the axis scale starts and ends at a label position (configurable with Axis.setRounding)
Hope this can help.
Regards
Peter Kwan |
|