-
Notifications
You must be signed in to change notification settings - Fork 981
Description
Tick generation in ScottPlot works but has been sub-ideal for quite some time, as noted by several issues: #66, #57, #54, #47, #28, #17, #3, #2, and #1
Creating tick marks for an axis seems like an easy task at first, but there are several tricky parts that make this difficult to implement cleanly, simply, and correctly. Rather than continuing to pile extra functionality onto the current tick module (hacks on top of hacks), let's get this right and demonstrate it working in an isolated class independent of ScottPlot. Once a new (and good) tick generator is working, I can modify ScottPlot to use it.
Programming Problem
A procedural style seems ideal for this task. A good solution will be short, easy to read, and avoid nested loops and if statements as much as possible. This function should probably be developed and tested using a Console Application.
The tick generator should take in:
- the 4 corners of a plot (units):
double x1,double x2,double y1,double y2 - the width and height of the plot (pixels):
int width,int height - font and font size (for determining if ticks overlap)
- an optional manually-defined tick spacing
The tick generator should produce:
- an array of tick locations for each axis (a double array of actual units)
- an array of tick labels for each axis (a string array)
- a double for the multiplier of each axis (to display in the corners)
- a double for the offset of each axis (to display in the corners)
Visual Representation
Misc
- when using exponential notation, keep the coefficient less than 10 - @bukkideme commented in (mantissa too large in scientific notation mode #66)
- when using exponential notation, use "1e123" notation (not 10e123) - @bukkideme commented in (mantissa too large in scientific notation mode #66)
- @Padanian has been working on this in Updates to TicksExperimental #69
