Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CartesianLayerPaddingProvider #941

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tyler-Lopez
Copy link

@Tyler-Lopez Tyler-Lopez commented Nov 1, 2024

Background

This commit introduces CartesianLayerPaddingProvider, a means to retrieve CartesianLayerPadding with an ExtraStore. This commit does not substantially conflict with pre-existing functionality as CartesianLayerPaddingProvider.fixed is identical.

Motivation

CartesianLayerPadding was recently added. This allows clients to provide padding to the start and end of a chart. However, these values are provided without an ExtraStore. Therefore, I believe that the values provided will never be synchronously safe.

With an ExtraStore, we can calculate the correct spacing safely.

Future Work

The discovery of the desire to change this parameter came from some advanced requirements with points.

#939

I would like to move the horizontal and vertical insets achieved through getLargestPoint to being client-provided in CartesianLayerPadding. The basic demand for that is that currently, getLargestPoint + unscalableStartPadding can result in an unnecessary amount of padding. Further, imagine that we only had a point at the very middle of the graph. We should, in that case, not inset the chart at all to account for the point horizontally. We should do the top if it is the maximum value in the series.

So, I would also like to introduce unscalableTopPadding and unscalableBottomPadding and change getLargestPoint to only impact the point spacing.

Note

I could be completely incorrect in the basic assertion here that this is necessary to correctly have synchronous padding: for example, to avoid a bad state if the padding, which is dependent on the line thickness, changes before the transaction finishes. Please correct me if I am wrong.

@Tyler-Lopez Tyler-Lopez force-pushed the lopez/layer-padding-extra-store branch from bc94a52 to 666b9e3 Compare November 1, 2024 19:25
@Tyler-Lopez Tyler-Lopez marked this pull request as ready for review November 1, 2024 19:26
Add CartesianLayerPaddingProvider

This commit introduces CartesianLayerPaddingProvider, a means to retrieve CartesianLayerPadding with an `ExtraStore`. This commit does not substantially conflict with pre-existing functionality as `CartesianLayerPaddingProvider.fixed` is identical.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant