123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Highmaps Example</title>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
- <style type="text/css">
- #container {
- height: 500px;
- width: 800px;
- margin: 0 auto;
- }
- .highcharts-tooltip>span {
- padding: 10px;
- white-space: normal !important;
- width: 200px;
- }
- .loading {
- margin-top: 10em;
- text-align: center;
- color: gray;
- }
- .f32 .flag {
- vertical-align: middle !important;
- }
- </style>
- <script type="text/javascript">
- $(function () {
- $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=world-population-density.json&callback=?', function (data) {
- // Add lower case codes to the data set for inclusion in the tooltip.pointFormat
- $.each(data, function () {
- this.flag = this.code.replace('UK', 'GB').toLowerCase();
- });
- // Initiate the chart
- $('#container').highcharts('Map', {
- title: {
- text: 'Fixed tooltip with HTML'
- },
- legend: {
- title: {
- text: 'Population density per km²',
- style: {
- color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
- }
- }
- },
- mapNavigation: {
- enabled: true,
- buttonOptions: {
- verticalAlign: 'bottom'
- }
- },
- tooltip: {
- backgroundColor: 'none',
- borderWidth: 0,
- shadow: false,
- useHTML: true,
- padding: 0,
- pointFormat: '<span class="f32"><span class="flag {point.flag}"></span></span>'
- + ' {point.name}: <b>{point.value}</b>/km²',
- positioner: function () {
- return { x: 0, y: 250 };
- }
- },
- colorAxis: {
- min: 1,
- max: 1000,
- type: 'logarithmic'
- },
- series : [{
- data : data,
- mapData: Highcharts.maps['custom/world'],
- joinBy: ['iso-a2', 'code'],
- name: 'Population density',
- states: {
- hover: {
- color: '#BADA55'
- }
- }
- }]
- });
- });
- });
- </script>
- </head>
- <body>
- <script src="../../js/highmaps.js"></script>
- <script src="../../js/modules/data.js"></script>
- <script src="../../js/modules/exporting.js"></script>
- <script src="http://code.highcharts.com/mapdata/custom/world.js"></script>
- <!-- Flag sprites service provided by Martijn Lafeber, https://github.com/lafeber/world-flags-sprite/blob/master/LICENSE -->
- <link rel="stylesheet" type="text/css" href="http://cloud.github.com/downloads/lafeber/world-flags-sprite/flags32.css" />
- <div id="container"></div>
- </body>
- </html>
|