DorisOu opened a new issue #9430: visualMap: false不起作用。seriesIndex 能否定义为数组? URL: https://github.com/apache/incubator-echarts/issues/9430 type:custom这个不需要映射,但是不知道如何设置。visualMap: false不起作用,我代码的位置不对么? //自定义区域图的data数据处理 function regionData(paths) { var data = []; for (var i = 0; i < paths.length; i++) { data.push({ value: paths[i].value, name: paths[i].name }); } return data; } //配置 option = { baseOption: { timeline: { data: ['一天', '一周'], axisType: 'category', orient: 'vertical', autoPlay: false, playInterval: 9000, left: 50, top: '15%', bottom: '35%', width: '50', height: '50%', label: { normal: { textStyle: { color: '#ddd' } }, emphasis: { textStyle: { color: '#fff' } } }, symbol: 'emptyCircle', //未选中播放点的样式 lineStyle: { color: '#555' }, checkpointStyle: { // symbol: 'circle', //选中播放点的样式 color: 'yellow', borderColor: '#777', borderWidth: 1 }, controlStyle: { showNextBtn: false, showPrevBtn: false, normal: { color: '#666', borderColor: '#666' }, emphasis: { color: '#aaa', borderColor: '#aaa' } }, itemStyle: { borderColor: '#fff' } }, bmap: { center: [113.39942, 22.522314], zoom: 12, roam: true, mapStyle: mapStyle }, title: { text: '中山市人口迁移', left: 'center', top: 30, textStyle: { color: '#fff', fontSize: 24 } }, toolTip: { trigger: 'item', formatter: function(params) { console.log(params); //这里不打印params参数 } }, visualMap: { type: 'piecewise', zlevel: 2, splitNumber: 5, min: 0, max: 9000, calculable: true, // seriesIndex: 1, //哪个系列的 // dimension: 0, //series.data的哪个维度 inRange: { color: ['lightskyblue', 'yellow', 'red'] }, textStyle: { color: '#fff' }, bottom: 50, left: 50 }, legend: { textStyle: { fontSize: 18 }, selectedMode: 'single', inactiveColor: '#ccc', //图例关闭时的颜色 data: [{ name: '东区街道', textStyle: { color: '#00bcff' } }, { name: '石岐区街道', textStyle: { color: '#ff4e00' } }, { name: '小榄镇', textStyle: { color: '#ffd700' } } ], left: 50, top: 30, itemGap: 30, itemWidth: 20, }, series: [{ // 系列一的一些其他配置 name: '东区街道', type: 'effectScatter', coordinateSystem: 'bmap', symbolSize: 3, zlevel: 2, rippleEffect: { brushType: 'stroke' }, showEffectOn: 'render', label: { emphasis: { show: true, position: 'right', color: '#fff', formatter: '{b}' } }, itemStyle: { normal: { color: '#00bcff' } } }, { // 系列二的一些其他配置 name: '东区街道', type: 'lines', coordinateSystem: 'bmap', zlevel: 2, large: true, //启用大规模线图优化(>=5K),不能自定义设置单个数据项的样式,不能启用effect effect: { //移动点的效果 show: true, constantSpeed: 30, symbol: 'pin', symbolSize: 5, trailLength: 0, }, lineStyle: { normal: { width: 1, opacity: 0.9, curveness: 0.2 //线的曲度,0~1,越大越弯曲 } } }, { // 系列一的一些其他配置 name: '石岐区街道', type: 'effectScatter', coordinateSystem: 'bmap', symbolSize: 3, zlevel: 2, rippleEffect: { brushType: 'stroke' }, showEffectOn: 'render', label: { emphasis: { show: true, position: 'right', color: '#fff', formatter: '{b}' } }, itemStyle: { normal: { color: '#ff4e00' } } }, { // 系列二的一些其他配置 name: '石岐区街道', type: 'lines', coordinateSystem: 'bmap', zlevel: 2, large: true, //启用大规模线图优化(>=5K),不能自定义设置单个数据项的样式,不能启用effect effect: { //移动点的效果 show: true, constantSpeed: 30, symbol: 'pin', symbolSize: 5, trailLength: 0, }, lineStyle: { normal: { width: 1, opacity: 0.9, curveness: 0.2 //线的曲度,0~1,越大越弯曲 } } }, { // 系列一的一些其他配置 name: '小榄镇', type: 'effectScatter', coordinateSystem: 'bmap', symbolSize: 3, zlevel: 2, rippleEffect: { brushType: 'stroke' }, showEffectOn: 'render', label: { emphasis: { show: true, position: 'right', color: '#fff', formatter: '{b}' } }, itemStyle: { normal: { color: '#ffd700' } } }, { // 系列二的一些其他配置 name: '小榄镇', type: 'lines', coordinateSystem: 'bmap', zlevel: 2, large: true, //启用大规模线图优化(>=5K),不能自定义设置单个数据项的样式,不能启用effect effect: { //移动点的效果 show: true, constantSpeed: 30, symbol: 'pin', symbolSize: 5, trailLength: 0, }, lineStyle: { normal: { width: 1, opacity: 0.9, curveness: 0.2 //线的曲度,0~1,越大越弯曲 } } }, { name: 'map', type: 'custom', coordinateSystem: 'bmap', data: regionData(paths), // data: [{visualMap: false}], renderItem: renderItem, zlevel: 1, tooltip: { show: false, }, itemStyle: { normal: { label: { show: true, formatter: function(params) { if (params.name) { return params.name; } }, color: '#848484' } }, emphasis: { label: { show: false } } }, visualMap: false } ] }, options: [{ //这是一天对应的 option series: [ { data: data[0].citys }, { data: data[0].moveLines }, { data: data[0].citys }, { data: data[0].moveLines2 }, { data: data[0].citys }, { data: data[0].moveLines3 } ] }, { //这是一周对应的 option series: [ { data: data[0].citys }, { data: data[0].moveLinesWeek1 }, { data: data[0].citys }, { data: data[0].moveLinesWeek3 }, { data: data[0].citys }, { data: data[0].moveLinesWeek2 } ] } ] } //当type为custom function renderItem(params, api) { var points = []; var dataIndex = params.dataIndex; for (var i = 0; i < paths[dataIndex].coords.length; i++) { points.push(api.coord(paths[dataIndex].coords[i])); } var color = '#08162a'; return { type: 'polygon', shape: { points: echarts.graphic.clipPointsByRect(points, { x: params.coordSys.x, y: params.coordSys.y, width: params.coordSys.width, height: params.coordSys.height }) }, style: api.style({ fill: color, stroke: '#3b3b3b' }) }; } type:custom不需要映射,但是visualMap:false不起作用
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
