UNPKG

echarts

Version:

A powerful charting and visualization library for browser

32 lines (31 loc) 1.03 kB
define(function (require) { var getLineStyle = require('./makeStyleMapper')( [ ['lineWidth', 'width'], ['stroke', 'color'], ['opacity'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['shadowColor'] ] ); return { getLineStyle: function (excludes) { var style = getLineStyle.call(this, excludes); var lineDash = this.getLineDash(style.lineWidth); lineDash && (style.lineDash = lineDash); return style; }, getLineDash: function (lineWidth) { if (lineWidth == null) { lineWidth = 1; } 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]); } }; });