|
setXData3, setXData4? |
Posted by John Stellberg on Jan-17-2013 01:48 |
|
I see that it is possible to use setXData2 to interleave two different X axes.
Would it be possible to have even more?
I hope to graph data that may have up to four different intervals and ranges for the X axis. |
Re: setXData3, setXData4? |
Posted by Peter Kwan on Jan-17-2013 23:55 |
|
Hi John,
Do you mean you need one x-axis on the chart, and you have data that uses 4 different part of the x-axis? An example is that you have an x-axis that spans 1 year, and some data series are using the range Jan to Mar, and another data series is using the range Jul to Aug, and so on.
If the above is the case, the code is like (in C#/Java):
//xData1 can be from Jan to Mar
LineLayer layer = c.addLineLayer(myYData1, ....);
layer.setXData(XData1);
//xData2 can be from Jul to Aug
LineLayer layer = c.addLineLayer(myYData2, ....);
layer.setXData(XData2);
You may also use setXData2 to set the x-axis range of the two data series, assuming the data points within the data series are evenly distributed within the data ranges.
LineLayer layer = c.addLineLayer(myYData1, ....);
layer.setXData2(startX1, endX1);
LineLayer layer = c.addLineLayer(myYData2, ....);
layer.setXData2(startX2, endX2);
If a chart really needs multiple x-axes, the x-axes scale are usually "related". If the two x-axes are unrelated (which means the staring point of one x-axis can be aligned with an unknown point on the second x-axis, and one unit on one x-axis would be equivalent to a random number of units on the second x-axis), the relative position of the two data series using the two x-axes would be random, and there would not be any basis to compare or relate the two data series.
If the two x-axes are related, it means it is possible to convert x-coordinates of one axis to another x-axis. In this case, your code would need to convert x-coordinates so that all data series are using the x-coordinates of the same x-axis in setXData and setXData2. You can have additional x-axes (eg. configured using Axis.setDataScale, with the axis being the xAxis2 or added using XYChart.addAxis) showing different scales but they are for human reading only.
Hope this can help.
Regards
Peter Kwan |
|