Can PointProvider.getLargestPoint be removed? #939
Replies: 3 comments 4 replies
-
I do notice here it is necessary for the vertical inset, which is interesting - so that isn't covered here. Would it ever be considered to move this vertical inset into the layer padding object? For now, for my purposes, I am thinking that I will have Imagine a chart that just goes down with a point at the end, I would not want to factor that point into the vertical inset, is what I'm thinking. |
Beta Was this translation helpful? Give feedback.
-
I have a WIP PR here to address this issue which retains |
Beta Was this translation helpful? Give feedback.
-
Hello, @Tyler-Lopez.
Could you elaborate? While I understand that the extra padding is unwanted, you're the one adding it.
Is this referring cases like the one you mentioned here — when there's no point along a particular edge that would require an inset?
This could cause the insets to change during data updates, as when the y values change, a different point may end up having the largest y value. Such a change in the insets would cause the chart to suddenly resize. Wouldn't that look somewhat unpleasant?
Insets and padding are different. Specifically, insets are outside of the External inset customization could be added, but then it should be done for both horizontal and vertical insets, and most likely via a new API, not |
Beta Was this translation helpful? Give feedback.
-
Edit 2:
I've separated out the layer padding changes to use an ExtraStore here #941
Edit:
I have thought on this some, and I am thinking the ideal would be that if
CartesianLayerPadding
could (doesn't always have to be, but the capability should be there, I think) provided usingExtraStore
. Then, I think thatgetLargestPoint
as it pertains to determining horizontal or vertical insets should be removed (it may still be needed for point spacing) and incorporated intoCartesianLayerPadding
. This is something I am actively considering, but these are my thoughts at the moment. The rationale here is the incorrect padding included in this message and also that we won't always have points symmetrically at the start, end, top, and bottom. Maybe we just need to pad the point on the end or top but not the start or bottom.Original Message
Hi there!
I would like to propose that
PointProvider.getLargestPoint
be removed in favor of consolidating it intoCartesianLayerPadding
. I may be missing something here, and haven't given this too much thought from the implementation perspective. I did think this was interesting though and wanted to share for thoughts and if there was anything here I wasn't considering.I would note here that I recognize this is putting the responsibility of the client to know how much they should inset the chart by for points. Given the change to remove the automatic
Segmented
HorizontalLayout
, I wonder if that is ok and perhaps even a path further in the direction the maintainers are going for?Examples
In these example,
CartesianChartHost
is given a background color ofGray
so we can see its borders. The points are all24.dp
big, and the line thickness is24.dp
.You would thus expect that we need to have the chart inset
12.dp
as for both the points and the line, that is how much will stick out.Whenever I say "not
PointProvider.getLargestPoint
" what I mean is that I am setting it to return null.Case 1: With
CartesianLayerPadding
ANDPointProvider.getLargestPoint
There is too much space by
12.dp
because the additional padding added by the point and the additional padding added byCartesianLayerPadding
are cumulative to24.dp
.Case 2: With
PointProvider.getLargestPoint
AND NOTCartesianLayerPadding
There is a perfect amount of space, because
CartesianLayerPadding
would have been12.dp
andPointProvider.getLargestPoint
provides that.Case 3: With neither
CartesianLayerPadding
ORPointProvider.getLargestPoint
The points are clipped, and the line also is not given the appropriate room.
Case 4: With
CartesianLayerPadding
AND NOTPointProvider.getLargestPoint
There is a perfect amount of space, because
PointProvider.getLargestPoint
would have been12.dp
andCartesianLayerPadding
provides that.Beta Was this translation helpful? Give feedback.
All reactions