histogram tick drawing - added format generation for optimum tick drawing
authorFriedrich Beckmann <friedrich.beckmann@hs-augsburg.de>
Sun, 31 May 2015 22:20:01 +0000 (00:20 +0200)
committerFriedrich Beckmann <friedrich.beckmann@gmx.de>
Sun, 31 May 2015 23:06:39 +0000 (01:06 +0200)
commitf89d8a893f83ad0cb95819ca60e6f4a718f7d988
treeb8667d79b126a7f4d54047ff2aa20c2dff15ef10
parent6a0bfe2697f4de29cc11782ac6bd2c4175554a9c
histogram tick drawing - added format generation for optimum tick drawing

Fixes bug #45192 which showed up in the gtk3 branch on MacOS.

It replaces the decimal_xxx computations with a routine that computes a
formatting string and a scale factor for a given axis range and number of
bins. The formatting will switch between normal and scientific depending on
the length of the displayed label text. The formatting is such that no
rounded numbers like 3.9999999 when in fact 4 is expected is shown.
Differences between bins remain visible in the tick labels.

In addition the width of the rendered labels is compared with the width
of the bins in the display such that the labels will automatically
switch between horizontal and 45 degree display.
src/math/chart-geometry.c
src/math/chart-geometry.h
src/output/cairo-chart.c
src/output/cairo-chart.h
src/output/charts/plot-hist-cairo.c
tests/automake.mk
tests/math/chart-geometry.at
tests/math/chart-get-ticks-format-test.c [new file with mode: 0644]