From: stockiNail Date: Wed, 28 Oct 2020 11:12:52 +0000 (+0100) Subject: Legend item lineWidth is the average of borderWidth when set as object (Bar) (#7964) X-Git-Tag: v3.0.0-beta.5~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea047f5cf2931e43990ca30b95f93ec7c3be517e;p=thirdparty%2FChart.js.git 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 --- diff --git a/src/plugins/plugin.legend.js b/src/plugins/plugin.legend.js index 0329570d3..87f078f9c 100644 --- a/src/plugins/plugin.legend.js +++ b/src/plugins/plugin.legend.js @@ -3,7 +3,7 @@ import Element from '../core/core.element'; import layouts from '../core/core.layouts'; import {drawPoint} from '../helpers/helpers.canvas'; import { - callback as call, merge, valueOrDefault, isNullOrUndef, toFont, + callback as call, merge, valueOrDefault, isNullOrUndef, toFont, isObject, toPadding, getRtlAdapter, overrideTextDirection, restoreTextDirection, INFINITY } from '../helpers/index'; @@ -746,6 +746,7 @@ export default { return chart._getSortedDatasetMetas().map((meta) => { 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 { text: datasets[meta.index].label, @@ -755,7 +756,7 @@ export default { lineDash: style.borderDash, lineDashOffset: style.borderDashOffset, lineJoin: style.borderJoinStyle, - lineWidth: style.borderWidth, + lineWidth: borderWidth, strokeStyle: style.borderColor, pointStyle: overrideStyle || style.pointStyle, rotation: style.rotation,