Echarts Map usage Experience-map warp and add data

Source: Internet
Author: User

About the use of ECHART2,ECHART3 maps a little bit of life experience:
1.echart3,echart2 load Map deformation repair.
Recently, when using ECHART2, it was found that loading a map of Hainan would produce deformation. For example, the map of Hainan has a large deformation, so we need to study how to eliminate the deformation. After a toss-up, modify the _gettransform function in the Echart-all.js

varxScale = width /mapWidth;varyScale = height / mapHeight;console.log(rate);if(xScale > yScale) {     //xScale = yScale * rate;      xScale = yScale;      width = mapWidth * xScale;}else{      yScale = xScale;     //xScale = yScale * rate;     height = mapHeight * yScale;}

So the map can not be deformed (echart3 add this aspectscale:1 can make the map does not deform)

Add Custom Geosjon in 2.echart2 (mainly Echart2,echart3 Geojson is more convenient)
Also modify the Echart-all.js code to add the following code, you can use Maptype as ' Hainan ' map

‘hainan‘: {getGeoJson: (function() {       return function(callback) {$.getJSON(‘data/hn.geojson‘,callback);}      })()},

Echarts Map usage Experience-map warp and add data

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.