|
format y axis in chartdirector by supplying seconds |
Posted by shahiddarbar on Mar-07-2013 00:42 |
|
If I fill the y- axis with points (seconds)
now can i set a rule that each point gets formatted according
to the number of seconds
example: 100 - should display 1m 40 seconds, and likewise
is this possible? |
Re: format y axis in chartdirector by supplying seconds |
Posted by Peter Kwan on Mar-07-2013 23:35 |
|
Hi shahiddarbar,
You may set the format string to {value|hh:nn:ss}. For example, in C#/Java:
c.yAxis().setLabelFormat("{value|hh:nn:ss}");
Hope this can help.
Regards
Peter Kwan |
Re: format y axis in chartdirector by supplying seconds |
Posted by shahiddarbar on Mar-07-2013 23:39 |
|
thanks for reply,
but that will set it same for all labels,
as per my question i want to do this.
if it is 100 - it should say - 1m 40s
if it is 3700 - it should say - 1h 1m 40s
if it is 86500 - it should say - 1d 1m 40s
is this achieveable ? |
Re: format y axis in chartdirector by supplying seconds |
Posted by Peter Kwan on Mar-09-2013 00:19 |
|
Hi shahiddarbar,
If you would like to set the axis scale with your code, you can always set the scale and specify the labels to use by using Axis.setLinearScale2 or Axis.setDateScale2.
If you would ChartDirector to auto-scale the axis and determine the label position, but what to use a special formatting scheme that is not built into ChartDirector, you may use custom formatting. First, your code can use BaseChart.layout to ask ChartDirector to auto-scale the axis (this should be done after your code has entered all the data to the chart object). After that, your code can use Axis.getTicks to ask ChartDirector for the label positions, then use Axis.addLabel to specify the label to use at those positions.
An example is at:
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1307455427#N1307474796
Hope this can help.
Regards
Peter Kwan |
|