|
add support for localized scientific notation |
Posted by Michael Opitz on Nov-25-2008 16:46 |
|
Please provide some support for localized scientific notation.
You already provide support for localized number format (sign, thousands-sep, minus), Weekdays, Months, am/pm.
But the localized scientific notation is missing:
Example:
Now it is fixed with E/e which will result in 1.234E+6. But I would like to have 1.234x10^(-)6,where the plus should be optional:
1.234E6 or 1.234x10^6 or 1.234x10^+6 but always 1.234x10^-3
Regards,
Michael
p.s. the option to provide G/g for conditional formatting is great! |
Re: add support for localized scientific notation |
Posted by Peter Kwan on Nov-26-2008 00:24 |
|
Hi Michael,
I assume the numbers you would like to format are the axis labels created by ChartDirector auto-scaling. (If the labels are created by your code as opposed to auto-scaling, you can always use any format you like by formatting with your own code.)
You may use the following method to format the auto-scaled axis labels using your own code. In this way, you can use any format you like (in Java):
//freeze chart and auto-scale axis to get the tick positions
c.layout();
double[] ticks = c.yAxis().getTicks();
for (int i = 0; i < ticks.length; ++i)
c.yAxis().addLabel(ticks[i], myFormatFunction(ticks[i]));
In the above, myFormatFunction is a function that accepts a number (double) and returns a text string. You can use this function to format the number in anyway you want.
Hope this can help.
Regards
Peter Kwan |
|