-0.15
-0.1
-5.0e-2
0
5.0e-2
0.1
0.15
0.2
Does anyone else think that the labels for +/-0.05 look out-of-place?
The reason we get 5.0e-2 instead of 0.05 is because we use plain
"show" on labels, and this is the standard haskell behaviour for
showing Float/Double.
The attached patch changes the label-showing function from "show" to
"Numeric.showFFloat", which never uses scientific notation. Whilst it
makes the anomalous example look better, I am not convinced it is
necessarily the best solution for all situations. Any thoughts?
Regards,
Malcolm
Actually, that was an incorrect version of the patch. I attach a
corrected version.
Regards,
Malcolm
I agree that a more complex algorithm may be better in the general case,
but this is still
better than the plain old Show that we have now.
Tim
dollar, percent :: Double -> String
dollar v = "$"++ show v
percent v = show (v*100) ++ "%"
I am not completely satisfied with this, because although labelling
for most types can be overridden, labelling for dates/times is not,
even if you pass in a custom labeller. But this does an adequate job
for the simpler types.
Regards,
Malcolm
Can you given an example of how this would be used? Is it meant to
simplify the existing way of doing this, which would be something like:
layout = layout1_title ^= "Price History"
...
$ layout1_left_axis ^: laxis_generate ^= autoScaledAxis lap
$ defaultLayout1
lap =defaultLinearAxis{la_labelf_=dollar}
Tim