score:2
Accepted answer
How about setting all options (except data and title) in Highcharts.setOptions(options)
, just like here: http://www.highcharts.com/demo/column-basic/dark-unica
Then create charts:
$('#dashboard').highcharts({
title: { text: {{ mytext }} },
series: [{
type: 'pie',
name: 'Project share',
data: [
['Bill', {{ project }}],
['Non-Bill', {{ not_bill }}],
]
}]
});
$('#dashboard1').highcharts({
title: { text: {{ mytext_2 }} },
series: [{
type: 'pie',
name: 'Project share',
data: [
['Bill', {{ project_2 }}],
['Non-Bill', {{ not_bill_2 }}],
]
}]
});
Or even better:
function createChart(container, text, valA, valB) {
$(container).highcharts({
title: { text: text },
series: [{
type: 'pie',
name: 'Project share',
data: [
['Bill', valA ],
['Non-Bill', valB ],
]
}]
});
}
createChart('#dashboard', {{ mytext }}, {{ project }}, {{ not_bill }});
createChart('#dashboard1', {{ mytext_2 }}, {{ project_2 }}, {{ not_bill_2 }});
Source: stackoverflow.com
Related Query
- use highchart as a template with different title and different values multiple times
- Showing multiple data with same x and y in highchart
- Highcharts for multiple plot lines each with a different color and show tooltip?
- HighCharts: How to draw a straight line in multiple axes like plotLines with fixed X-axis with different values
- How to have multiple highcharts with different series data in vuejs without repeating code
- Dates instead of values on Highchart labels in graph with multiple axis
- Why does highcharts sankey chart sometimes combine multiple nodes with same node name but different Id into one and hide the lines?
- Highchart how to create lollipop type chart with circle and line top/bottom at different positions
- Highchart Treemap with Multiple series and should behave live heat map
- Feeding highchart with x and y values from ajax
- highchart with drilldown where data for main chart and drilled down chart are from different xml files
- use highchart and highstock on the same page
- Can I use two different formatters for highchart tooltips?
- How to create a new Highstock chart with new Highchart and not jquery?
- Can color of data label be different inside and outside of the bar in Highchart
- Highcharts - best way to handle and display zero (or negative) values in a line chart series with logarithmic Y axis
- Possible to use xAxis with type "datetime" and yAxis with categories?
- Highchart data series filled with different colors
- Highcharts with JSON data and multiple series
- Highcharts - Issue with negative values when displaying multiple axes
- Highchart axis max with multiple axes
- Highcharts - Global configuration with common code and unique data & Headings
- how to assign date time to highchart with intervals and date start
- Highcharts: having trouble recreating stacked area chart from Excel with positive and negative values
- Highchart (basic line chart) which can have multiple values vs x axis?
- How to use drilldown upto level 3 with different charts on each level in highcharts?
- How to use Highmaps and Highcharts with Meteor?
- Highcharts - Area Chart - Stacking with series containing negative and positive values
- Highchart Zoom and X-Axis with String Array for Categories
- Change chart type and redraw with multiple series in Highcharts
More Query from same tag
- multiple color axis for different parent groups of treemap highcharts
- Why does my highchart only expand horizontally to fill its containing div, and not vertically?
- How can set a width to a single column in Highcharts
- Highcharts show x-axis with dates
- Highcharts - On and Off over Time
- Highchart: Break y-axis doest work in react app but is working in js fiddle
- Proper way to remove all series data from a highcharts chart?
- Highcharts - On Click event
- use a service inside a funcion
- Highstock with datepicker and a non-default date
- highcharts zoomable 6 month line graph
- How to disable data grouping in Highstocks(npm: Angular-highcharts )
- HighCharts - dynamic graph & no tick mark on the right hand side dual axis
- Is it possible in highcharts to have 2 charts, sharing the same x-axis, but next to one another?
- How to set scrollbar for charts in highcharts.js ?
- How to get my categories with date in xAxis?
- Rectangular selection in Highcharts columnrange
- insert block of text after chart
- formatting x-axis labels in highchart
- Chart Is not displaying Created Using HighCahrts and Google Analytics
- "Uncaught SyntaxError: Unexpected token = " ... JavaScript/HighCharts?
- high chart graph doesnt start from the correct month
- Highcharts formatting data labels
- Remove 'low' label for Highcharts Range chart
- highcharts use variable as chart title
- Make Highcharts border color match background color on column chart
- Wordpress plugin : Yop Poll with pie chart
- How to display a Bar Chart in DataTable
- How to show progrss bar in highchart while loading data?
- How to get only whole numbers on the y-axis?