Giter VIP home page Giter VIP logo

highcharts-chinese-map-zh's Introduction

highcharts-chinese-map-zh

将 highcharts **地图的地名翻译成中文(注: 为使用方便将 bower_components 一起提交)

效果

Alt text

例子

  1. 请查看 sample.html 文件
  2. highcharts-chinese-map-zh 翻译例子

使用方法

#####引入 javascript 文件

<!-- 库文件(!!! 请替换为您自己的文件路径) -->
<script src="./bower_components/jquery/dist/jquery.min.js"></script>
<script src="./bower_components/highcharts/highmaps.js"></script>

<!-- 地图数据文件和翻译文件(!!! 请替换为您自己的文件路径) -->
<script src="./javascript/china-map.js"></script>
<script src="./javascript/china-map-translate.js"></script

#####绘制地图

var mapTranslate = Highcharts.maps["translate/china"]; // 引入翻译文件

buildMapCharts("**地图", $("#china_map")); // #china_map 是 html 文件中的 div 标签的 ID


function buildMapCharts(title, element) {

    element.highcharts('Map', {
        title: {
            text: title
        },

        credits: {
            enabled: true
        },

        mapNavigation: {
            enabled: true
        },

        legend: {
            enabled: false
        },

        series: [{
            mapData: Highcharts.maps["countries/cn/custom/cn-all-sar-taiwan"],
            name: title,
            nullColor: 'rgba(200, 200, 200, 0.3)',
            dataLabels: {
               enabled: true,
               color: '#eee',
               formatter: function () {
                   return mapTranslate[this.key]; // 返回中文名称
               },
               style: {
                   fontWeight: 'bold'
               }
           }
        }]
    });
}

highcharts-chinese-map-zh's People

Contributors

zhangtasdq avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.