One
Website: http://echarts.baidu.com/download.html
Click: Full
Download file: Echarts.min.js
Website: http://echarts.baidu.com/download-map.html
Click: Map of China-JS
Download file: China.js
Second, code example
<!DOCTYPE HTML><HTML> <Head> <MetaCharSet= "UTF-8"> <Metahttp-equiv= "X-ua-compatible"content= "Ie=edge"> <title>Echarts</title> <Linkrel= "stylesheet"type= "Text/css"href= "Css/main.css"/> <Scriptsrc= "Js/jquery-1.9.1.min.js"></Script> <Scriptsrc= "Js/echarts.min.js"></Script> <Scriptsrc= "Js/china.js"></Script> <style>#china-map{width:1000px;Height:1000px;margin:Auto;}</style> </Head> <Body> <DivID= "China-map"></Div> <Script> varMyChart=Echarts.init (document.getElementById ('China-map')); varoption={tooltip: {//Show:false//Do not display the prompt labelFormatter:'{b}', //hint label formatBackgroundColor:"#ff7f50",//hint label background colorTextstyle:{color:"#fff"} //hint Label font color}, Series: [{type:'Map', Maptype:' China', Label: {normal: {show:true,//Show Province labelTextstyle:{color:"#c71585"}//Province label Font Color}, emphasis: {//the corresponding mouse hover effectShow:true, Textstyle:{color:"#800080"}}} , ItemStyle: {normal: { BorderWidth:.5,//Area Border Widthbordercolor:'#009fe8',//area Border ColorAreacolor:"#ffefd5",//Area Color}, emphasis: {borderWidth:.5, BorderColor:'#4b0082', Areacolor:"#ffdead",}}, data:[{name:'Fujian', selected:true}//Fujian to selected state ] }], }; mychart.setoption (option); Mychart.on ('mouseover', function(params) {varDataindex=Params.dataindex; Console.log (params); }); </Script> </Body></HTML>
Three
Four, modify the province label location:
Open the China.js file and modify the "properties": {"CP": [x-coordinate, y-coordinate],...}
1. The use of echarts (China map article)