plainheart commented on a change in pull request #12961:
URL:
https://github.com/apache/incubator-echarts/pull/12961#discussion_r470588142
##########
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:
The second issue:
if we make `borderDashArray/dashArray(line)` to be a value of
`borderType/type(line)`,
the `ITEM_STYLE_KEY_MAP` in `model/mixin/itemStyle.ts` will miss the
property `borderDash` and
the `LINE_STYLE_KEY_MAP` in `model/mixin/lineStyle.ts` will miss the
property `lineDash`.
This two missing properties can't be get by `getItemVisual`, so dash style
will be not working in some cases like `lines`,
refer to
[chart/helper/Line.ts#L206](https://github.com/apache/incubator-echarts/blob/next/src/chart/helper/Line.ts#L206).
It's different from [line
series](https://github.com/apache/incubator-echarts/blob/next/src/chart/line/LineView.ts#L543)
and
[4.x](https://github.com/apache/incubator-echarts/blob/master/src/chart/helper/Line.js#L374)
which are using `lineStyleModel.getLineStyle()`
So how should I do to make it work for those series dependent on
`chart/helper/Line.js`?
----------------------------------------------------------------
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]