diff --git a/src/model/mixin/lineStyle.js b/src/model/mixin/lineStyle.js index 868e7d82c3405af8c078113a528e455fc8cb6bcd..188987555421708c4ad753031235fafb0683f5ea 100644 --- a/src/model/mixin/lineStyle.js +++ b/src/model/mixin/lineStyle.js @@ -34,8 +34,9 @@ var getLineStyle = makeStyleMapper( export default { getLineStyle: function (excludes) { var style = getLineStyle(this, excludes); - var lineDash = this.getLineDash(style.lineWidth); - lineDash && (style.lineDash = lineDash); + // Always set lineDash whether dashed, otherwise we can not + // erase the previous style when assigning to el.style. + style.lineDash = this.getLineDash(style.lineWidth); return style; }, @@ -46,7 +47,15 @@ export default { var lineType = this.get('type'); var dotSize = Math.max(lineWidth, 2); var dashSize = lineWidth * 4; - return (lineType === 'solid' || lineType == null) ? null - : (lineType === 'dashed' ? [dashSize, dashSize] : [dotSize, dotSize]); + return (lineType === 'solid' || lineType == null) + // Use `false` but not `null` for the solid line here, because `null` might be + // ignored when assigning to `el.style`. e.g., when setting `lineStyle.type` as + // `'dashed'` and `emphasis.lineStyle.type` as `'solid'` in graph series, the + // `lineDash` gotten form the latter one is not able to erase that from the former + // one if using `null` here according to the emhpsis strategy in `util/graphic.js`. + ? false + : lineType === 'dashed' + ? [dashSize, dashSize] + : [dotSize, dotSize]; } }; \ No newline at end of file diff --git a/test/hoverStyle.html b/test/hoverStyle.html index 993ed69bf5a8566046a069cd0697752f1c04d74d..e3f80dc22f979b8b7d527fac41196931c1151630 100644 --- a/test/hoverStyle.html +++ b/test/hoverStyle.html @@ -57,6 +57,7 @@ under the License.
+
@@ -328,6 +329,56 @@ under the License. + + + + + +