多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
一 同下钻地图一样用的地区数据包 路径:D:\ireport365\ireport365.war\js\enduser\designer\vs-component-echarts.js 添加地区地图 ~~~ { name: "", type: "echartsRegionMap", coverImage: contextPath + "/images/componenttypes/" + locale + "/widget/zh_baiduMap.png?v=3", coverImageWidth: "50%", tip: "地区地图" } ~~~ option 对象模板 ~~~ // 地区地图 //初始化地图 echartsRegionMapoptionTemplate = { animationDuration: 500, // backgroundColor: "#154e90", title: { show: false, }, tooltip: { show: true, trigger: 'item', formatter: "{a} <br/>{b} : {c}" }, legend: { show: false, orient: "vertical", x: "left", data: [], selectedMode: "single", textStyle: { color: "#ccc" } }, dataRange: { y: "top", min: 0, max: 100, itemWidth: 12, itemHeight: 10, calculable: true, color: ["#ff3333", "orange", "yellow", "lime", "aqua"], textStyle: { color: "#000" } }, series: [{ name: '', type: 'map', mapType: '', selectedMode: 'single', itemStyle: { normal: { label: { show: true, textStyle: { fontSize: "10", color: "#999" } }, borderColor: 'rgba(147, 235, 248, 1)', borderWidth: 1, areaColor: { type: 'radial', x: 0.5, y: 0.5, r: 0.8, colorStops: [{ offset: 0, color: 'rgba(147, 235, 248, 0)' // 0% 处的颜色 }, { offset: 1, color: 'rgba(147, 235, 248, .2)' // 100% 处的颜色 }], globalCoord: false // 缺省为 false }, shadowColor: 'rgba(128, 217, 248, 1)', // shadowColor: 'rgba(255, 255, 255, 1)', shadowOffsetX: -2, shadowOffsetY: 2, shadowBlur: 10 }, emphasis: { areaColor: '#389BB7', borderWidth: 0 } }, data: [] }] }; ~~~ 在地图 factory 对象里添加 ![](https://box.kancloud.cn/438eda4dd0a77732bc3b1adb7ac9f998_674x563.png) angular.coye 方法里添加option模板 ~~~ // 地区地图 case "echartsRegionMap": // 初始化地图 option = angular.copy(echartsRegionMapoptionTemplate); option.dataRange = { y: "top", itemWidth: 12, itemHeight: 10, splitList: [{ start: 800, color: "#006EDD" }, { start: 500, end: 800, color: "#3892E5" }, { start: 300, end: 500, color: "#70B6EE" }, { start: 100, end: 300, color: "#A8DAF6" }, { end: 100, color: "#E0FFFF" }] }; option.series[0].data = ""; break; ~~~ 添加判断属性调用处理数据的函数 ~~~ case "echartsRegionMap": internalRefreshChinaRegionMapModelData(); break; ~~~ 添加数据处理函数 ~~~ // 地区地图 var internalRefreshChinaRegionMapModelData = 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++) { var value = data[i][measures[measureIdx].name]; var name = factory._internalFindKvValue(component, data[i][dimensions[dimensions.length - 1].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] } } console.log(chartData) // 值域处理 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" }] } // 值域end option.dataRange.splitList = splitList; option.series[0].data = chartData; component.context.chart.setOption(option, true) } ~~~ 添加接收其他组件数据方法 ~~~ case "echartsRegionMap": var dataIndex = -1; // console.log(component.config.chartConfig) var option = component.config.chartConfig; console.log(option) for (var i = 0; i < component.config.chartConfig.series[0].data.length; i++) { if ("" + component.config.chartConfig.series[0].data[i].name === "" + event.source.value) { console.log(component.config.chartConfig.series[0].data[i].name) dataIndex = i; break } } console.log(dataIndex) if (dataIndex < 0) { component.context.chart.dispatchAction({ type: "hideTip" }); return } if (dataIndex > -1) { console.log(event.source.value) component.context.chart.dispatchAction({ type: "showTip", name: event.source.value, seriesIndex: 0 }) } break; ~~~ 添加在下钻地图下面 数据处理和推动联动数据函数 ~~~ // 地区地图 case "echartsRegionMap": // 数据处理 var option = component.config.chartConfig; var optionNode = component.config; if(optionNode.curlMap){ loadMap(optionNode.curlMap.mapCode, optionNode.curlMap.mapName); }else{ loadMap('100000', 'china'); } // var mapdata = option.series[0].data; // option.series[0].data = mapdata; function loadMap(mapCode, mapName) { $.ajaxSettings.async = false; $.getJSON(contextPath + '/cdn/1.0/assets-map-json/main-city/' + mapCode + '.json', function(data1) { if (data1) { // console.log(data1) echarts.registerMap(mapName, data1); // console.log(data1) option.series[0].mapType = mapName // console.log(mapName) scope.component.context.chart.setOption(option, true) curlMap = { mapCode: mapCode, mapName: mapName }; // console.log(curlMap) } else { alert('无法加载该地图'); } }); } // 推送数据 component.context.chart.on("mouseover", function (param) { if (component.config.datasourceConfig.measures == null || component.config.datasourceConfig.dimensions == null) { return } var data = component.context.data; var dataIndex = param.dataIndex; var to = param.data.name; if (to == null || param.value == null || param.value === "-") { return } component.context.tooltipName = to; scope.notifyDimensionValueChange(null, scope.getLastDimension(), to) }); break; ~~~ 同在下钻地图下面 加同的代码 度量的里的文字 和百分比代码 ~~~ case "echartsRegionMap": groupDesc.elements.push({ title: vsLang.value_type, type: "radio-icon", bind: "valueType" + identifier, items: [{ name: vsLang.value_original, icon: "fa fa-font", value: "value" }, { name: vsLang.value_percent, icon: "fa fa-percent", value: "percent" }] }); break; ~~~ 在关系图下面添加图形里的配置项 ~~~ // echarts 地区地图 case "echartsRegionMap": chartCategory.groups.push({ title: { text: "配置地区" }, elements: [{ title: "省份", type: "select-s", bind: "provinceObj", items: [{ name: "北京", value: "110000" }, { name: "天津", value: "120000" }, { name: "上海", value: "310000" }, { name: "重庆", value: "500000" },{ name: "河北", value: "130000" }, { name: "山西", value: "140000" }, { name: "内蒙古", value: "150000" }, { name: "辽宁", value: "210000" }, { name: "吉林", value: "220000" }, { name: "黑龙江", value: "230000" }, { name: "江苏", value: "320000" }, { name: "浙江", value: "330000" }, { name: "安徽", value: "340000" }, { name: "福建", value: "350000" }, { name: "江西", value: "360000" }, { name: "山东", value: "370000" }, { name: "河南", value: "410000" }, { name: "湖北", value: "420000" }, { name: "湖南", value: "430000" }, { name: "广东", value: "440000" }, { name: "广西", value: "450000" }, { name: "海南", value: "460000" }, { name: "四川", value: "510000" }, { name: "贵州", value: "520000" }, { name: "云南", value: "530000" }, { name: "西藏", value: "540000" }, { name: "陕西", value: "610000" }, { name: "青海", value: "630000" }, { name: "宁夏", value: "640000" }, { name: "新疆", value: "650000" }, { name: "香港", value: "810000" }, { name: "澳门", value: "820000" }, { name: "台湾", value: "710000" }] },{ title: "市级", type: "select-s", bind: "cityObj", items: [] }] }) chartCategory.groups.push({ name: "text", title: { text: vsLang.area_name }, elements: [{ title: vsLang.text, type: "switch", bind: "showItemLabel", on: vsLang.show, off: vsLang.hidden }, { title: vsLang.size, type: "configSlide", bind: "itemLabelSize", config: { slideEnd: 100 } }, { title: vsLang.color, type: "colorpicker", bind: "itemLabelColor" }] }); chartCategory.groups.push({ name: "text", title: { text: vsLang.area_blocks }, elements: [{ title: "阴影颜色", type: "colorpicker", bind: "areaColor" }, { title: vsLang.border_color, type: "colorpicker", bind: "areaBorderColor" }] }); chartCategory.groups.push({ name: "text", title: { text: vsLang.data_range_tool }, elements: [{ title: vsLang.display, type: "switch", bind: "showDataRange", on: vsLang.on, off: vsLang.off }, { title: vsLang.unit, type: "text-input-sl", bind: "dataRangeUnit" }, { title: vsLang.orientation, type: "radio-icon", bind: "dataRangeOrient", items: [{ name: vsLang.vertical, value: "vertical", icon: "fa fa-ellipsis-v" }, { name: vsLang.horizontal, value: "horizontal", icon: "fa fa-ellipsis-h" }] }, { title: vsLang.vertical_position_short, type: "radio-icon", bind: "dataRangePosY", items: [{ name: vsLang.position_top, value: "top", icon: "fa fa-minus", pStyle: "padding-top:0;padding-bottom:12px;" }, { name: vsLang.position_middle, value: "center", icon: "fa fa-minus", pStyle: "padding-top:6px;padding-bottom:6px;" }, { name: vsLang.position_bottom, value: "bottom", icon: "fa fa-minus", pStyle: "padding-top:12px;padding-bottom:0px;" }] }, { title: vsLang.horizontal_position_short, type: "radio-icon", bind: "dataRangePosX", items: [{ name: vsLang.position_left, value: "left", icon: "fa fa-align-left" }, { name: vsLang.position_center, value: "center", icon: "fa fa-align-center" }, { name: vsLang.position_right, value: "right", icon: "fa fa-align-right" }] }, { title: vsLang.vertical_offset_short, type: "configSlide", bind: "dataRangeOffsetY", config: { slideEnd: 1000 } }, { title: vsLang.horizontal_offset_short, type: "configSlide", bind: "dataRangeOffsetX", config: { slideEnd: 1000 } }, { title: vsLang.font_color, type: "colorpicker", bind: "dataRangeFontColor" }, { title: vsLang.font_size, type: "configSlide", bind: "dataRangeFontSize", config: { slideEnd: 100 } }, { title: vsLang.width, type: "configSlide", bind: "dataRangeWidth", config: { slideEnd: 100 } }, { title: vsLang.height, type: "configSlide", bind: "dataRangeHeight", config: { slideEnd: 100 } }] }); break ~~~ 在关系图下面添加 监听配置项 ~~~ // 地区地图 case "echartsRegionMap": // 选择省份 scope.$watch("component.config.provinceObj", function (newValue, oldValue) { if (newValue != null && newValue !== oldValue) { var option = component.config.chartConfig; var optionNode = component.config; scope.component.description.categories[6].groups[0].elements[1].items = []; // console.log(optionNode) // console.log(newValue) loadMap(newValue.value,newValue.name); function loadMap(mapCode, mapName) { $.ajaxSettings.async = false; $.getJSON(contextPath + '/cdn/1.0/assets-map-json/main-city/' + mapCode + '.json', function(data1) { if (data1) { console.log(data1) for(var i = 0;i<data1.features.length;i++){ // console.log(data1.features[i]) var name = data1.features[i].properties.name; var id = data1.features[i].id; scope.component.description.categories[6].groups[0].elements[1].items.push({ name: name, value: id }) } echarts.registerMap(mapName, data1); // console.log(data1) option.series[0].mapType = mapName // console.log(mapName) scope.component.context.chart.setOption(option, true) curlMap = { mapCode: mapCode, mapName: mapName }; // console.log(curlMap); optionNode.curlMap = curlMap; // console.log(optionNode); } else { alert('无法加载该地图'); } }); } // console.log(scope.component.description.categories[6].groups[0].elements[1].items) } }); // 选择市区 scope.$watch("component.config.cityObj", function (newValue, oldValue) { if (newValue != null && newValue !== oldValue) { var option = component.config.chartConfig; var optionNode = component.config; // console.log(optionNode) // console.log(newValue) loadMap(newValue.value,newValue.name); function loadMap(mapCode, mapName) { $.ajaxSettings.async = false; $.getJSON(contextPath + '/cdn/1.0/assets-map-json/main-city/' + mapCode + '.json', function(data1) { if (data1) { echarts.registerMap(mapName, data1); // console.log(data1) option.series[0].mapType = mapName // console.log(mapName) scope.component.context.chart.setOption(option, true) curlMap = { mapCode: mapCode, mapName: mapName }; // console.log(curlMap); optionNode.curlMap = curlMap; // console.log(optionNode); } else { alert('无法加载该地图'); } }); } // console.log(scope.component.description.categories[6].groups[0].elements[1].items) } }); scope.$watch("component.config.showItemLabel", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; option.series[0].itemStyle.normal.label.show = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.itemLabelSize", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; option.series[0].itemStyle.normal.label.textStyle.fontSize = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.itemLabelColor", function(newValue, oldValue) { if (isValidColorValue(newValue)) { var option = component.config.chartConfig; option.series[0].itemStyle.normal.label.textStyle.color = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.areaBorderColor", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; option.series[0].itemStyle.normal.borderColor = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.areaColor", function(newValue, oldValue) { if (isValidColorValue(newValue)) { var option = component.config.chartConfig; // console.log(newValue) option.series[0].itemStyle.normal.shadowColor = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.showDataRange", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; option.dataRange.show = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.dataRangeUnit", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { scope.$broadcast(event_refreshChartView, {}) } }); scope.$watch("component.config.dataRangeOrient", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; option.dataRange.orient = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.dataRangePosY", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; option.dataRange.y = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.dataRangeOffsetX", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; option.dataRange.x = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.dataRangeOffsetY", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; option.dataRange.y = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.dataRangePosX", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; option.dataRange.x = newValue; scope.component.context.chart.setOption(option, true) } }); // 值域文字颜色 scope.$watch("component.config.dataRangeFontColor", function(newValue, oldValue) { if (isValidColorValue(newValue)) { var option = component.config.chartConfig; if (option.dataRange.textStyle == null) { option.dataRange.textStyle = {} } option.dataRange.textStyle.color = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.dataRangeFontSize", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; if (option.dataRange.textStyle == null) { option.dataRange.textStyle = {} } option.dataRange.textStyle.fontSize = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.dataRangeWidth", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; option.dataRange.itemWidth = newValue; scope.component.context.chart.setOption(option, true) } }); scope.$watch("component.config.dataRangeHeight", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; option.dataRange.itemHeight = newValue; scope.component.context.chart.setOption(option, true) } }) break; ~~~ 分享页 路劲: 一 添加 数据处理函数调用函数 ~~~ case "echartsRegionMap": internalRefreshChinaRegionMapModelData(); break; ~~~ 二 添加 数据函数 ~~~ // 地区地图 数据处理函数 var internalRefreshChinaRegionMapModelData = 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++) { var value = data[i][measures[measureIdx].name]; var name = factory._internalFindKvValue(component, data[i][dimensions[dimensions.length - 1].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] } } // console.log(chartData) // 值域处理 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" }] } // 值域end option.dataRange.splitList = splitList; option.series[0].data = chartData; component.context.chart.setOption(option, true) } ~~~ 接收 数据函数 ~~~ case "echartsRegionMap": var dataIndex = -1; // console.log(component.config.chartConfig) var option = component.config.chartConfig; // console.log(option) for (var i = 0; i < component.config.chartConfig.series[0].data.length; i++) { if ("" + component.config.chartConfig.series[0].data[i].name === "" + event.source.value) { // console.log(component.config.chartConfig.series[0].data[i].name) dataIndex = i; break } } // console.log(dataIndex) if (dataIndex < 0) { component.context.chart.dispatchAction({ type: "hideTip" }); return } if (dataIndex > -1) { // console.log(event.source.value) component.context.chart.dispatchAction({ type: "showTip", name: event.source.value, seriesIndex: 0 }) } break; ~~~ 添加获取 json数据和推送联动数据 ~~~ case "echartsRegionMap": // 数据处理 var option = component.config.chartConfig; var optionNode = component.config; if(optionNode.curlMap){ loadMap(optionNode.curlMap.mapCode, optionNode.curlMap.mapName); }else{ loadMap('100000', 'china'); } // var mapdata = option.series[0].data; // option.series[0].data = mapdata; function loadMap(mapCode, mapName) { $.ajaxSettings.async = false; $.getJSON(contextPath + '/cdn/1.0/assets-map-json/main-city/' + mapCode + '.json', function(data1) { if (data1) { // console.log(data1) echarts.registerMap(mapName, data1); // console.log(data1) option.series[0].mapType = mapName // console.log(mapName) scope.component.context.chart.setOption(option, true) curlMap = { mapCode: mapCode, mapName: mapName }; // console.log(curlMap) } else { alert('无法加载该地图'); } }); } // 推送数据 component.context.chart.on("mouseover", function (param) { if (component.config.datasourceConfig.measures == null || component.config.datasourceConfig.dimensions == null) { return } var data = component.context.data; var dataIndex = param.dataIndex; var to = param.data.name; if (to == null || param.value == null || param.value === "-") { return } component.context.tooltipName = to; scope.notifyDimensionValueChange(null, scope.getLastDimension(), to) }); break; ~~~ 在下钻地图 上方写 度量设置单位 小数点 别名 等等 ~~~ case "echartsRegionMap": if (component.config.showItemLabel == null) { component.config.showItemLabel = true } option.tooltip.confine = true; option.tooltip.formatter = function(params) { var res = params.name; var dataMap = component.context.data[params.dataIndex]; if (dataMap != null) { 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]; 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 } else { return null } }; break; ~~~ ps 合并的时候在js文件上看 位置吧 !!!!!