-
Notifications
You must be signed in to change notification settings - Fork 12k
Legend Symbol Parameter [deleted] #4806
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
Conversation
Legend Symbol Parameter [New Feature]
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might make sense to split large vs small into a separate boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or, if boxWidth is defined, use it else use the fontSize
…e (boxWidth) or not (fontSize as width)
New legendSymbolLarge property has been added. |
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a bad merge here
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't knw that fontSize
should be a param here. height
makes a lot more sense.
I will reopen a new one..... |
Replaced by
New Pull Request