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 |