Skip to content

Add ability to set desired margins #91

@matoos32

Description

@matoos32

While investigating issue #32 using the demo app, I first added the ability to set the time-axis lower and upper margin values in ChartBuilder. While this worked fine for time-gapped charts that use DateAxis, this quickly became non-trivial for gapless charts that rely on NumberAxis. Part of the issue was the gapless chart NumberAxis not adding tick labels in the margin area of the axis like DateAxis does. The other was if the margin value was set near or above 0.01 (1% of the axis range) in gapless charts, then the logic in NumberAxis#selectHorizontalAutoTickUnit(Graphics2D, Rectangle2D, RectangleEdge) would "guess" a number of ticks that was way too large. The result was too many closely packed tick labels with labels and plotted data overlapping. It seemed to have to do with the TickUnit size being calculated too small (~2.0) as opposed to a value of 5.0. When I hard-coded the gapless chart tick unit to 5.0 it created a nice amount of ticks with margin values above 0.01.

This ticket is to find a way to allow setting top/right/bottom/left margin values with charts rendering OK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions