💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
路径 D:\ireport365\ireport365.war\js\enduser\designer\vs-component-echarts.js 搜索 internalRefreshChinaDownMapModelData 1 修改数据处理函数 直接替换 ``` var internalRefreshChinaDownMapModelData = function () { var option = component.config.chartConfig; var dimensions = component.config.datasourceConfig.dimensions; var measures = component.config.datasourceConfig.measures; var data = component.context.data; var chartData = []; var chartDataMap = {}; var measureIdx = 0; if (component.config.receiveMeasureLink != null && component.config.receiveMeasureLink === true) { var newMeasures = scope.getSelectedLinkMeasure(component, component.config.datasourceConfig.measures); for (var i = 0; i < measures.length; i++) { if (newMeasures[i] != null) { measureIdx = i; break } } } // for (var i = 0; i < data.length; i++) { // for(var j = 0; j< data[i].length;j++){ // var value = data[i][j][measures[measureIdx].name]; // var name = factory._internalFindKvValue(component, data[i][j][dimensions[i].name]); // chartData.push({ // name: name, // value: value // }); // } // } for (var i = 0; i < data.length; i++) { for(var j = 0; j< data[i].length;j++){ var value = data[i][j][measures[measureIdx].name]; var name = factory._internalFindKvValue(component, data[i][j][dimensions[i].name]); chartData.push({ name: name, value: value }); } var dataMap = chartDataMap[data[i][dimensions[dimensions.length - 1].name]]; if (dataMap == null) { dataMap = {}; chartDataMap[name] = dataMap } for (var m = 0; m < measures.length; m++) { dataMap[measures[m].name] = data[i][measures[m].name] } } option.series[0].data = chartData; option.series[0].name = measures[measureIdx].label; if (component.config["measureAlias_" + measureIdx] != null && component.config["measureAlias_" + measureIdx].length > 0) { option.series[0].name = component.config["measureAlias_" + measureIdx] } option.series[0].seriesIndex = measureIdx; var thresholdConfig = component.config.thresholdConfig[measures[measureIdx].name]; var splitList = []; if (thresholdConfig != null && thresholdConfig.length > 0) { var valueType = component.config["thresholdValueType_" + measures[measureIdx].name]; if (valueType == null) { valueType = "value" } var maxValue = parseFloat(component.config["maxValue_" + measures[measureIdx].name]); var minValue = parseFloat(component.config["minValue_" + measures[measureIdx].name]); if (isNaN(maxValue) || isNaN(minValue)) { var calculatedMaxValue = -9999999999; var calculatedMinValue = 9999999999; for (var i = 0; i < data.length; i++) { var value = data[i][measures[measureIdx].name]; calculatedMaxValue = Math.max(calculatedMaxValue, parseFloat(value)); calculatedMinValue = Math.min(calculatedMinValue, parseFloat(value)) } if (isNaN(maxValue)) { maxValue = calculatedMaxValue } if (isNaN(minValue)) { minValue = calculatedMinValue } } var minToMaxValue = maxValue - minValue; for (var i = 0; i < thresholdConfig.length; i++) { var fromValue = parseFloat(component.config[thresholdConfig[i].fromBind]); var toValue = parseFloat(component.config[thresholdConfig[i].toBind]); if (isNaN(fromValue) && isNaN(toValue)) { continue } if (valueType === "percent") { fromValue = fromValue * minToMaxValue; toValue = toValue * minToMaxValue } var color = component.config[thresholdConfig[i].colorBind]; var item = { color: color }; if (!isNaN(fromValue)) { item.start = fromValue } if (!isNaN(toValue)) { item.end = toValue } if (component.config.dataRangeUnit) { if (item.start == null) { item.label = "< " + item.end } else { if (item.end == null) { item.label = "> " + item.start } else { item.label = item.start + " - " + item.end } } item.label = item.label + component.config.dataRangeUnit } splitList.push(item) } } if (splitList.length === 0) { splitList = [{ start: 0, color: "#A8DAF6" }] } option.dataRange.splitList = splitList; option.data = chartDataMap; component.context.chart.setOption(option, true) }; ``` 2修改弹窗数据方法 ``` case "DrillDownChinaMap": if (component.config.showItemLabel == null) { component.config.showItemLabel = true } option.tooltip.confine = true; option.tooltip.formatter = function(params) { // console.log(params) var res = params.name; // console.log(res) // console.log(component.context.data) var dataMap = component.context.data[0][params.dataIndex]; // console.log(params.dataIndex) var measures = component.config.datasourceConfig.measures; for (var i = 0; i < measures.length; i++) { res += "<br/>"; var unit = component.config["unit_" + i]; if (unit == null) { unit = "" } var value = dataMap[measures[i].name]; console.log(value) if (component.config["valueType_" + i] != null && component.config["valueType_" + i] === "percent") { value = value * 100; unit = "%" } value = $vsUtils.processValue(value, component.config["digit_" + i]); value = $vsUtils.comdifyValue(value); var measureLabel = measures[i].label; if (component.config["measureAlias_" + i] != null && component.config["measureAlias_" + i].length > 0) { measureLabel = component.config["measureAlias_" + i] } res += measureLabel + " : " + value + unit } return res }; break; ``` 分享页 路径D:\ireport365\ireport365.war\WEB-INF\classes\report-resource\design.js 同上 搜索 internalRefreshChinaDownMapModelData 1 修改数据处理函数 直接替换 ``` var internalRefreshChinaDownMapModelData = function () { var option = component.config.chartConfig; var dimensions = component.config.datasourceConfig.dimensions; var measures = component.config.datasourceConfig.measures; var data = component.context.data; var chartData = []; var chartDataMap = {}; var measureIdx = 0; if (component.config.receiveMeasureLink != null && component.config.receiveMeasureLink === true) { var newMeasures = scope.getSelectedLinkMeasure(component, component.config.datasourceConfig.measures); for (var i = 0; i < measures.length; i++) { if (newMeasures[i] != null) { measureIdx = i; break } } } // for (var i = 0; i < data.length; i++) { // for(var j = 0; j< data[i].length;j++){ // var value = data[i][j][measures[measureIdx].name]; // var name = factory._internalFindKvValue(component, data[i][j][dimensions[i].name]); // chartData.push({ // name: name, // value: value // }); // } // } for (var i = 0; i < data.length; i++) { for(var j = 0; j< data[i].length;j++){ var value = data[i][j][measures[measureIdx].name]; var name = factory._internalFindKvValue(component, data[i][j][dimensions[i].name]); chartData.push({ name: name, value: value }); } var dataMap = chartDataMap[data[i][dimensions[dimensions.length - 1].name]]; if (dataMap == null) { dataMap = {}; chartDataMap[name] = dataMap } for (var m = 0; m < measures.length; m++) { dataMap[measures[m].name] = data[i][measures[m].name] } } option.series[0].data = chartData; option.series[0].name = measures[measureIdx].label; if (component.config["measureAlias_" + measureIdx] != null && component.config["measureAlias_" + measureIdx].length > 0) { option.series[0].name = component.config["measureAlias_" + measureIdx] } option.series[0].seriesIndex = measureIdx; var thresholdConfig = component.config.thresholdConfig[measures[measureIdx].name]; var splitList = []; if (thresholdConfig != null && thresholdConfig.length > 0) { var valueType = component.config["thresholdValueType_" + measures[measureIdx].name]; if (valueType == null) { valueType = "value" } var maxValue = parseFloat(component.config["maxValue_" + measures[measureIdx].name]); var minValue = parseFloat(component.config["minValue_" + measures[measureIdx].name]); if (isNaN(maxValue) || isNaN(minValue)) { var calculatedMaxValue = -9999999999; var calculatedMinValue = 9999999999; for (var i = 0; i < data.length; i++) { var value = data[i][measures[measureIdx].name]; calculatedMaxValue = Math.max(calculatedMaxValue, parseFloat(value)); calculatedMinValue = Math.min(calculatedMinValue, parseFloat(value)) } if (isNaN(maxValue)) { maxValue = calculatedMaxValue } if (isNaN(minValue)) { minValue = calculatedMinValue } } var minToMaxValue = maxValue - minValue; for (var i = 0; i < thresholdConfig.length; i++) { var fromValue = parseFloat(component.config[thresholdConfig[i].fromBind]); var toValue = parseFloat(component.config[thresholdConfig[i].toBind]); if (isNaN(fromValue) && isNaN(toValue)) { continue } if (valueType === "percent") { fromValue = fromValue * minToMaxValue; toValue = toValue * minToMaxValue } var color = component.config[thresholdConfig[i].colorBind]; var item = { color: color }; if (!isNaN(fromValue)) { item.start = fromValue } if (!isNaN(toValue)) { item.end = toValue } if (component.config.dataRangeUnit) { if (item.start == null) { item.label = "< " + item.end } else { if (item.end == null) { item.label = "> " + item.start } else { item.label = item.start + " - " + item.end } } item.label = item.label + component.config.dataRangeUnit } splitList.push(item) } } if (splitList.length === 0) { splitList = [{ start: 0, color: "#A8DAF6" }] } option.dataRange.splitList = splitList; option.data = chartDataMap; component.context.chart.setOption(option, true) }; ``` 2修改弹窗数据方法 ``` case "DrillDownChinaMap": if (component.config.showItemLabel == null) { component.config.showItemLabel = true } option.tooltip.confine = true; option.tooltip.formatter = function(params) { // console.log(params) var res = params.name; // console.log(res) // console.log(component.context.data) var dataMap = component.context.data[0][params.dataIndex]; // console.log(params.dataIndex) var measures = component.config.datasourceConfig.measures; for (var i = 0; i < measures.length; i++) { res += "<br/>"; var unit = component.config["unit_" + i]; if (unit == null) { unit = "" } var value = dataMap[measures[i].name]; console.log(value) if (component.config["valueType_" + i] != null && component.config["valueType_" + i] === "percent") { value = value * 100; unit = "%" } value = $vsUtils.processValue(value, component.config["digit_" + i]); value = $vsUtils.comdifyValue(value); var measureLabel = measures[i].label; if (component.config["measureAlias_" + i] != null && component.config["measureAlias_" + i].length > 0) { measureLabel = component.config["measureAlias_" + i] } res += measureLabel + " : " + value + unit } return res }; break; ``` 完 2018-11-09