UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

784 lines (783 loc) 31.7 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __values = (this && this.__values) || function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getFollowMarkLineSeries = exports.updateSeriesDataByBound = exports.updateTagColors = exports.getBaseLineBar2Series = exports.getBaseLineSeries = exports.updateCrossAxisMax = exports.updateSeriesByBand = exports.getPredict = exports.updateEmphasizeAreas = exports.getMarkAreas = exports.getBand = exports.toOverlapLineSeries = exports.toLineSeries = void 0; var lodash_1 = require("lodash"); var echarts_1 = require("echarts"); var two_d_1 = require("../transforms/two-d"); var chart_style_1 = require("../../../constants/chart-style"); function notEmpty(e) { return !!e; } var lineMapper = function (lineData, isZeroEmptyValueMode, isTimeValue, isCompare, isOverlap) { if (isTimeValue === void 0) { isTimeValue = false; } if (isCompare === void 0) { isCompare = false; } if (isOverlap === void 0) { isOverlap = false; } var newData = (lodash_1.isArray(lineData) ? lineData : []).map(function (item) { var value = item.metricValue; if (value === 'Infinity' || value === '-Infinity') { value = null; } if (isZeroEmptyValueMode && !value) { value = 0; } var itemName = item.name; return __assign(__assign({}, item), { name: item.key, metric: itemName, value: isTimeValue ? [item.key, value] : value, isCompare: isCompare, isOverlap: isOverlap }); }); var name = lodash_1.get(lineData, [0, 'name']) || ''; var metricName = lodash_1.get(lineData, [0, 'metricName']) || ''; var fieldType = lodash_1.get(lineData, [0, 'fieldType']) || ''; return { name: name, type: 'line', metricName: metricName, data: newData, isOverlap: isOverlap, fieldType: fieldType }; }; var toLineSeries = function (data, isZeroEmptyValueMode, isTimeValue) { if (data === void 0) { data = []; } if (isTimeValue === void 0) { isTimeValue = false; } var series = []; if (data) { data.forEach(function (lineData) { series.push(lineMapper(lineData, isZeroEmptyValueMode, isTimeValue)); }); } return series; }; exports.toLineSeries = toLineSeries; var toOverlapLineSeries = function (data, isZeroEmptyValueMode, isTimeValue) { if (data === void 0) { data = { current: [] }; } if (isTimeValue === void 0) { isTimeValue = false; } var series = []; if (data.current) { data.current.forEach(function (lineData, index) { series.push(lineMapper(lineData, isZeroEmptyValueMode, isTimeValue, false, true)); if (data.compare && data.compare[index]) { series.push(lineMapper(data.compare[index], isZeroEmptyValueMode, isTimeValue, true, true)); } }); } return series; }; exports.toOverlapLineSeries = toOverlapLineSeries; // 分组时,分组与原字段的分隔符。 var GROUP_SEPARATOR = ':'; // 生成条带series function getBand(bandList, hoveredSeries, dataset, xField, y1IsZeroEmptyValueMode, isTimeValue) { var _a, _b; if (isTimeValue === void 0) { isTimeValue = false; } if (bandList.length < 1 || (!hoveredSeries && bandList.length > 1)) return []; var lowField = ''; var upField = ''; var hoveredSeriesName = hoveredSeries === null || hoveredSeries === void 0 ? void 0 : hoveredSeries.seriesName; var currentBand = bandList.length === 1 && bandList[0].lowerBorder && bandList[0].upperBorder ? bandList[0] : bandList.find(function (item) { if (item.field === hoveredSeriesName && item.lowerBorder && item.upperBorder) return true; if (hoveredSeriesName === null || hoveredSeriesName === void 0 ? void 0 : hoveredSeriesName.startsWith(item.field + GROUP_SEPARATOR)) return true; }); if (!currentBand) return []; lowField = currentBand.lowerBorder || ((_a = dataset.fields.find(function (item) { return item.key.startsWith("lower_predicted_" + hoveredSeriesName); })) === null || _a === void 0 ? void 0 : _a.key) || ''; upField = currentBand.upperBorder || ((_b = dataset.fields.find(function (item) { return item.key.startsWith("upper_predicted_" + hoveredSeriesName); })) === null || _b === void 0 ? void 0 : _b.key) || ''; var lowFieldIndex = dataset.fields.findIndex(function (field) { return field.key === lowField; }); var upFieldIndex = dataset.fields.findIndex(function (field) { return field.key === upField; }); if (lowFieldIndex === -1 || upFieldIndex === -1) { return []; } var lowerDataService = exports.toLineSeries(two_d_1.getSeriesFromDataset(dataset, [], xField, [lowField]), y1IsZeroEmptyValueMode, isTimeValue); var upperDataService = exports.toLineSeries(two_d_1.getSeriesFromDataset(dataset, [], xField, [upField]), y1IsZeroEmptyValueMode, isTimeValue); var upperSery = upperDataService[0]; var lowerSery = lowerDataService[0]; var lower = __assign(__assign({}, lowerSery), { metricName: lowField, type: 'line', stack: 'Total', tooltip: { show: false }, isBaseLine: true, lineStyle: { opacity: 0 }, emphasis: { disabled: true } }); var data = lowerSery ? upperSery.data.map(function (item, index) { var _a; var value = item.value === null ? null : item.value - ((_a = lowerSery.data[index]) === null || _a === void 0 ? void 0 : _a.value) || 0; return __assign(__assign({}, item), { value: value, // 因为value为stack转换后的值,故将originValue记录下来 originValue: item.value }); }) : upperSery.data; var upper = __assign(__assign({}, upperSery), { metricName: upField, type: 'line', stack: 'Total', tooltip: { show: false }, isBaseLine: true, lineStyle: { opacity: 0 }, areaStyle: { color: '#e1f4d8', origin: 'start' }, data: data, emphasis: { disabled: true } }); return [lower, upper]; } exports.getBand = getBand; // 根据markAreas配置,在图表中画出标记区域 var getMarkAreas = function (markAreas) { var markAreaData = markAreas.map(function (area) { return [area.min, area.max, area.color]; }); return { type: 'custom', silent: true, data: markAreaData, renderItem: function (params, api) { var min = api.value(0); var max = api.value(1); var color = api.value(2); var startPoint = api.coord([0, max]); var endPoint = api.coord([0, min]); if (endPoint[1] < params.coordSys.y) endPoint[1] = params.coordSys.y; if (!min && min !== 0) { endPoint[1] = params.coordSys.y + params.coordSys.height; } if (!max && max !== 0) { startPoint[1] = params.coordSys.y; } var rectShape = echarts_1.graphic.clipRectByRect({ // 矩形的位置和大小。 x: params.coordSys.x, y: startPoint[1], width: params.coordSys.width, height: endPoint[1] - startPoint[1] }, { // 当前坐标系的包围盒。 x: params.coordSys.x, y: params.coordSys.y, width: params.coordSys.width, height: params.coordSys.height }); var style = api.style(); style.fill = color; return (rectShape && { type: 'rect', shape: rectShape, style: style }); } }; }; exports.getMarkAreas = getMarkAreas; var findIndex = function (dataList, num) { var _a; var start; for (var i = 0; i < dataList.length; i++) { var currentName = dataList[i].name; var nextName = (_a = dataList[i + 1]) === null || _a === void 0 ? void 0 : _a.name; if (currentName < num && nextName > num) { if (num - currentName > nextName - num) { start = i + 1; } else { start = i; } break; } } return start; }; // 根据emphasizeAreas配置,在图表中画出强调区域 var updateEmphasizeAreas = function (emphasizeAreas, series) { emphasizeAreas.forEach(function (area) { var _a, _b, _c, _d, _e, _f, _g; var startPoint = { name: area.name, itemStyle: { color: area.color || 'transparent', borderWidth: 1, borderType: 'dashed', borderColor: area.borderColor || '#ff0000' } }; var endPoint = {}; var currentSery; if (area.seryTag) { currentSery = series.find(function (item) { var _a; return (_a = item.name) === null || _a === void 0 ? void 0 : _a.startsWith(area.seryTag); }); } if (area.sery) { var nameMatch = series.find(function (item) { return item.name === area.sery; }); if (nameMatch) { currentSery = nameMatch; } } if (!currentSery) { currentSery = series[0]; } var startIndex = (_a = currentSery === null || currentSery === void 0 ? void 0 : currentSery.data) === null || _a === void 0 ? void 0 : _a.findIndex(function (item) { return item.name === area.minX; }); if (!lodash_1.isNil(startIndex) && startIndex !== -1) { startPoint.xAxis = startIndex; } else if (lodash_1.isString(area.minX)) { startPoint.x = area.minX; } else if (lodash_1.isNumber(area.minX) && lodash_1.isNumber((_b = currentSery.data[0]) === null || _b === void 0 ? void 0 : _b.name)) { var start = findIndex(currentSery === null || currentSery === void 0 ? void 0 : currentSery.data, area.minX); if (!lodash_1.isNil(start)) { startPoint.xAxis = start; } } if (!lodash_1.isNil(area.minY)) { if (typeof area.minY === 'string') { startPoint.y = area.minY; } else { startPoint.yAxis = area.minY; } } else { startPoint.y = 'min'; } if (!lodash_1.isNil(area.maxX)) { var endIndex = (_c = currentSery === null || currentSery === void 0 ? void 0 : currentSery.data) === null || _c === void 0 ? void 0 : _c.findIndex(function (item) { return item.name === area.maxX; }); if (!lodash_1.isNil(endIndex) && endIndex !== -1) { endPoint.xAxis = endIndex; } else if (lodash_1.isString(area.maxX)) { endPoint.x = area.maxX; } else if (lodash_1.isNumber(area.maxX) && lodash_1.isNumber((_d = currentSery.data[0]) === null || _d === void 0 ? void 0 : _d.name)) { var end = findIndex(currentSery === null || currentSery === void 0 ? void 0 : currentSery.data, area.maxX); if (!lodash_1.isNil(end)) { endPoint.xAxis = end; } } } else { endPoint.y = 'max'; } if (!lodash_1.isNil(area.maxY)) { if (typeof area.maxY === 'string') { endPoint.y = area.maxY; } else { endPoint.yAxis = area.maxY; } } else { endPoint.y = 'max'; } var data = [startPoint, endPoint]; if (((_f = (_e = currentSery.markArea) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.length) > 0) { (_g = currentSery.markArea) === null || _g === void 0 ? void 0 : _g.data.push(data); } else { currentSery.markArea = { silent: true, label: { color: area.color || '#ff0000' }, data: [data] }; } }); }; exports.updateEmphasizeAreas = updateEmphasizeAreas; // 生成预测series function getPredict(bandList, dataset, showingSeries, y1IsZeroEmptyValueMode, isTimeValue) { var e_1, _a; var _b; if (isTimeValue === void 0) { isTimeValue = false; } var predictBand = bandList === null || bandList === void 0 ? void 0 : bandList.filter(function (item) { return item.forecast; }); if (predictBand && predictBand.length < 1) return []; var result = []; var _loop_1 = function (currentBand) { var e_2, _a; var predictedFieldList = currentBand.upperBorder ? ["predicted_" + currentBand.field] : dataset.fields .filter(function (item) { return item.key.startsWith("predicted_" + currentBand.field); }) .map(function (ii) { return ii.key; }); var _loop_2 = function (predictedField) { var predictedFieldIndex = dataset.fields.findIndex(function (field) { return field.key === predictedField; }); if (predictedFieldIndex === -1) return "continue"; var predictedDataService = predictedFieldIndex !== -1 && exports.toLineSeries(two_d_1.getSeriesFromDataset(dataset, [], predictedField, [ dataset.fields[predictedFieldIndex].key ]), y1IsZeroEmptyValueMode, isTimeValue); var predictedSery = predictedDataService && predictedDataService[0]; var mainLine = showingSeries.find(function (item) { return item.name === predictedSery.name.substr(10); }); var itemStyle = { normal: { color: '#ff0000' } }; if (mainLine) { itemStyle = mainLine.itemStyle; } var predicted = predictedSery && __assign(__assign({}, predictedSery), { lineStyle: { type: 'dashed' }, itemStyle: itemStyle }); result.push(predicted); }; try { for (var predictedFieldList_1 = (e_2 = void 0, __values(predictedFieldList)), predictedFieldList_1_1 = predictedFieldList_1.next(); !predictedFieldList_1_1.done; predictedFieldList_1_1 = predictedFieldList_1.next()) { var predictedField = predictedFieldList_1_1.value; _loop_2(predictedField); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (predictedFieldList_1_1 && !predictedFieldList_1_1.done && (_a = predictedFieldList_1.return)) _a.call(predictedFieldList_1); } finally { if (e_2) throw e_2.error; } } }; try { for (var predictBand_1 = __values(predictBand), predictBand_1_1 = predictBand_1.next(); !predictBand_1_1.done; predictBand_1_1 = predictBand_1.next()) { var currentBand = predictBand_1_1.value; _loop_1(currentBand); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (predictBand_1_1 && !predictBand_1_1.done && (_a = predictBand_1.return)) _a.call(predictBand_1); } finally { if (e_1) throw e_1.error; } } var firstPredictedSery = result && result[0]; var bandStartIndex = (_b = firstPredictedSery === null || firstPredictedSery === void 0 ? void 0 : firstPredictedSery.data) === null || _b === void 0 ? void 0 : _b.findIndex(function (item) { return item.value !== null; }); if (bandStartIndex) { firstPredictedSery.markArea = { silent: true, label: { color: '#ff0000' }, itemStyle: { color: 'transparent', borderWidth: 1, borderType: 'dashed', borderColor: '#ff0000' }, data: [ [ { name: 'forecast', xAxis: bandStartIndex }, { x: 'max', y: 'max' } ] ] }; } return result; } exports.getPredict = getPredict; // 根据异常边界,展示异常点 function updateSeriesByBand(series, bandList, dataset) { var errorColor = '#ff0000'; // 处理点标红 series.forEach(function (sery) { var seryName = sery.name; var lowField = ''; var upField = ''; var band = bandList.find(function (item) { return item.field === sery.name; }); if (band && band.lowerBorder && band.upperBorder && !band.forecast) { lowField = band.lowerBorder; upField = band.upperBorder; } else { var group = bandList.find(function (item) { return seryName.startsWith(item.field + GROUP_SEPARATOR); }); if (group && !group.forecast) { lowField = "lower_predicted_" + seryName; upField = "upper_predicted_" + seryName; } } var lowFieldIndex = dataset.fields.findIndex(function (field) { return field.key === lowField; }); var upFieldIndex = dataset.fields.findIndex(function (field) { return field.key === upField; }); if (lowFieldIndex === -1 || upFieldIndex === -1) { return; } sery.data.forEach(function (data, index) { var value = data.value; var lowerValue = lodash_1.get(dataset, ['rows', index, lowFieldIndex, 0]) || -Infinity; var upperValue = lodash_1.get(dataset, ['rows', index, upFieldIndex, 0]) || Infinity; var hasError = value < lowerValue || value > upperValue; if (hasError) { data.symbolSize = 8; data.showSymbol = true; data.itemStyle = { color: errorColor }; data.emphasis = { itemStyle: { color: errorColor } }; } else { data.itemStyle = { color: 'rgba(0,0,0,0)', borderWidth: 0 }; } }); sery.symbolSize = 8; sery.showSymbol = true; }); } exports.updateSeriesByBand = updateSeriesByBand; // 计算坐标系的最大值,防止最大值变化时出现抖动 function updateCrossAxisMax(lastMaxOb, hoveredSeries) { return function (value) { if (lastMaxOb.current) { // hover的时候不重新计算,防止抖动 if (hoveredSeries === null || hoveredSeries === void 0 ? void 0 : hoveredSeries.seriesName) return lastMaxOb.current; if (value.max > lastMaxOb.current || value.max <= lastMaxOb.current / 2) { var res = value.max + value.max * 0.2; lastMaxOb.current = res; return res; } else { return lastMaxOb.current; } } else { var res = value.max + value.max * 0.2; lastMaxOb.current = res; return res; } }; } exports.updateCrossAxisMax = updateCrossAxisMax; function getBaseLineSeries(baseLines, dataset, defaultColor, chartType, xField, y1IsZeroEmptyValueMode, isTimeValue, showYAxis) { var e_3, _a; if (isTimeValue === void 0) { isTimeValue = false; } if (showYAxis === void 0) { showYAxis = true; } var numberLine = []; var dynamicLine = []; try { for (var baseLines_1 = __values(baseLines), baseLines_1_1 = baseLines_1.next(); !baseLines_1_1.done; baseLines_1_1 = baseLines_1.next()) { var line = baseLines_1_1.value; if (line.type === chart_style_1.EBaseLineType.NUMBER) { numberLine.push(line); } else { dynamicLine.push(line); } } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (baseLines_1_1 && !baseLines_1_1.done && (_a = baseLines_1.return)) _a.call(baseLines_1); } finally { if (e_3) throw e_3.error; } } var numberSeries = { type: 'line', data: [], markLine: { silent: true, symbol: ['none', 'none'], label: { show: false }, data: numberLine.map(function (line) { var _a, _b; var color = line.color, value = line.value, lineType = line.lineType; return chartType === chart_style_1.ChartType.Scatter || chartType === chart_style_1.ChartType.Bubble ? (_a = {}, _a[line.mode === chart_style_1.EScatterMode.Horizontal ? 'yAxis' : 'xAxis'] = value, _a.lineStyle = { color: color || defaultColor[0], type: lineType || 'solid' }, _a) : (_b = {}, _b[showYAxis ? 'yAxis' : 'xAxis'] = value, _b.lineStyle = { color: color || defaultColor[0], type: lineType || 'solid' }, _b); }) } }; var dynamicSeries = dynamicLine .map(function (line) { var fieldIndex = dataset.fields.findIndex(function (field) { return field.key === line.value; }); if (fieldIndex === -1) { return null; } var dataService = exports.toLineSeries(two_d_1.getSeriesFromDataset(dataset, [], xField, [ dataset.fields[fieldIndex].key ]), y1IsZeroEmptyValueMode, isTimeValue); return __assign(__assign({}, dataService[0]), { metricName: line.value, type: 'line', step: 'middle', tooltip: { show: false }, isBaseLine: true, lineStyle: { color: line.color || defaultColor[0], type: line.lineType || 'solid', width: 1 } }); }) .filter(notEmpty); return { numberSeries: numberSeries, dynamicSeries: dynamicSeries }; } exports.getBaseLineSeries = getBaseLineSeries; function getBaseLineBar2Series(baseLines, dataset, defaultColor, xField, y1IsZeroEmptyValueMode, y2IsZeroEmptyValueMode, isTimeValue) { if (isTimeValue === void 0) { isTimeValue = false; } var dynamicLine = baseLines.filter(function (line) { return line.type === chart_style_1.EBaseLineType.DYNAMIC; }); var numberLinesLeft = baseLines.filter(function (line) { return line.type === chart_style_1.EBaseLineType.NUMBER && line.mode === chart_style_1.ELineBarMode.Left; }); var numberLinesRight = baseLines.filter(function (line) { return line.type === chart_style_1.EBaseLineType.NUMBER && line.mode === chart_style_1.ELineBarMode.Right; }); var numberLeftSeries = { type: 'line', data: [], markLine: { silent: true, symbol: ['none', 'none'], label: { show: false }, data: numberLinesLeft.map(function (line) { var color = line.color, value = line.value, lineType = line.lineType; return { yAxis: value, lineStyle: { color: color || defaultColor[0], type: lineType || 'solid' } }; }) } }; var numberRightSeries = { type: 'line', data: [], yAxisIndex: 1, markLine: { silent: true, symbol: ['none', 'none'], label: { show: false }, data: numberLinesRight.map(function (line) { var color = line.color, value = line.value, lineType = line.lineType; return { yAxis: value, lineStyle: { color: color || defaultColor[0], type: lineType || 'solid' } }; }) } }; var dynamicSeries = dynamicLine .map(function (line) { var fieldIndex = dataset.fields.findIndex(function (field) { return field.key === line.value; }); if (fieldIndex === -1) { return null; } var dataService = exports.toLineSeries(two_d_1.getSeriesFromDataset(dataset, [], xField, [ dataset.fields[fieldIndex].key ]), line.mode === chart_style_1.ELineBarMode.Left ? y1IsZeroEmptyValueMode : y2IsZeroEmptyValueMode, isTimeValue); return __assign(__assign({ metricName: line.value, type: 'line' }, dataService[0]), { step: 'middle', tooltip: { show: false }, yAxisIndex: line.mode === chart_style_1.ELineBarMode.Left ? 0 : 1, lineStyle: { color: line.color || defaultColor[0], type: line.lineType || 'solid', width: 1 } }); }) .filter(notEmpty); return { numberLeftSeries: numberLeftSeries, numberRightSeries: numberRightSeries, dynamicSeries: dynamicSeries }; } exports.getBaseLineBar2Series = getBaseLineBar2Series; function updateTagColors(series, tagColors) { var tagColorMap = tagColors.reduce(function (pre, cur) { pre[cur.tag] = 0; return pre; }, {}); series.forEach(function (item) { var aim = tagColors.find(function (tagColor) { var _a; return (_a = item.name) === null || _a === void 0 ? void 0 : _a.startsWith(tagColor.tag); }); if (aim) { var tag = aim.tag, colors = aim.colors; if (tagColorMap[tag] >= colors.length - 1) { tagColorMap[tag] = 0; } else { tagColorMap[tag] = tagColorMap[tag] + 1; } var displayColor = colors[tagColorMap[tag]]; item.itemStyle = lodash_1.assign(item.itemStyle, { normal: { color: displayColor } }); item.lineStyle = lodash_1.assign(item.lineStyle, { color: displayColor }); item.emphasis = lodash_1.assign(item.emphasis, { disabled: true }); } }); } exports.updateTagColors = updateTagColors; function updateSeriesDataByBound(series, baseLine, dynamicSeries, callback) { var upperBound = baseLine .filter(function (line) { return line.bound === chart_style_1.EBaseLineBound.UPPER; }) .map(function (e) { // e.value 为string表示动态基线,value为指标值 if (typeof e.value === 'string') { var series_1 = dynamicSeries.find(function (s) { return s.metricName === e.value; }); return series_1 ? __assign(__assign({}, e), { value: series_1.data }) : null; } return e; }) .filter(notEmpty); var lowerBound = baseLine .filter(function (line) { return line.bound === chart_style_1.EBaseLineBound.LOWER; }) .map(function (e) { if (typeof e.value === 'string') { var series_2 = dynamicSeries.find(function (s) { return s.metricName === e.value; }); return series_2 ? __assign(__assign({}, e), { value: series_2.data }) : null; } return e; }) .filter(notEmpty); series.forEach(function (serie) { serie.data = serie.data.map(function (data, index) { var upperLine = upperBound .map(function (e) { if (Array.isArray(e.value)) { // 动态线 return __assign(__assign({}, e), { value: e.value[index].value }); } return e; }) .sort(function (a, b) { return b.value - a.value; }); var upperItem = upperLine.find(function (e) { return e.value < data.value; }); if (upperItem) { return callback(data, upperItem); } var lowerLine = lowerBound .map(function (e) { if (Array.isArray(e.value)) { // 动态线 return __assign(__assign({}, e), { value: e.value[index].value }); } return e; }) .sort(function (a, b) { return a.value - b.value; }); var lowerItem = lowerLine.find(function (e) { return e.value > data.value; }); if (lowerItem) { return callback(data, lowerItem); } return data; }); }); } exports.updateSeriesDataByBound = updateSeriesDataByBound; // 点击效果保持 function getFollowMarkLineSeries(markLine) { var xAxisValue = markLine.xAxis; var yAxisValue = markLine.yAxis; var lineColor = markLine.line.color || 'rgba(0, 0, 0, .4)'; var lineType = markLine.line.type || 'dashed'; var serieX, serieY; if (xAxisValue && xAxisValue !== 'none') { serieX = { type: 'line', data: [], markLine: { silent: true, animation: false, symbol: ['none', 'none'], label: { show: false }, lineStyle: { type: lineType, color: lineColor }, data: [ { xAxis: xAxisValue } ] } }; } if (yAxisValue && yAxisValue !== 'none') { serieY = { type: 'line', data: [], markLine: { silent: true, animation: false, symbol: ['none', 'none'], label: { show: false }, lineStyle: { type: lineType, color: lineColor }, data: [ { yAxis: yAxisValue } ] } }; } return { serieX: serieX, serieY: serieY }; } exports.getFollowMarkLineSeries = getFollowMarkLineSeries;