echarts icon indicating copy to clipboard operation
echarts copied to clipboard

If map chart used visualMap element, the series data itemStyle areaColor won't work.

Open katherinebai opened this issue 7 years ago • 1 comments

In fact, when I remove the visualMap element, the series data itemStyle will work well. But I think the itemStyle in series data item has higher priority. image

The options as following:

myChart.showLoading();

$.get('data/asset/geo/HK.json', function (geoJson) {

myChart.hideLoading();

echarts.registerMap('HK', geoJson);

myChart.setOption(option = {
"animation": true,
"backgroundColor": "#EEECE1",
"tooltip": {
	"trigger": "item"
},
"series": [{
	"name": "系列1",
	"type": "map",
	"data": [{
		"name": "Central and Western",
		"value": 1,
		"label": {
			"show": false
		}
	}, {
		"name": "Eastern",
		"value": 2,
		"label": {
			"show": false
		}
	}, {
		"name": "Islands",
		"value": 3,
		"label": {
			"show": false
		}
	}, {
		"name": "Kowloon City",
		"value": 4,
		"label": {
			"show": false
		}
	}, {
		"name": "Kwai Tsing",
		"value": 5,
		"label": {
			"show": false
		}
	}, {
		"name": "Kwun Tong",
		"value": 6,
		"label": {
			"show": false
		}
	}, {
		"name": "North",
		"value": 7,
		"itemStyle": {
			"areaColor": "#F79646"
		},
		"label": {
			"show": false
		}
	}, {
		"name": "Sai Kung",
		"value": 8,
		"label": {
			"show": false
		}
	}, {
		"name": "Sha Tin",
		"value": 9,
		"label": {
			"show": false
		}
	}, {
		"name": "Sham Shui Po",
		"value": 10,
		"label": {
			"show": false
		}
	}, {
		"name": "Southern",
		"value": 11,
		"label": {
			"show": false
		}
	}, {
		"name": "Tai Po",
		"value": 12,
		"label": {
			"show": false
		}
	}, {
		"name": "Tsuen Wan",
		"value": 13,
		"label": {
			"show": false
		}
	}, {
		"name": "Tuen Mun",
		"value": 14,
		"label": {
			"show": false
		}
	}, {
		"name": "Wan Chai",
		"value": 15,
		"label": {
			"show": false
		}
	}, {
		"name": "Wong Tai Sin",
		"value": 16,
		"label": {
			"show": false
		}
	}, {
		"name": "Yau Tsim Mong",
		"value": 17,
		"label": {
			"show": false
		}
	}, {
		"name": "Yuen Long",
		"value": 18,
		"label": {
			"show": false
		}
	}],
	"mapType": "HK"
}],
"visualMap": {
	"type": "piecewise",
	"calculable": true,
	"orient": "horizontal",
	"left": "right",
	"top": "top",
	"max": 25,
	"min": 0,
	"pieces": [{
		"lt": 0
	}, {
		"gte": 0,
		"lt": 10
	}, {
		"value": 10
	}, {
		"gte": 10,
		"lt": 20
	}, {
		"gte": 20,
		"lte": 25
	}],
	"color": ["#bed2e6", "#96b6d8", "#6d99c9", "#457cb9", "#355f8c"]
},

}); });

katherinebai avatar Jan 23 '19 04:01 katherinebai

If fact, the visualMap has a higher priority than itemStyle. If intending to use itemStyle for some item, set visualMap: false on that item. But I am sorry that there is but about that on version 4.2.0-rc.x. The bug has been fixed on 4.2.1-rc.1.

100pah avatar Jan 27 '19 18:01 100pah