plainheart commented on a change in pull request #12961:
URL:
https://github.com/apache/incubator-echarts/pull/12961#discussion_r470579708
##########
File path: src/model/mixin/itemStyle.ts
##########
@@ -54,15 +64,24 @@ class ItemStyleMixin {
includes?: readonly (keyof ItemStyleOption)[]
): ItemStyleProps {
const style = getItemStyle(this, excludes, includes);
- const lineDash = this.getBorderLineDash();
- lineDash && (style.lineDash = lineDash);
+ style.lineDash = this.getBorderLineDash(style.lineWidth);
return style;
}
- getBorderLineDash(this: Model): number[] {
+ getBorderLineDash(this: Model, lineWidth?: number): number[] {
const lineType = this.get('borderType');
- return (lineType === 'solid' || lineType == null) ? null
- : (lineType === 'dashed' ? [5, 5] : [1, 1]);
+ if (lineType == null || lineType === 'solid') {
+ return [];
+ }
+
+ lineWidth = lineWidth || 0;
+
+ let dashArray = this.get('borderDashArray');
+ // compatible with single number
+ if (dashArray != null && !isNaN(dashArray)) {
+ dashArray = [+dashArray];
+ }
+ return dashArray || (lineType === 'dashed' ? [5, 5] : [1, 1]);
}
Review comment:
@pissang There is an issue puzzling me. We added a semantic value
`bolder` in #13013, but I found this special value will affect the calculation
of default dash/dot size and return an illegal value `NaN`. Perhaps, we should
change the logic about either `LineView` or `model/mixin/lineStyle`?
https://github.com/apache/incubator-echarts/blob/next/src/chart/line/LineView.ts#L553-L557
https://github.com/apache/incubator-echarts/blob/next/src/model/mixin/lineStyle.ts#L53
https://github.com/apache/incubator-echarts/blob/next/src/model/mixin/lineStyle.ts#L62-L63
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]