1. The use of echarts (China map article)

Source: Internet
Author: User
Tags border color

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>


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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.