score:9
Accepted answer
mapZoom
is a method that belongs to the chart
object so, in order to call it as en event (load
), you have to call it using this
keyword.
You can edit your code like this (JSFiddle):
...
events: {
load: function () {
this.mapZoom(0.5, 100, 100);
}
}
}
...
Alternatively, you can call it whenever you want using a jQuery reference (JSFiddle):
$('#container').highcharts().mapZoom(0.5, 100, 100);
score:1
If you want to zoom several countries, than you can try this
events: {
load: function () {
var mapChart = this;
['DE', 'HU', 'RO'].map(function(code){
return mapChart.get(code);
}).reduce(function(acc, current){
// Set map bounds
acc._minX = isNaN(acc._minX) ? current._minX : Math.min(acc._minX, current._minX);
acc._maxX = isNaN(acc._maxX) ? current._maxX : Math.max(acc._maxX, current._maxX);
acc._minY = isNaN(acc._minY) ? current._minY : Math.min(acc._minY, current._minY);
acc._maxY = isNaN(acc._maxY) ? current._maxY : Math.max(acc._maxY, current._maxY);
return acc;
}).zoomTo();
}}
score:5
Zoom to a specific country on your map is easy
series : [{
...
data: [{code: 'HU', id: 'HU', value: 7.5, name: 'Hungary'}],
...
}
...and then...
var mapChart=$('#MapContainer').highcharts(); //get map chart object from DOM
mapChart.get('HU').zoomTo(); //zoom to the country using "id" from data serie
mapChart.mapZoom(5); //elevate viewpoint a little to see surrounding countries as well
Source: stackoverflow.com
Related Query
- How to zoom to specific point in Highmaps
- How to highlight specific Point with Highcharts Js
- how to add dynamic y axis in highchart from specific point of x-axis
- How do I get Highmaps zoom level and is there a Highmaps zoom event?
- How to show specific point to show specific information in HighCharts
- How to render a specific data point marker on HightCharts Bell Curve?
- How to set point height on Y axis for specific series
- How to find a point with longitude and latitude in a Highmaps maps serie, initiated with GeoJson?
- Highstocks - How to change the default Zoom
- How to get index of a point in Highcharts?
- How do I detect a zoom event in highcharts?
- How to get Highcharts X-Axis Categories starting at the left most point
- Drilldown in highmaps - how to remove a series
- How do I dynamically change a data point in Highcharts using JavaScript
- How do I get the value of a highcharts graph point on mouseover?
- highcharts how to catch and insert logic in click reset zoom button event
- Highcharts - How to remove connecting line between fixed tooltip and point
- How to position RangeSelector / zoom buttons at custom co-ordinates in Highstock
- how to make specific labels outside gauge chart
- how to get chart object inside a point event function in Highcharts
- How do I set highcharts line graph point colors to an array of colors?
- How to change style of selected point in highcharts?
- Highmaps: how to disable map zoom by mouse scroll
- Highcharts. Make tooltip of a specific point always visible
- *Highcharts* How to get the min and max value of the zoom box
- How to enable y-axis panning while zoom in highcharts?
- How can I configure the legend with a specific height in highstock?
- How to show always the pop-up at the point in a cloud graph?
- Highcharts How to get decimal point values on y-axis with big numbers
- How to show only specific x-axis values on datetime axis in Highcharts
More Query from same tag
- Highcharts bubble chart datalabels color contrast issue
- Declaring location of highchart bars on a chart?
- Show ranges as legend for highcharts angular gauge
- Showing/Hiding child nodes and links in Highcharts Networkgraph
- highchart x axis not showing correct date labels
- customEvents.js and H.removeEvents conflict
- Highcharts multiple series from json
- Highcharts Combo Graph Overlapping eachother
- HighCharts: Resize markers of scatter chart dynamically
- Parse an array in js
- Displaying ticks on top of gauge chart
- How to get Highchart Gauge to work in Sencha Touch 2
- how to customize heatmap highcharts plot area and the color of the datalabels
- Fixed x-axis in Highcharts Stock (stop auto-scaling)
- HighMaps with drilledDown
- JQuery animation doesn't work in IE8
- highcharts no point markers but show single point or discontinous points
- Highcharts Angular - How to set chart width and height with percentages?
- hchart() Bar Graph does not display all the x axis labels in R
- Highchart datetime x-axis : display end of month date instead of first day of month
- HighCharts Generated Table
- Php 2D array into javascript array in highcharts
- Highcharts not plotting datetime series
- Highchart, bar chart with multiple series
- Heatmap Highchart using string value
- High-Charts selection event triggering wrong output on css transformed element
- Angular2 and Highcharts map - map bubbles not showing up
- How do I add json data to custom flags in Highstock?
- Access and chart through perl arrays
- Highcharts redirect is not working after print