Declare and document all five Scale draw stages - #12327
Open
aron-intframe wants to merge 1 commit into
Open
aron-intframe wants to merge 1 commit into
aron-intframe wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Scale#drawdispatches to five methods, one per part of the axis (drawBackground,drawGrid,drawBorder,drawTitle,drawLabels), andRadialLinearScaleoverrides all five. TheScaletype declares only three, and givesdrawTitleachartAreaparameter neither call site passes, so a TypeScript scale cannot reach the other two throughsuperandsuper.drawTitle()does not compile:This declares all five and documents them in
docs/developers/axes.md. That is the part of #3214 still open: #8598 split the drawing into these methods, but they were never written down as the supported way to customize one part of an axis.Narrowing
drawTitle(chartArea: ChartArea)todrawTitle()is a types-only break for anyone who declared that parameter, though it has always beenundefinedat runtime. Happy to usechartArea?: ChartAreainstead.User-Facing Changes
None at runtime. TypeScript scales can now override all five draw stages, and the docs list them.
Tests
test/types/extensions/scale.tsoverrides the five stages throughsuper: the errors above before,tsc -p test/typesclean after. A newCore.scale drawspec asserts the dispatch order and thatdrawTitlegets no arguments; makingdrawpasschartAreato it turns that spec red. Full suite 1704/1704, Chrome headless 148 on Linux.