from highcharts import Highmap from highcharts.highmaps.highmap_helper import jsonp_loader, js_map_loader, geojson_handler, interpolateRGB H = Highmap(height=550) map_url = 'http://code.highcharts.com/mapdata/countries/cl/cl-all.js' data_url = 'http://www.highcharts.com/samples/data/jsonp.php?filename=us-capitals.json&callback=?' geojson = js_map_loader(map_url) data = [ { u'lon': -86.300629, u'abbrev': u'AL', u'capital': u'Montgomery', u'lat': 32.38012, 'z': 205764, u'parentState': u'Alabama', u'population': 205764 }, { u'lon': -92.274494, u'abbrev': u'AR', u'capital': u'Little Rock', u'lat': 34.748655, 'z': 193524, u'parentState': u'Arkansas', u'population': 193524 }, ] # geographical data geo = { 'sym': {
The drilldown data can be added using add_drilldown_data_set method: add_drilldown_data_set(data, series_type, id, **kwargs) 1. data is the dataset for drilldown level 2. series_type is the type of plot presented at the drilldown level 3. id is the identifier used for the drilldown parent point to identify its series. This needs to be consistent with the drilldown property in dataset of parent level 4. kwargs are for parameters in series or plotOptions (for detail please ref to highcharts API: http://api.highcharts.com/highcharts#) However, the tradeoff is that user needs to query and handle the whole dataset in python environment and put the whole dataset into the .html file, which could make final file very big. """ map_url = 'http://code.highcharts.com/mapdata/countries/us/us-all.js' geojson = js_map_loader(map_url) data = geojson_handler(geojson) for i, item in enumerate(data): item.update({'drilldown':item['properties']['hc-key']}) item.update({'value': i}) # add bogus data options = { 'chart' : { 'events': { # Here event option is only used to change the tittle when different level data is shown 'drilldown': "function(e){\ this.setTitle({ text: e.point.name }, null)\ }", 'drillup': "function () {\ this.setTitle({ text: 'USA' }, null);\ }",
# -*- coding: utf-8 -*- """ Highmaps Demos Map point with lat/long: http://www.highcharts.com/maps/demo/mappoint-latlon """ from highcharts import Highmap from highcharts.highmaps.highmap_helper import jsonp_loader, js_map_loader, geojson_handler H = Highmap(height=750) map_url = 'http://code.highcharts.com/mapdata/countries/gb/gb-all.js' geojson = js_map_loader(map_url) data = [{ 'name': 'London', 'lat': 51.507222, 'lon': -0.1275 }, { 'name': 'Birmingham', 'lat': 52.483056, 'lon': -1.893611 }, { 'name': 'Leeds', 'lat': 53.799722, 'lon': -1.549167 }, { 'name': 'Glasgow', 'lat': 55.858, 'lon': -4.259 }, { 'name': 'Sheffield', 'lat': 53.383611,
The drilldown data can be added using add_drilldown_data_set method: add_drilldown_data_set(data, series_type, id, **kwargs) 1. data is the dataset for drilldown level 2. series_type is the type of plot presented at the drilldown level 3. id is the identifier used for the drilldown parent point to identify its series. This needs to be consistent with the drilldown property in dataset of parent level 4. kwargs are for parameters in series or plotOptions (for detail please ref to highcharts API: http://api.highcharts.com/highcharts#) However, the tradeoff is that user needs to query and handle the whole dataset in python environment and put the whole dataset into the .html file, which could make final file very big. """ map_url = 'http://code.highcharts.com/mapdata/countries/us/us-all.js' geojson = js_map_loader(map_url) data = geojson_handler(geojson) for i, item in enumerate(data): item.update({'drilldown': item['properties']['hc-key']}) item.update({'value': i}) # add bogus data options = { 'chart' : { 'events': { # Here event option is only used to change the tittle when different level data is shown 'drilldown': "function(e){\ this.setTitle({ text: e.point.name }, null)\ }" , 'drillup': "function () {\ this.setTitle({ text: 'USA' }, null);\ }" ,