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

Enable stacked scales and with reverse option support #655

Merged
merged 18 commits into from
Apr 4, 2022
Merged

Enable stacked scales and with reverse option support #655

merged 18 commits into from
Apr 4, 2022

Conversation

stockiNail
Copy link
Collaborator

@stockiNail stockiNail commented Jan 24, 2022

Fix #652

This PR is changing the defaults of yMin/Max options when missing.
It applies the same logic was implemented in the plugin version < 1.

It adds the control of the scale reverse options and stacked scales.

Recap about which locate methods is affected:

Name Scale Options Values options Stacked Scales Reverse Scales
box xScaleID, yScaleID x/yMin, x/yMax Yes Yes
point xScaleID, yScaleID x/yValue Yes No
line scaleID value, endValue No No

@stockiNail stockiNail marked this pull request as draft January 24, 2022 12:23
@stockiNail stockiNail marked this pull request as ready for review January 24, 2022 12:58
@stockiNail stockiNail changed the title Change defaults of yMin/Max when missing Enable stacked scales and with reverse option Jan 27, 2022
@stockiNail stockiNail changed the title Enable stacked scales and with reverse option Enable stacked scales and with reverse option support Jan 27, 2022
@stockiNail
Copy link
Collaborator Author

@kurkle the stacked scales support is forcing us to change all functions used to get the location of annotations (not only the box ones) because the default dimension is not the chart area anymore but scale one.
Furthermore, the chart area is also used in some drawing phase to check if inside or not and also this part must be re-evaluated.
Therefore this PR needs additional updates

@stockiNail stockiNail marked this pull request as draft January 28, 2022 10:18
@stockiNail
Copy link
Collaborator Author

Working on line annotation, I have recognized that the line annotation is working slightly different comparing with the other annotation when the location of the annotation is using x/yMin and x/yMax.
I wanted to use the helpers to get a rectangle on the chart (as used for all other annotations) but I have seen that it could work but this changes the current behavior of the line annotation.

Currently the x,y properties of line annotation element couldn't reflect the top,left of the box. The same for x2,y2 which couldn't be the bottom,right. This is because the properties are not checked and the line can be drawn correctly as well.

But x,y (and x2,y2) element properties are used by the sub elements of the annotation for the their position (label, arrow heads).

When #532 will be implemented, this could be taken care, because this could change significantly the chart rendering.

@stockiNail stockiNail marked this pull request as ready for review January 31, 2022 08:29
docs/guide/migrationV2.md Outdated Show resolved Hide resolved
docs/guide/migrationV2.md Outdated Show resolved Hide resolved
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
@stockiNail stockiNail merged commit 17352cd into chartjs:master Apr 4, 2022
@stockiNail stockiNail deleted the fixDefaultsMinMax branch April 4, 2022 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants