[vtk-developers] Tick position calculation in vtkAxis
Tharindu De Silva
tsameera1 at gmail.com
Mon Aug 15 14:46:07 EDT 2011
Hi All,
I have uploaded the implementation of the paper , "An Extension
of Wilkinson’s Algorithm for Positioning Tick Labels on Axes" (
http://vis.stanford.edu/files/2010-TickLabels-InfoVis.pdf) to gerrit for
review (http://review.source.kitware.com/#change,2473) The paper implements
the automated system for choosing positions and labels for axis tick
marks.The methods contained in the paper are mainly contained in a class
named vtkAxisExtended. I made also some changes to the vtkAxis class to
incorporate some additional functions described in the paper.
This is an optimization based algorithm. If the algorithm fails to come up
with a good labeling scheme, as a last resort, it tries changing the font
size, format and orientation of the labels. There are eight different axis
label formats in this implementation.
1 - Scientific 5 * 10^6
2- Decimal e.g. 5000
3 - Thousands K e.g. 5K
4 - Factored K e.g. 5(K)
5 - Millions M e.g. 5M
6 - Factored M e.g. 5(M)
7 - Factored Decimals e.g. 5 (thousands)
8 - Factored Scientific 5 (10^6)
Currently, in the vtkAxis class there are only 2 different formats
(scientific and fixed i.e. 1 and 2 in the above list). When automatically
selecting one of the above formats, there is the question how do you set the
precision, since there are divisions involved. I followed this scheme:
** When the scientific labeling is used the precision given by the user is
used to set the number of decimal points. (2 is the default)
** In all other schemes, if the division doesn't result in any decimal
points that number is used, if not the precision is set according to the
user given value.
For e.g., if the optimization based algorithm selects the 3rd label format
scheme, it will result
30K for the input 30,000
34.56K for the input 34 567
34.567K for the input 34.567 if the user changed the precision
property to 3.
In this algorithm, user can specify a desired font size. So if the
LabelProperties->FontSize is set by the user, that value is given a higher
weight (default is 12). That way user has a control on the font size of the
labels.
Charts/Testing/Cxx/TestLinePlot2.cxx has a test for this implementation,
that replicates the figure 1 given in the paper.
I would like to get your ideas/comments on how to improve and review the
code.
Thank you,
Regards,
Tharindu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110815/3e540bdf/attachment.html>
More information about the vtk-developers
mailing list