score:7
Accepted answer
If you want to have multiple charts with different data, but the same setup, try something like this:
var charts = [];
var cities = []; //replace with your array of cities, assuming that they aren't part of the changing data
$(document).ready(function() {
var getChartConfig = function(renderId, title, data) {
var config = {};
config.chart = {
renderTo: renderId,
defaultSeriesType: 'column',
margin: [50, 50, 100, 80]
};
config.title = title;
config.xAxis = {
categories: cities,
labels: {
rotation: -45,
align: 'right',
style: {
font: 'normal 13px Verdana, sans-serif'
}
}
};
config.yAxis = {
min: 0,
title: {
text: 'Population (millions)'
}
};
config.legend = { enabled: false };
config.tooltip = tooltip: {
formatter: function() {
return '<b>'+ this.x +'</b><br/>' +
'Population in 2008: '+ Highcharts.numberFormat(this.y, 1) +
' millions';
}
};
config.series = data;
return config;
};
//now, creating a new chart is easy!
charts.push(new Highcharts.Chart(
getChartConfig("container", "title", data)
))
});
Source: stackoverflow.com
Related Query
- Create six chart with the same rendering,different data (highchart )
- Several Series with the same xAxis data in HighChart
- HighChart Sparkline Chart with dynamic data for the table
- Highchart not displaying the pie chart with Ajax data
- how do you create muliple charts with the same options but with different data
- Highchart Line chart – data series with multiple axis - 2nd series placed in the middle of X axis
- Create Histogram with bellcurbe with in the same chart Highcharts
- How to create a new Highstock chart with new Highchart and not jquery?
- Highchart Area Range chart with gradient that follows the line
- Create Density Heatmap Chart using Jquery with array of data
- Showing multiple data with same x and y in highchart
- Use MySQL data as the chart data for the cakephp highchart plugin
- Adding data to a highchart chart using an array with IDs
- Highcharts: make y-axis extremes the same for two data series with different units
- Highcharts show the same yAxis start and end value with multiple data series
- Setting data with null values doesn't remove dots from the chart
- How to use Highcharts React to create chart with multiple lines for same XAxis?
- Pie Chart for Data on Different Things with HighChart
- Multiple pie-charts in the same chart with HighCharts
- how to create simple schedule chart with highchart
- Chart data of object gets overwritten, but only the first object that is interacted with is affected
- How to create chart with highchart in which bar doesn't start from 0 in y axis?
- Issue with JSON data encoded from the server, not able to plot the chart
- How to create pie chart with only 1 series data and have background be a circle
- Angular: HighChart TreeMap is not updating with the new data
- Highstock.js: Not able to create multi pane chart with two stacked column charts, one "normal" and the other "percent"
- In Highchart legend, the label color is the same with the color of shape
- No data to display in highcharts showing up with the data in Bubble Chart
- Highcharts : using same div to load a chart multiple times with different series data
- Highchart - How do I create the attached image gauge within a semicircle pie chart
More Query from same tag
- Boxplot and columns combined in a single chart with Highcharts.js
- Highchart Treemap with Multiple series and should behave live heat map
- How can I load a function when loading a highchart?
- How to data-table show name from series in xAxis
- How to add another series into my highchart
- How to change tooltip valueSuffix after chart is rendered?
- Highcharts bar chart with varied bar widths?
- HighCharts change default x-values spacing to 0.5
- Highcharts/Highstock flags series issue
- Highstock.js - Adding a point to the chart dynamically to a new series
- React plot options onclick event
- HighCharts error 16
- *Highchart* Color of chart change when downloading two time continuously
- Highcharts Bubble Chart - How to move an individual point's data label (dataLabel) to the front/top
- Highcharts update function not working properly
- Highcharts Render Animation Reverse?
- how to add scroll bar in scatter highcharts?
- HighCharts Funnel - Set minimum size of each section
- Charts on rails 3 using highcharts
- High chart is not getting populated
- Customizing the series data in pie charts with a dynamic json series (HighCharts)
- How to use the tooltip formatter and still display chart color (like it does by default)?
- Highcharts: How to Place Y-axis title next to first marker?
- Highstock chart rangeSelector minute and day doesn't work
- Horizotal scrollable highcharts timeline chart
- Highcharts donut tooltip formatting using drilldown data
- Highcharts : Two marker symbol for the same point
- Highcharts hiding series and keeping tooltip
- Highcharts Column-chart with php and Ajax
- highcharts - removing decimal places on Y axis with only one point