mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-07 20:59:08 +02:00
Legend item lineWidth is the average of borderWidth when set as object (Bar) (#7964)
* fixed default of tension property of line element * Fix #7942 * Fixes some lint errors * fixes "Expected property shorthand" error
This commit is contained in:
parent
68bae7906d
commit
ea047f5cf2
@ -3,7 +3,7 @@ import Element from '../core/core.element';
|
|||||||
import layouts from '../core/core.layouts';
|
import layouts from '../core/core.layouts';
|
||||||
import {drawPoint} from '../helpers/helpers.canvas';
|
import {drawPoint} from '../helpers/helpers.canvas';
|
||||||
import {
|
import {
|
||||||
callback as call, merge, valueOrDefault, isNullOrUndef, toFont,
|
callback as call, merge, valueOrDefault, isNullOrUndef, toFont, isObject,
|
||||||
toPadding, getRtlAdapter, overrideTextDirection, restoreTextDirection,
|
toPadding, getRtlAdapter, overrideTextDirection, restoreTextDirection,
|
||||||
INFINITY
|
INFINITY
|
||||||
} from '../helpers/index';
|
} from '../helpers/index';
|
||||||
@ -746,6 +746,7 @@ export default {
|
|||||||
|
|
||||||
return chart._getSortedDatasetMetas().map((meta) => {
|
return chart._getSortedDatasetMetas().map((meta) => {
|
||||||
const style = meta.controller.getStyle(usePointStyle ? 0 : undefined);
|
const style = meta.controller.getStyle(usePointStyle ? 0 : undefined);
|
||||||
|
const borderWidth = isObject(style.borderWidth) ? (valueOrDefault(style.borderWidth.top, 0) + valueOrDefault(style.borderWidth.left, 0) + valueOrDefault(style.borderWidth.bottom, 0) + valueOrDefault(style.borderWidth.right, 0)) / 4 : style.borderWidth;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
text: datasets[meta.index].label,
|
text: datasets[meta.index].label,
|
||||||
@ -755,7 +756,7 @@ export default {
|
|||||||
lineDash: style.borderDash,
|
lineDash: style.borderDash,
|
||||||
lineDashOffset: style.borderDashOffset,
|
lineDashOffset: style.borderDashOffset,
|
||||||
lineJoin: style.borderJoinStyle,
|
lineJoin: style.borderJoinStyle,
|
||||||
lineWidth: style.borderWidth,
|
lineWidth: borderWidth,
|
||||||
strokeStyle: style.borderColor,
|
strokeStyle: style.borderColor,
|
||||||
pointStyle: overrideStyle || style.pointStyle,
|
pointStyle: overrideStyle || style.pointStyle,
|
||||||
rotation: style.rotation,
|
rotation: style.rotation,
|
||||||
|
Loading…
Reference in New Issue
Block a user