'plotOptions': {
            '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
Пример #2
0
        'min': 1,
        'type': 'logarithmic',
        'minColor': '#EEEEFF',
        'maxColor': '#000022',
        'stops': [[0, '#EFEFFF'], [0.67, '#4444FF'], [1, '#000022']]
    },
}

H.set_dict_options(options)
data_url = 'http://www.highcharts.com/samples/data/jsonp.php?filename=us-population-density.json&callback=?'  # set data_src
H.add_data_from_jsonp(
    data_url,
    'json_data',
    'map',
    'Population density',
    joinBy=['postal-code', 'code'],  # add dataset from data_src using jsonp
    dataLabels={
        'enabled': True,
        'color': 'white',
        'format': '{point.code}'
    },
    tooltip={'pointFormat': '{point.code}: {point.value}/km²'})

H.set_map_source('http://code.highcharts.com/mapdata/countries/us/us-all.js',
                 jsonp_map=False)
"""
python-highcharts provides add_JSscript method:
add_JSscript(js_script, js_loc):
js_script is the javascript string 
js_loc is location of this javascript string, can be either head (at beginning of the script) or
end (in the end of the script)
            'maxColor': '#000022',
            'stops': [
                [0, '#EFEFFF'],
                [0.67, '#4444FF'],
                [1, '#000022']
            ]
        },
    } 

H.set_dict_options(options)
data_url = 'http://www.highcharts.com/samples/data/jsonp.php?filename=us-population-density.json&callback=?' # set data_src
H.add_data_from_jsonp(data_url, 'json_data', 'map', 'Population density', joinBy = ['postal-code', 'code'], # add dataset from data_src using jsonp
     dataLabels = {
                    'enabled': True,
                    'color': 'white',
                    'format': '{point.code}'
                },
                tooltip = {
                    'pointFormat': '{point.code}: {point.value}/km²'
                }
                )

H.set_map_source('http://code.highcharts.com/mapdata/countries/us/us-all.js', jsonp_map = False)

"""
python-highcharts provides add_JSscript method:
add_JSscript(js_script, js_loc):
js_script is the javascript string 
js_loc is location of this javascript string, can be either head (at beginning of the script) or
end (in the end of the script)

The JS string here is a function to convert (state) codes in dateset to Upper case (from lower)