for item in data: item.update({'z': item['population']}) item.update({ 'color': interpolateRGB([0, 10, 255], [255, 10, 0], item['population'] / max_p) }) H.add_map_data(geojson, name='Basemap', borderColor='#606060', nullColor='rgba(200, 200, 200, 0.2)', showInLegend=False) H.add_data_set(geojson_handler(geojson, 'mapline'), 'mapline', 'Separators', showInLegend=False, enableMouseTracking=False) H.add_data_set(data, 'mapbubble', 'Cities', dataLabels={ 'enabled': True, 'format': '{point.capital}' }, maxSize='12%', is_coordinate=True) H.set_dict_options(options) fobj = open(
"mappoint" will return GeoJSON points and multipoints. default: "map" """ mapdata = geojson_handler(geojson) lines = geojson_handler(geojson, 'mapline') """ Change the name property in map data. This is doing the same thing as the second JS function added in the example us-counties.py """ for x in mapdata: x.update({ 'name': x['name'] + ', ' + x['properties']['hc-key'].split('-')[1].upper() }) H.add_data_set(data, 'map', 'Unemployment rate', joinBy=['hc-key', 'code'], tooltip={'valueSuffix': '%'}, borderWidth=0.5, states={'hover': { 'color': '#bada55' }}) H.add_data_set([lines[0]], 'mapline', 'State borders', color='white') H.add_data_set([lines[3]], 'mapline', 'Separator', color='gray') H.add_map_data(mapdata) H.htmlcontent
'align': 'left', 'x': 5, 'verticalAlign': 'middle' } }] fake_data = [] options = { 'title': { 'text': 'Highmaps basic lat/lon demo' }, 'mapNavigation': { 'enabled': True }, 'tooltip': { 'headerFormat': '', 'pointFormat': '<b>{point.name}</b><br>Lat: {point.lat}, Lon: {point.lon}' }, } H.add_map_data(geojson, name = 'Basemap' ,borderColor = '#A0A0A0', nullColor = 'rgba(200, 200, 200, 0.3)', showInLegend = False) H.add_data_set(data,'mappoint','Cities',color = 'Highcharts.getOptions().colors[1]', is_coordinate = True) H.add_data_set(geojson_handler(geojson, 'mapline'), 'mapline','Separators',color = '#707070', showInLegend = False, enableMouseTracking = False) H.set_dict_options(options) H.htmlcontent
"code": "DE.BW", "value": 157 }, { "code": "DE.HE", "value": 134 }, { "code": "DE.NI", "value": 136 }, { "code": "DE.TH", "value": 704 } ] H.set_dict_options(options) # set options H.add_data_set(data, 'map', 'Random data', joinBy=['code_hasc', 'code'], # set dataset states={ 'hover': { 'color': '#BADA55' } }, dataLabels={ 'enabled': True, 'format': '{point.properties.postal}' }) H.set_map_source('http://www.highcharts.com/samples/data/jsonp.php?filename=germany.geo.json&callback=?', True) # set map data from the src (jsonp) H.htmlcontent
global specialCityLabels if x['name'] in specialCityLabels.keys(): x.update({'dataLabels': specialCityLabels[x['name']]}) map(states_label, states) map(cities_label, cities) H.add_data_set( states, 'map', 'States and territories', color='Highcharts.getOptions().colors[2]', states={'hover': { 'color': 'Highcharts.getOptions().colors[4]' }}, dataLabels={ 'enabled': True, 'format': '{point.name}', 'style': { 'width': '80px' } }, tooltip={'pointFormat': '{point.name}'}) H.add_data_set(rivers, 'mapline', 'Rivers', color='Highcharts.getOptions().colors[0]', tooltip={'pointFormat': '{point.properties.NAME}'}) H.add_data_set(cities, 'mappoint', 'Cities',
'mapData': "Highcharts.maps['custom/europe']", 'tooltip': { 'headerFormat': '', 'pointFormat': '{point.name}: <b>{series.name}</b>' } } } } data1 = [{'code': x} for x in ['IE', 'IS', 'GB', 'PT']] data2 = [{'code': x} for x in ['NO', 'SE', 'DK', 'DE', 'NL', 'BE', 'LU', 'ES', 'FR', 'PL', 'CZ', 'AT', 'CH', 'LI', 'SK', 'HU',\ 'SI', 'IT', 'SM', 'HR', 'BA', 'YF', 'ME', 'AL', 'MK']] data3 = [ { 'code': x } for x in ['FI', 'EE', 'LV', 'LT', 'BY', 'UA', 'MD', 'RO', 'BG', 'GR', 'TR', 'CY'] ] data4 = [{'code': x} for x in ['RU']] H.set_dict_options(options) H.add_data_set(data1, 'map', 'UTC') H.add_data_set(data2, 'map', 'UTC + 1') H.add_data_set(data3, 'map', 'UTC + 2') H.add_data_set(data4, 'map', 'UTC + 3') H.set_map_source( 'http://code.highcharts.com/mapdata/custom/europe.js', jsonp_map=False) # set map data from src. data is in .js format H.htmlcontent
'mapline': { 'showInLegend': False, 'enableMouseTracking': False } }, } H.set_dict_options(options) data_url = 'http://www.highcharts.com/samples/data/jsonp.php?filename=us-counties-unemployment.json&callback=?' H.add_data_from_jsonp(data_url, 'json_data', 'map', 'Unemployment rate', joinBy = ['hc-key', 'code'], tooltip = { 'valueSuffix': '%' }, borderWidth = 0.5, states = { 'hover': { 'color': '#bada55' } } ) H.add_data_set(RawJavaScriptText('[lines[0]]'), 'mapline', 'State borders', color = 'white') H.add_data_set(RawJavaScriptText('[lines[1]]'), 'mapline', 'Separator', color = 'gray') H.set_map_source('http://code.highcharts.com/mapdata/countries/us/us-all-all.js', jsonp_map = False) H.add_JSscript("var lines = Highcharts.geojson(Highcharts.maps['countries/us/us-all-all'], 'mapline');", 'head') H.add_JSscript("Highcharts.each(geojson, function (mapPoint) {\ mapPoint.name = mapPoint.name + ', ' + mapPoint.properties['hc-key'].substr(3, 2);\ });", 'head') H.htmlcontent
'dashStyle': 'dot', 'snap': False, 'color': 'gray' }, { 'zIndex': 5, 'dashStyle': 'dot', 'snap': False, 'color': 'gray' }] }, } max_p = max([item['population'] for item in data]) for item in data: item.update({'z':item['population']}) item.update({'color':interpolateRGB([255,0,10],[0,255,20],item['population']/max_p)}) H.add_map_data(geojson, name='Basemap' ,borderColor='#606060', nullColor='rgba(200, 200, 200, 0.2)', showInLegend=False) H.add_data_set(geojson_handler(geojson, 'mapline'), 'mapline','Separators', showInLegend=False, enableMouseTracking=False) H.add_data_set(data,'mapbubble','Cities', dataLabels={ 'enabled': True, 'format': '{point.capital}' }, maxSize='12%', is_coordinate=True) H.set_dict_options(options) H.htmlcontent
} } } }, 'drilldown': { 'activeDataLabelStyle': { 'color': '#FFFFFF', 'textDecoration': 'none', 'textShadow': '0 0 3px #000000' }, 'drillUpButton': { 'relativeTo': 'spacingBox', 'position': { 'x': 0, 'y': 60 } } } } H.add_data_set(data, 'map', 'USA', dataLabels={ 'enabled': True, 'format': '{point.properties.postal-code}' }) H.set_dict_options(options) H.htmlcontent
'states': { 'hover': { 'color': '#EEDD66' } } } }, 'drilldown': { 'activeDataLabelStyle': { 'color': '#FFFFFF', 'textDecoration': 'none', 'textShadow': '0 0 3px #000000' }, 'drillUpButton': { 'relativeTo': 'spacingBox', 'position': { 'x': 0, 'y': 60 } } } } H.add_data_set(data,'map','USA',dataLabels = { 'enabled': True, 'format': '{point.properties.postal-code}' }) H.set_dict_options(options) H.htmlcontent
"value": 157 }, { "code": "DE.HE", "value": 134 }, { "code": "DE.NI", "value": 136 }, { "code": "DE.TH", "value": 704 } ] H.set_dict_options(options) # set options H.add_data_set( data, 'map', 'Random data', joinBy=['code_hasc', 'code'], # set dataset states={'hover': { 'color': '#BADA55' }}, dataLabels={ 'enabled': True, 'format': '{point.properties.postal}' }) H.set_map_source( 'http://www.highcharts.com/samples/data/jsonp.php?filename=germany.geo.json&callback=?', True) # set map data from the src (jsonp) H.htmlcontent
'style': { 'fontWeight': 'bold' } }, 'mapData': "Highcharts.maps['custom/europe']", 'tooltip': { 'headerFormat': '', 'pointFormat': '{point.name}: <b>{series.name}</b>' } } } } data1 = [{'code': x} for x in ['IE','IS', 'GB', 'PT']] data2 = [{'code': x} for x in ['NO', 'SE', 'DK', 'DE', 'NL', 'BE', 'LU', 'ES', 'FR', 'PL', 'CZ', 'AT', 'CH', 'LI', 'SK', 'HU',\ 'SI', 'IT', 'SM', 'HR', 'BA', 'YF', 'ME', 'AL', 'MK']] data3 = [{'code': x} for x in ['FI', 'EE', 'LV', 'LT', 'BY', 'UA', 'MD', 'RO', 'BG', 'GR', 'TR', 'CY']] data4 = [{'code': x} for x in ['RU']] H.set_dict_options(options) H.add_data_set(data1, 'map', 'UTC') H.add_data_set(data2, 'map', 'UTC + 1') H.add_data_set(data3, 'map', 'UTC + 2') H.add_data_set(data4, 'map', 'UTC + 3') H.set_map_source('http://code.highcharts.com/mapdata/custom/europe.js', jsonp_map=False) # set map data from src. data is in .js format H.htmlcontent
def cities_label(x): global specialCityLabels if x['name'] in specialCityLabels.keys(): x.update({'dataLabels': specialCityLabels[x['name']]}); map(states_label, states) map(cities_label, cities) H.add_data_set(states, 'map', 'States and territories', color = 'Highcharts.getOptions().colors[2]', states = { 'hover': { 'color': 'Highcharts.getOptions().colors[4]' } }, dataLabels = { 'enabled': True, 'format': '{point.name}', 'style': { 'width': '80px' } }, tooltip = { 'pointFormat': '{point.name}' }) H.add_data_set(rivers, 'mapline', 'Rivers', color = 'Highcharts.getOptions().colors[0]', tooltip = { 'pointFormat': '{point.properties.NAME}' }) H.add_data_set(cities, 'mappoint', 'Cities', color = 'black', marker = { 'radius': 2 },
""" mapdata = geojson_handler(geojson) lines = geojson_handler(geojson, 'mapline') """ Change the name property in map data. This is doing the same thing as the second JS function added in the example us-counties.py """ for x in mapdata: x.update({'name':x['name']+', '+x['properties']['hc-key'].split('-')[1].upper()}) H.add_data_set(data, 'map', 'Unemployment rate', joinBy = ['hc-key', 'code'], tooltip = { 'valueSuffix': '%' }, borderWidth = 0.5, states = { 'hover': { 'color': '#bada55' } } ) H.add_data_set([lines[0]], 'mapline', 'State borders', color = 'white') H.add_data_set([lines[3]], 'mapline', 'Separator', color = 'gray') H.add_map_data(mapdata) H.htmlcontent