fix legend line point style not showing the dataset dash - #12292
Open
HuzaifaChaudary wants to merge 1 commit into
Open
fix legend line point style not showing the dataset dash#12292HuzaifaChaudary wants to merge 1 commit into
HuzaifaChaudary wants to merge 1 commit into
Conversation
with usePointStyle the legend reads its style from the point scope and that scope has no borderDash on it so a line symbol always came out solid even when the dataset line was dashed. take the dash off the dataset element for the line point style only so markers like circle or rect keep drawing solid.
HuzaifaChaudary
force-pushed
the
fix/legend-line-point-style-dash
branch
from
August 29, 2026 22:05
a099b55 to
a1a33cd
Compare
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.
fixes #12291
what happens
with
usePointStyle: trueandpointStyle: 'line'the legend key draws solid even when the dataset hasborderDashon it. the plotted line is dashed but the key beside it is not so the two do not match.why it happens
the drawing side is already right.
drawLegendBoxdoesso the dash would be honoured if it were there. it is not there. the miss is one step earlier in
generateLabelswhen
usePointStyleis on this asks for index 0 which resolves the point scope and the point element has noborderDashon it. sostyle.borderDashcomes back undefined and the legend item gets an empty dash. whenusePointStyleis off it asks for the dataset element which does carry the dash and that is why the plain box legend has always drawn it fine.i printed both scopes on master to be sure rather than going off the defaults list
the change
read the dash off the dataset element but only when the point style is
line. that style stands for the dataset line itself so it should look like it. every other point style is a marker and keeps resolving exactly as before so a dashed dataset does not suddenly get a chopped up circle or rect outline. on chart types with no dataset element such as bargetStyle(undefined)falls back to the same point options so nothing moves there either.checked
test/specs/plugin.legend.tests.js79 of 79 pass and that includes all 52 legend image fixtures so the existing legend rendering is untouchedi went narrow on purpose here. if you would rather every point style inherit the dataset dash when
usePointStyleis on i am happy to widen it. also glad to add an image fixture if you want one though the legend needs text so i left it out to avoid a chrome against firefox mismatch.