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

Message ListMessage List     Post MessagePost Message

  y axis time
Posted by Donald Rath on Dec-12-2016 08:35
I am sure this has been answered before but I could not easily find it.  I am simply trying to plot an array of times (y-axis) by time of day (x-axis).  The yaxis data is an array of time values that generally range from 00:00:00 to 00:20:00 and the x is time of day.  I have other graphs with x axis as time of day with no problem, but I can't seem to do the time in the y-axis. Help please.

  Re: y axis time
Posted by Peter Kwan on Dec-13-2016 01:29
Hi Donald,

There are several methods. If the y-axis represent "elasped time", you may use a number to specify the elapsed time in seconds. So the y-coordinates are just numbers. Then the y-axis can be configured using:

// From 0 to 1200 with 120 seconds per label
c.yAxis().setLinearScale(0, 1200, 120);
c.yAxis().setLabelFormat("{value|nn:ss}");

If you prefer the y-axis to be auto-scaled, you would need to specify exactly how you would like to auto-scale. An example is:

// If the auto-scaling is for numbers (setLinearScale), the label spacing will be in natural
// decade increments like 10, 20, 50 or 100 or similar
// If the auto-scaling is for date/time (setDateScale), the label spacing will be in natural
// date/time units, like 30, 60, 120, etc..
c.yAxis().setDateScale3("{value|nn:ss}");

// Add this line if you want the y-axis to always start from 0
c.yAxis().setDateScale(0, Chart.NoValue);

// Add this line if you want the y-axis to always start and end at a label position. This is
// the default for numeric axis but not date/time axis.
c.yAxis().setRounding(true, true);

You may also use setAutoScale to add axis margins, as for date/time axis the default axis margin is 0.

Hope this can help.

Regards
Peter Kwan