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)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 1 Jun 2015 04:55:39 +0000 (06:55 +0200)
commitd5f9f3dea48e19a139827e9876385e0fa660cf38
treea23533843faf1d0ba95fa6e0f16676d1631033a8
parent73f03b54b10a9afa075e8dcf059cb225a038edab
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]