|
How to turn off auto date fill on an axis. |
Posted by Norbert Skalski on Jun-08-2011 02:47 |
|
Hey guys,
Sorry about asking this question again, i'm sure it's been asked to death, but i can't seem to
get the right words into search to find something that can help me. I have an array of
dates like this: (this is all done in java)
["2011-06-01","2011-06-02","2011-06-03","2011-06-06","2011-06-07"]
The whole graph renders correctly, except that the dates "2011-06-04" and "2011-06-05"
appear in the graph. I don't want them. How on earth do i get rid of them. I would figure
it would be some simple toggle call. Like: chart.xAxis().turnOffSmartPantsLabelFill() or
something :P
Alas it is not so. So how do i get rid of the filler?
Thanks! |
Re: How to turn off auto date fill on an axis. |
Posted by Peter Kwan on Jun-08-2011 16:34 |
|
Hi Norbert,
If you are using a label based axis, ChartDirector will not label the axis automatically.
Consider the chart from the "Simple Bar Chart" sample code as attached. The y data used for the bars are [85, 156, 179.5, 211, 123]. But the y-axis labels are [0, 50, 100, 150, 200, 250]. You can see the axis labels are not based on the data values, but the axis range is based on the data range. This method of labelling applies to linear, log and date/time axis scale.
On the other hand, for the x-axis (which is ["Mon", "Tue", "Wed", "Thu", "Fri"]), the labels are exact the same as the data. ChartDirector only treats the x-axis labels as "names" for human reading. They have no meaning to the computer, and is just shown as is.
If you want the x-axis labels to be shown as is, you may use a label based x-axis. Instead of using Layer.setXData, please use:
//assume your labels is an array of text strings
c.xAxis().setLabels(myXData);
or
//assume your labels is an array of dates (in Java, date means java.util.Date object)
c.xAxis().setLabels2(myXData, "{value|yyyy-mm-dd}");
Hope this can help.
Regards
Peter Kwan
|
|