企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
路径 D:\ireport365\ireport365.war\js\enduser\designer\vs-component-echarts.js 一 k线图 初始化数据 数据处理函数 和k线图 option对象 ~~~ // K线图初始化数据 var k = [["LG",5499.0,6499.0,5499.0,6499.0,5999.0,2,72.0],["TCL",769.0,2499.0,769.0,2499.0,1694.71,7,8461.0],["七星",638.0,638.0,638.0,638.0,638.0,1,55.0],["万宝",558.0,1049.0,558.0,1049.0,790.8,5,1447.0],["三星",2399.0,6499.0,2399.0,6499.0,4161.5,8,1291.0],["上菱",759.0,1699.0,759.0,1699.0,1131.5,4,241.0],["先科",399.0,549.0,399.0,549.0,482.0,3,532.0],["创维",849.0,2299.0,849.0,2299.0,1540.0,9,3887.0],["华日电器",769.0,999.0,769.0,999.0,884.0,2,120.0],["博世",2490.0,12830.0,2490.0,12830.0,5995.0,6,388.0],["卡萨帝",6999.0,8999.0,6999.0,8999.0,7999.0,2,126.0],["双鹿",599.0,1029.0,599.0,1029.0,796.5,4,1169.0],["哈士奇",996.0,8799.0,996.0,8799.0,2254.22,9,758.0],["奥克斯",699.0,2599.0,699.0,2599.0,1649.0,2,309.0],["奥马",499.0,2999.0,499.0,2999.0,1913.29,7,2679.0],["容声",958.0,5699.0,958.0,5699.0,2649.9,20,21814.0],["富信",339.0,439.0,339.0,439.0,382.333,3,810.0],["尊贵",2299.0,2988.0,2299.0,2988.0,2695.33,3,323.0],["小天鹅",1099.0,1099.0,1099.0,1099.0,1099.0,1,114.0],["康佳",698.0,2598.0,698.0,2598.0,1486.38,16,13779.0],["德努希",1698.0,3799.0,1698.0,3799.0,2965.33,3,125.0],["志高",438.0,639.0,438.0,639.0,538.5,2,119.0],["扎努西・伊莱克斯",1149.0,1149.0,1149.0,1149.0,1149.0,1,71.0],["扬佳",518.0,638.0,518.0,638.0,558.0,3,467.0],["新飞",799.0,2999.0,799.0,2999.0,1726.18,11,2014.0],["晶弘",749.0,3999.0,749.0,3999.0,2365.67,9,1648.0],["松下",3490.0,7590.0,3490.0,7590.0,4710.0,5,830.0],["樱花",538.0,699.0,538.0,699.0,598.143,7,2595.0],["欧立",419.0,599.0,419.0,599.0,509.0,2,290.0],["海信",559.0,4299.0,559.0,4299.0,2380.18,17,6639.0],["海尔",649.0,7399.0,649.0,7399.0,2816.61,38,41402.0],["海浪",508.0,658.0,508.0,658.0,583.0,2,209.0],["熊猫",538.0,1180.0,538.0,1180.0,766.833,6,6301.0],["索伊",589.0,589.0,589.0,589.0,589.0,1,285.0],["统帅",719.0,3399.0,719.0,3399.0,2001.5,8,4989.0],["美的",699.0,3999.0,699.0,3999.0,1974.44,18,23296.0],["美菱",799.0,4299.0,799.0,4299.0,2227.57,14,8440.0],["荣事达",1299.0,1299.0,1299.0,1299.0,1299.0,1,77.0],["西门子",2398.0,16030.0,2398.0,16030.0,5372.11,28,6388.0],["长虹",749.0,1149.0,749.0,1149.0,949.0,2,443.0],["韩上",488.0,999.0,488.0,999.0,816.8,5,6730.0],["韩电",638.0,1999.0,638.0,1999.0,1094.0,9,918.0]]; // 处理数组对象 function splitData(rawData) { var categoryData = []; var values = []; var avgvalues = []; var counts = []; var solds = []; for (var i = 0; i < rawData.length; i++) { categoryData.push(rawData[i].splice(0, 1)[0]); avgvalues.push(rawData[i].splice(4, 1)[0]); counts.push(rawData[i].splice(4, 1)[0]); solds.push(rawData[i].splice(4, 1)[0]); values.push(rawData[i]) } return { categoryData: categoryData, values: values, avgvalues: avgvalues, counts: counts, solds: solds }; } var klineData = splitData(k); // console.log(klineData.categoryData); // K线图对象 var klineOptionTemplate = { title: { show: false }, tooltip: { trigger: 'axis', formatter: function (params) { if (params.length > 0) { var i = params[0].dataIndex; var html = ''; for(var p in params) { var seriesName = params[p].seriesName; var value = params[p].value; if (p == 0) { html += seriesName + "<br>"; var name = params[p].name; html += name + "<br>"; var mValue1 = value[1]; var mValue2 = value[2]; if (mValue1 >= mValue2) { html += "最高价格:" + mValue1 + "<br>"; html += "最低价格:" + mValue2 + "<br>"; } else { html += "最高价格:" + mValue2 + "<br>"; html += "最低价格:" + mValue1 + "<br>"; } } else { html += seriesName + ":" + value + "<br>"; } } return html; } else { return ""; } } }, legend: { show:true, data: ['价格区间', '平均价格', '商品数', '30天总销量'] }, // dataZoom: [{ // type: 'inside', // start: 0, // end: 50 // }, // { // show: true, // type: 'slider', // y: '90%', // start: 0, // end: 50 // } // ], dataZoom: { show: false, realtime: true, showDetail: true, handleSize: 12, height: 30, type: 'slider', backgroundColor:"rgba(47,69,84,0)", //组件的背景颜色 fillerColor:"rgba(167,183,204,0.6)", //选中范围的填充颜色。 borderColor:"#ddd", //边框颜色。 filterMode: 'filter', throttle:100, left:"center", //组件离容器左侧的距离,'left', 'center', 'right','20%' top:"bottom", //组件离容器上侧的距离,'top', 'middle', 'bottom','20%' right:"auto", //组件离容器右侧的距离,'20%' bottom:"0%", //组件离容器下侧的距离,'20%' }, grid: { left: '10%', right: '10%', bottom: '15%' }, xAxis: [{ type: 'category', scale: true, boundaryGap: false, axisLine: { lineStyle: { color: "#DDD", width: 1, shadowBlur: 0, shadowOffsetX: 0, shadowOffsetY: 0 }, show: true }, splitLine: { lineStyle: { color: "#F6F6F6" }, show: false }, axisTick: { show: false }, axisLabel: { textStyle: { color: "#666", fontSize: 12 } }, splitNumber: 20, data:klineData.categoryData }], yAxis: [{ type: 'value', name: '价格', position: 'left', axisLine: { lineStyle: { color: "#666", width: 1, shadowBlur: 0, shadowOffsetX: 0, shadowOffsetY: 0 }, show: true }, splitLine: { lineStyle: { color: "#000" }, show: false }, }, { type: 'value', name: '商品数', position: 'right', axisLine: { lineStyle: { color: "#666", width: 1, shadowBlur: 0, shadowOffsetX: 0, shadowOffsetY: 0 }, show: true }, splitLine: { lineStyle: { color: "#F6F6F6" }, show: false }, }, { type: 'value', name: '30天总销量', position: 'right', offset: 50, axisLine: { lineStyle: { color: "#666", width: 1, shadowBlur: 0, shadowOffsetX: 0, shadowOffsetY: 0 }, show: true }, splitLine: { lineStyle: { color: "#F6F6F6" }, show: false }, } ], series: [{ name: '价格区间', type: 'candlestick', data:klineData.values, barWidth: 10, itemStyle: { normal: { color: "#ff8800", borderColor: "#ff8800" } }, markPoint: { data: [ ] } }, { name: '平均价格', type: 'line', smooth: true, data: klineData.avgvalues, lineStyle: { normal: { opacity: 0.5 } } }, { name: '商品数', type: 'line', data: klineData.counts, yAxisIndex: 1, smooth: true, lineStyle: { normal: { opacity: 0.5 } } }, { name: '30天总销量', type: 'line', data:klineData.solds, yAxisIndex: 2, smooth: true, lineStyle: { normal: { opacity: 0.5 } } } ] }; ~~~ 二 添加k线图 ~~~ { name: "", type: "linegrapht", coverImage: contextPath + "/images/componenttypes/" + locale + "/echarts/zh_kline.png", coverImageWidth: a, tip: "K线图" }, ~~~ 三 copy k线图 对象 ~~~ case "linegrapht": option = angular.copy(klineOptionTemplate); break; ~~~ 四添加 调用数据处理函数 ~~~ case "linegrapht": internalRefreshKlineModelData(); break; ~~~ 五 数据处理函数 ~~~ // k线图处理数据函数 var internalRefreshKlineModelData = function(){ var option2 = component.config.chartConfig; var option = component.config.chartConfig; var dimensions = component.config.datasourceConfig.dimensions; var measures = component.config.datasourceConfig.measures; var data = component.context.data; // console.info(data); if (data == null || data.length < 1 || measures.length < 1) { return } // x轴的标签 var xAxisLabels = []; var candlestickValue = []; // 遍历最后一个维度的所有指标 for (var i = 0; i < data.length; i++) { // push进去每一个遍历出来的指标 xAxisLabels.push(data[i][dimensions[dimensions.length - 1].name]) if (measures.length >= 2) { var values = []; values.push((data[i][measures[0].name])); values.push((data[i][measures[1].name])); values.push((data[i][measures[0].name])); values.push((data[i][measures[1].name])); candlestickValue.push(values); } } // 判断标签数组里有没有数组 if (xAxisLabels.length == 0) { // 没有则为空 xAxisLabels = [""] } component.context.originalXAxisLabels = null; if (!VSUtils.isEmpty(component.config.xAxisLabelScript)) { // 复制x轴维度数组 component.context.originalXAxisLabels = angular.copy(xAxisLabels); try { // 计算字符串 var f = eval("(function(labelData){ " + Base64.decode(component.config.xAxisLabelScript) + "})"); f.call(null, xAxisLabels) } catch (e) { console.log(e) } } // 设置一个新度量的空数组 var newMeasures = []; // 循环遍历选中的度量 for (var i = 0; i < measures.length; i++) { var show = component.config["show_" + i]; console.log(component.config) if (show != null && show === false) { // 结束本次循环(跳过下一步) continue } // push进新度量数组 newMeasures.push(measures[i]) } // console.log(newMeasures) // 新度量数组赋值给初始数组 measures = newMeasures; // 图例 var legendData = []; if (measures.length >= 2) { option.xAxis[0].data = xAxisLabels; option.series[0].data = candlestickValue; var colors = []; var yAxis = []; yAxis.push(option.yAxis[0]); option.yAxis = yAxis; option.series[0].itemStyle = {}; option.series[0].itemStyle.normal = {}; if (component.config["columnColor"] == null) { var colorConfig = getColorConfig(0); option.series[0].itemStyle.normal.color = colorConfig.main; option.series[0].itemStyle.normal.borderColor = colorConfig.main; colors.push(colorConfig.main); colors.push(colorConfig.main); } else { option.series[0].itemStyle.normal.color = component.config["columnColor"]; option.series[0].itemStyle.normal.borderColor = component.config["columnColor"]; colors.push(component.config["columnColor"]); colors.push(component.config["columnColor"]); } var series = []; series.push(option.series[0]); option.series = series; legendData.push("价格区间"); option.legend.data = legendData; // 如果有新增的度量,新增的为线图 if (measures.length > 2) { var newSeries = []; newSeries.push(option.series[0]) legendData = []; legendData.push("价格区间"); yAxis = []; yAxis.push(option.yAxis[0]); // 遍历度量数组 for (var i = 2; i < measures.length; i++) { var lineAxis = {}; lineAxis.type = "value"; lineAxis.name = measures[i].label; lineAxis.position = "right"; lineAxis.axisLabel = {}; lineAxis.axisLabel.formatter = "{value}"; lineAxis.offset = (yAxis.length - 1) * 50; yAxis.push(lineAxis); var lineSeries = {}; lineSeries.type = "line"; lineSeries.smooth = true; lineSeries.lineStyle = {}; lineSeries.lineStyle.normal = {}; lineSeries.lineStyle.normal.opacity = 0.5; lineSeries.name = measures[i].name; lineSeries.yAxisIndex = yAxis.length - 1; var values = []; // 遍历最后一个维度的所有指标 for (var d = 0; d < data.length; d++) { var value = data[d][measures[i].name]; if (component.config["digit_" + i] != null) { value = $vsUtils.processValue(value, component.config["digit_" + i]); } values.push(value); } lineSeries.data = values; lineSeries.itemStyle = {}; lineSeries.itemStyle.normal = {}; lineSeries.itemStyle.normal.lineStyle = {}; if (component.config["lineColor_" + i] == null) { // 获取到折线上的颜色 var colorConfig = getColorConfig(i); // 赋值给折线图对象属性 lineSeries.itemStyle.normal.color = colorConfig.main; lineSeries.itemStyle.normal.lineStyle.color = colorConfig.main; colors.push(colorConfig.main); } else { // 赋值给我们设置过的颜色 lineSeries.itemStyle.normal.color = component.config["lineColor_" + i]; lineSeries.itemStyle.normal.lineStyle.color = component.config["lineColor_" + i]; colors.push(component.config["lineColor_" + i]); } // 把对应索引的push进新数组里 newSeries.push(lineSeries); legendData.push(measures[i].label); } // 赋值echarts的数组数组 option.series = newSeries option.legend.data = legendData; option.yAxis = yAxis; // option.color = colors; } // 重新绘制图形并清除以前的 setTimeout(function () { // option = angular.copy(klineOptionTemplate); component.context.chart.setOption(option, true); }) } } ~~~ 六 接收数据联动 ~~~ case "linegrapht": var dataIndex = -1; var axisLabels = component.config.chartConfig.xAxis[0].data; if (component.context.originalXAxisLabels != null && component.context.originalXAxisLabels.length > dataIndex) { axisLabels = component.context.originalXAxisLabels } for (var i = 0; i < axisLabels.length; i++) { if ("" + axisLabels[i] === "" + event.source.value) { dataIndex = i; break } } if (dataIndex < 0) { component.context.chart.dispatchAction({ type: "hideTip" }); return } if (dataIndex > -1) { component.context.chart.dispatchAction({ type: "showTip", dataIndex: dataIndex, seriesIndex: 0 }) } break; ~~~ 七 在图例上添加 与 线图 面积图 混合图 柱状图 共用 ![](https://box.kancloud.cn/042520699140532a4ffea42fa6c6fa89_1087x688.png) 八 提示框 与以下组件共用 ![](https://box.kancloud.cn/c4bb4752deb6466d94b655b08d3d8de3_1135x794.png) 九 拖动组件 与线图 柱状图 面积图 混合图 共用 ![](https://box.kancloud.cn/ff8889233d31d4ece6b269c47727a9d4_1095x701.png) 十 监听拖动组件代码 共用 ![](https://box.kancloud.cn/594c701c7833ce8cdc56ba83c7c26ba5_1014x726.png) 十一 监听提示框 代码 共用 ![](https://box.kancloud.cn/f7bf150aa2358ad68fb14dac23d5c6f5_971x754.png) 十二 监听图形里的图例代码 共用 ![](https://box.kancloud.cn/480468a0c0df591c01573482de2d4f90_1110x686.png) 十三 和 线图 柱状图 面积图 共用 轴线 里面内容是不一样的 红线条里的为新添加的 ![](https://box.kancloud.cn/d88918b9fd0b4baad8fc63f82c2a5225_1121x796.png) 代码如下 ~~~ switch (component.type) { case "linegrapht": case "line": case "column": case "mixed": case "area": axisCategory.groups.push(yAxis0Group); component.description.categories.push(axisCategory); break; case "bar": component.description.categories.push(axisCategory); break } var yAxis1Group = { title: { text: vsLang.axis_y_right }, elements: [] }; var yAxis2Group = { title: { text: '右Y轴2' }, elements: [] }; var yAxis3Group = { title: { text: '柱体' }, elements: [] }; axisCategory.groups.push(yAxis1Group); axisCategory.groups.push(yAxis2Group); axisCategory.groups.push(yAxis3Group); ~~~ 十四 在第十三步下面继续添加 下面的代码 ![](https://box.kancloud.cn/3eeb4decdf70e1b35eac6d3b7dca262f_850x568.png) ~~~ case "linegrapht": component.config.xAxisTextColor = option.xAxis[0].axisLabel.textStyle.color; component.config.xAxisTextSize = option.xAxis[0].axisLabel.textStyle.fontSize; component.config.xAxisLineColor = option.xAxis[0].axisLine.lineStyle.color; component.config.xAxisLineWidth = option.xAxis[0].axisLine.lineStyle.width; component.config.xAxisSplitLineColor = option.xAxis[0].splitLine.lineStyle.color; component.config.xAxisSplitLineWidth = option.xAxis[0].splitLine.lineStyle.width; xAxisGroup.elements.push({ title: vsLang.axis_line_width, type: "configSlide", bind: "xAxisLineWidth", config: { slideEnd: 100 } }); xAxisGroup.elements.push({ title: vsLang.axis_line_color, type: "colorpicker", bind: "xAxisLineColor" }); xAxisGroup.elements.push({ title: vsLang.text_rotate, type: "configSlide", bind: "xAxisLabelRotate", config: { slideEnd: 360 } }); xAxisGroup.elements.push({ title: vsLang.text_interval, type: "configSlide", bind: "xAxisLabelInterval", config: { slideEnd: 100 } }) xAxisGroup.elements.push({ title: vsLang.font_color, type: "colorpicker", bind: "xAxisTextColor" }); xAxisGroup.elements.push({ title: vsLang.font_size, type: "configSlide", bind: "xAxisTextSize", config: { slideEnd: 100 } }); xAxisGroup.elements.push({ title: vsLang.divide_line_width, type: "configSlide", bind: "xAxisSplitLineWidth", config: { slideEnd: 100 } }); xAxisGroup.elements.push({ title: vsLang.divide_line_color, type: "colorpicker", bind: "xAxisSplitLineColor" }); xAxisGroup.elements.push({ title: vsLang.label_script, type: "script-editor", bind: "xAxisLabelScript", btnClass: "btn-default", onClick: function (ele) { $vsUtils.openScriptEditorWindow($uibModal, $timeout, scope, element, ele.bind, "javascript", function () { $timeout(function () { scope.$broadcast(event_refreshBindingData, {}) }) }) } }) if (option.yAxis[0].axisLabel == null) { option.yAxis[0].axisLabel = { textStyle: {}, lineStyle: {}, splitLine: {} } } component.config.yAxisTextColor = option.yAxis[0].axisLabel.textStyle.color; component.config.yAxisTextSize = option.yAxis[0].axisLabel.textStyle.fontSize; component.config.yAxisLineColor = option.yAxis[0].axisLine.lineStyle.color; component.config.yAxisLineWidth = option.yAxis[0].axisLine.lineStyle.width; component.config.yAxisSplitLineColor = option.yAxis[0].splitLine.lineStyle.color; component.config.yAxisSplitLineWidth = option.yAxis[0].splitLine.lineStyle.width; yAxisGroup.elements.push({ title: vsLang.axis_line_width, type: "configSlide", bind: "yAxisLineWidth", config: { slideEnd: 100 } }); yAxisGroup.elements.push({ title: vsLang.axis_line_color, type: "colorpicker", bind: "yAxisLineColor" }); yAxisGroup.elements.push({ title: vsLang.font_color, type: "colorpicker", bind: "yAxisTextColor" }); yAxisGroup.elements.push({ title: vsLang.font_size, type: "configSlide", bind: "yAxisTextSize", config: { slideEnd: 100 } }); yAxisGroup.elements.push({ title: vsLang.divide_line_width, type: "configSlide", bind: "yAxisSplitLineWidth", config: { slideEnd: 100 } }); yAxisGroup.elements.push({ title: vsLang.divide_line_color, type: "colorpicker", bind: "yAxisSplitLineColor" }); yAxisGroup.elements.push({ title: vsLang.divide_line_count, type: "configSlide", bind: "yAxisSplitNumber", config: { slideEnd: 100 } }); yAxis0Group.elements.push({ title: vsLang.axis_line_width, type: "configSlide", bind: "yAxis0LineWidth", config: { slideEnd: 100 } }); yAxis0Group.elements.push({ title: vsLang.axis_line_color, type: "colorpicker", bind: "yAxis0LineColor" }); yAxis0Group.elements.push({ title: vsLang.base_value, type: "switch", bind: "yAxis0Scale", on: vsLang.auto, off: "0" }); yAxis0Group.elements.push({ title: vsLang.min_value, type: "text-input-sl", bind: "yAxis0Min" }); yAxis0Group.elements.push({ title: vsLang.max_value, type: "text-input-sl", bind: "yAxis0Max" }); yAxis0Group.elements.push({ title: vsLang.value_range_script, type: "script-editor", bind: "yAxis0ValueRangeScript", btnClass: "btn-default", onClick: function (ele) { $vsUtils.openScriptEditorWindow($uibModal, $timeout, scope, element, ele.bind, "javascript", function () { $timeout(function () { scope.$broadcast(event_refreshBindingData, {}) }) }) } }) if (option.yAxis.length > 1) { yAxis1Group.elements.push({ title: vsLang.axis_line_width, type: "configSlide", bind: "yAxis1LineWidth", config: { slideEnd: 100 } }); yAxis1Group.elements.push({ title: vsLang.axis_line_color, type: "colorpicker", bind: "yAxis1LineColor" }); yAxis1Group.elements.push({ title: vsLang.base_value, type: "switch", bind: "yAxis1Scale", on: vsLang.auto, off: "0" }); yAxis1Group.elements.push({ title: vsLang.min_value, type: "text-input-sl", bind: "yAxis1Min" }); yAxis1Group.elements.push({ title: vsLang.max_value, type: "text-input-sl", bind: "yAxis1Max" }); } yAxis2Group.elements.push({ title: vsLang.axis_line_width, type: "configSlide", bind: "yAxis2LineWidth", config: { slideEnd: 100 } }); yAxis2Group.elements.push({ title: vsLang.axis_line_color, type: "colorpicker", bind: "yAxis2LineColor" }); yAxis2Group.elements.push({ title: vsLang.base_value, type: "switch", bind: "yAxis2Scale", on: vsLang.auto, off: "0" }); yAxis2Group.elements.push({ title: vsLang.min_value, type: "text-input-sl", bind: "yAxis2Min" }); yAxis2Group.elements.push({ title: vsLang.max_value, type: "text-input-sl", bind: "yAxis2Max" }); yAxis3Group.elements.push({ title: '柱体颜色', type: "colorpicker", bind: "xZhuColor" }); break; ~~~ 十五 监听轴线里的配置项 在柱线 折线 面积 图 轴线监听的位置 加 和他们不是共用的 ~~~ case "linegrapht": watches.push({ key: "component.config.xAxisTextColor", func: function (option, value) { if (isValidColorValue(value)) { option.xAxis[0].axisLabel.textStyle.color = value } } }); watches.push({ key: "component.config.xAxisTextSize", func: function (option, value) { option.xAxis[0].axisLabel.textStyle.fontSize = value } }); watches.push({ key: "component.config.xAxisLineColor", func: function (option, value) { if (isValidColorValue(value)) { option.xAxis[0].axisLine.lineStyle.color = value } } }); watches.push({ key: "component.config.xAxisLineWidth", func: function (option, value) { option.xAxis[0].axisLine.lineStyle.width = value } }); watches.push({ key: "component.config.xAxisSplitLineColor", func: function (option, value) { if (isValidColorValue(value)) { option.xAxis[0].splitLine.lineStyle.color = value } } }); watches.push({ key: "component.config.xAxisSplitLineWidth", func: function (option, value) { option.xAxis[0].splitLine.lineStyle.width = value } }); watches.push({ key: "component.config.xAxisLabelRotate", func: function (option, value) { option.xAxis[0].axisLabel.rotate = value } }); scope.$watch("component.config.xAxisLabelInterval", function (newValue, oldValue) { var option = component.config.chartConfig; if (VSUtils.isEmpty(newValue)) { delete option.xAxis[0].axisLabel.interval } else { option.xAxis[0].axisLabel.interval = newValue } scope.component.context.chart.setOption(option, true) }); watches.push({ key: "component.config.xAxisLabelMultiLineTypeObj", func: function (option, value) { component.config.xAxisLabelMultiLineType = value.value } }); watches.push({ key: "component.config.xAxisValueType", func: function (option, value) {} }); watches.push({ key: "component.config.yAxisTextColor", func: function (option, value) { if (isValidColorValue(value)) { for (var i = 0; i < option.yAxis.length; i++) { option.yAxis[i].axisLabel.textStyle.color = value } } } }); watches.push({ key: "component.config.yAxisTextSize", func: function (option, value) { for (var i = 0; i < option.yAxis.length; i++) { option.yAxis[i].axisLabel.textStyle.fontSize = value } } }); watches.push({ key: "component.config.yAxisLineColor", func: function (option, value) { if (isValidColorValue(value)) { for (var i = 0; i < option.yAxis.length; i++) { option.yAxis[i].axisLine.lineStyle.color = value } } } }); watches.push({ key: "component.config.yAxisLabelRotate", func: function (option, value) { option.yAxis[0].axisLabel.rotate = value } }); scope.$watch("component.config.yAxisLabelInterval", function (newValue, oldValue) { var option = component.config.chartConfig; if (VSUtils.isEmpty(newValue)) { delete option.yAxis[0].axisLabel.interval } else { option.yAxis[0].axisLabel.interval = newValue } scope.component.context.chart.setOption(option, true) }); watches.push({ key: "component.config.yAxisLineWidth", func: function (option, value) { for (var i = 0; i < option.yAxis.length; i++) { option.yAxis[i].axisLine.lineStyle.width = value } } }); watches.push({ key: "component.config.yAxisSplitLineColor", func: function (option, value) { if (isValidColorValue(value)) { for (var i = 0; i < option.yAxis.length; i++) { option.yAxis[i].splitLine.lineStyle.color = value } } } }); watches.push({ key: "component.config.yAxisSplitLineWidth", func: function (option, value) { for (var i = 0; i < option.yAxis.length; i++) { option.yAxis[i].splitLine.lineStyle.width = value } } }); watches.push({ key: "component.config.yAxisSplitNumber", func: function (option, value) { for (var i = 0; i < option.yAxis.length; i++) { option.yAxis[i].splitNumber = value } } }); watches.push({ key: "component.config.yAxisLabelScript", func: function (option, value) { scope.$broadcast(event_refreshChartView, {}) } }); // watches.push({ key: "component.config.xAxisLabelScript", func: function (option, value) { scope.$broadcast(event_refreshChartView, {}) } }); watches.push({ key: "component.config.yAxis0LineColor", func: function (option, value) { if (isValidColorValue(value)) { option.yAxis[0].axisLine.lineStyle.color = value } } }); watches.push({ key: "component.config.yAxis0LineWidth", func: function (option, value) { option.yAxis[0].axisLine.lineStyle.width = value } }); watches.push({ key: "component.config.yAxis0Scale", func: function (option, value) { if (value != null && value) { option.yAxis[0].scale = true } else { option.yAxis[0].scale = false } } }); watches.push({ key: "component.config.yAxis0Min", func: function (option, value) { if (value != null && value.length > 0) { option.yAxis[0].min = parseFloat(value) } else { delete option.yAxis[0].min } } }); watches.push({ key: "component.config.yAxis0Max", func: function (option, value) { if (value != null && value.length > 0) { option.yAxis[0].max = parseFloat(value) } else { delete option.yAxis[0].max } } }); watches.push({ key: "component.config.yAxis0Gap", func: function (option, value) { if (value != null && value.length > 0) { var tempValue = "" + value; if (tempValue.indexOf(",") > 0) { var vs = tempValue.split(","); option.yAxis[0].boundaryGap = [parseFloat(vs[0]), parseFloat(vs[1])] } else { option.yAxis[0].boundaryGap = [parseFloat(value), parseFloat(value)] } } else { delete option.yAxis[0].boundaryGap } } }); watches.push({ key: "component.config.yAxis0Unit", func: function (option, value) { if (value != null) { scope.$broadcast(event_refreshChartView, {}) } } }); watches.push({ key: "component.config.yAxis0ValueType", func: function (option, value) { if (value != null) { scope.$broadcast(event_refreshChartView, {}) } } }); watches.push({ key: "component.config.yAxis0Digit", func: function (option, value) { if (value != null) { scope.$broadcast(event_refreshChartView, {}) } } }); watches.push({ key: "component.config.yAxis1Scale", func: function (option, value) { if (value != null && value) { option.yAxis[1].scale = true } else { option.yAxis[1].scale = false } } }); watches.push({ key: "component.config.yAxis1Min", func: function (option, value) { if (option.yAxis.length > 1) { if (value != null && value.length > 0) { option.yAxis[1].min = value } else { delete option.yAxis[1].min } } } }); watches.push({ key: "component.config.yAxis1Max", func: function (option, value) { if (option.yAxis.length > 1) { if (value != null && value.length > 0) { option.yAxis[1].max = value } else { delete option.yAxis[1].max } } } }); watches.push({ key: "component.config.yAxis1LineColor", func: function (option, value) { if (isValidColorValue(value)) { option.yAxis[1].axisLine.lineStyle.color = value } } }); watches.push({ key: "component.config.yAxis1LineWidth", func: function (option, value) { option.yAxis[1].axisLine.lineStyle.width = value } }); watches.push({ key: "component.config.yAxis2Scale", func: function (option, value) { if (value != null && value) { option.yAxis[2].scale = true } else { option.yAxis[2].scale = false } } }); watches.push({ key: "component.config.yAxis2Min", func: function (option, value) { if (option.yAxis.length > 1) { if (value != null && value.length > 0) { option.yAxis[2].min = value } else { delete option.yAxis[2].min } } } }); watches.push({ key: "component.config.yAxis2Max", func: function (option, value) { if (option.yAxis.length > 1) { if (value != null && value.length > 0) { option.yAxis[2].max = value } else { delete option.yAxis[2].max } } } }); watches.push({ key: "component.config.yAxis2LineColor", func: function (option, value) { if (isValidColorValue(value)) { option.yAxis[2].axisLine.lineStyle.color = value } } }); watches.push({ key: "component.config.yAxis2LineWidth", func: function (option, value) { option.yAxis[2].axisLine.lineStyle.width = value } }); watches.push({ key: "component.config.xZhuColor", func: function (option, value) { option.series[0].itemStyle.normal.color = value; option.series[0].itemStyle.normal.borderColor = value } }); break ~~~ 合并代码的时候 给你js文件 做参考吧 有些添加代码的位置 没办法写