Legend Symbol Parameter [deleted]#4806
Closed
touletan wants to merge 16 commits intochartjs:masterfrom
touletan:master
Closed
Legend Symbol Parameter [deleted]#4806touletan wants to merge 16 commits intochartjs:masterfrom touletan:master
touletan wants to merge 16 commits intochartjs:masterfrom
touletan:master
Conversation
Legend Symbol Parameter [New Feature]
etimberg
reviewed
Oct 2, 2017
docs/charts/doughnut.md
Outdated
| | `hoverBackgroundColor` | `Color[]` | The fill colour of the arcs when hovered. | ||
| | `hoverBorderColor` | `Color[]` | The stroke colour of the arcs when hovered. | ||
| | `hoverBorderWidth` | `Number[]` | The stroke width of the arcs when hovered. | ||
| | `legendSymbol` | `String[]` | Symbol to display as label when usePointStyle is false (size is based on fontSize except for large symbol (ending with Lg) where boxWidth is used in this case). Values are rectLg, lineLg, rectRoundedLg and other values from [PointStyle](./elements.md/#point-styles) |
Member
There was a problem hiding this comment.
I think it might make sense to split large vs small into a separate boolean.
Member
There was a problem hiding this comment.
or, if boxWidth is defined, use it else use the fontSize
…e (boxWidth) or not (fontSize as width)
Contributor
Author
|
New legendSymbolLarge property has been added. |
etimberg
reviewed
Oct 3, 2017
| var fontSize = helpers.valueOrDefault(opts.fontSize, defaults.global.defaultFontSize); | ||
| return helpers.isArray(data.datasets) ? data.datasets.map(function(dataset, i) { | ||
| var itemLegendSymbol = (opts.usePointStyle && (dataset.pointStyle || defaults.global.elements.point.pointStyle)) || dataset.legendSymbol || (opts.legendSymbol); | ||
| var itemLegendSymbolLarge = typeof dataset.legendSymbolLarge !== 'undefined' ? dataset.legendSymbolLarge : (typeof opts.legendSymbolLarge !== 'undefined' ? opts.legendSymbolLarge : (opts.usePointStyle ? false : true)); |
Member
There was a problem hiding this comment.
You might be able to use helpers.getValueOrDefault since this pattern is used in a few places.
| pointStyle: dataset.pointStyle, | ||
| legendSymbol: itemLegendSymbol, | ||
| boxWidth: (opts.usePointStyle && (fontSize * Math.SQRT2)) || (itemLegendSymbol.slice(-2) === 'Lg' ? opts.boxWidth : (fontSize * Math.SQRT2)), | ||
| legendSymbol: (opts.usePointStyle && (dataset.pointStyle || defaults.global.elements.point.pointStyle)) || dataset.legendSymbol || (opts.legendSymbol), |
Member
There was a problem hiding this comment.
does legendSymbol negate the need for the pointStyle property on the line above? If so, is removing it a breaking change?
src/helpers/helpers.canvas.js
Outdated
| var type, edgeLength, xOffset, yOffset, height, size; | ||
| drawPoint: function(ctx, style, width, fontSize, x, y, isLineWidthZero) { | ||
|
|
||
| <<<<<<< HEAD |
src/helpers/helpers.canvas.js
Outdated
|
|
||
| drawPoint: function(ctx, style, radius, x, y) { | ||
| var type, edgeLength, xOffset, yOffset, height, size; | ||
| drawPoint: function(ctx, style, width, fontSize, x, y, isLineWidthZero) { |
Member
There was a problem hiding this comment.
I don't knw that fontSize should be a param here. height makes a lot more sense.
Contributor
Author
|
I will reopen a new one..... |
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.
Replaced by
New Pull Request