score:8
figured it out. i added the total to the series, then called it with this.options. see updated code below:
legend: {
borderradius:0,
backgroundcolor: '#ffffff',
itemmarginbottom: 7,
layout: 'vertical',
align: 'right',
verticalalign: 'top',
y: 30,
x: 2,
borderwidth: 0,
width:130,
symbolpadding: 10,
usehtml:true,
shadow: {
color: '#000',
width: 3,
opacity: 0.15,
offsety: 2,
offsetx: 1
},
labelformatter: function() {
return '<div class="' + this.name + '-arrow"></div><span style="font-family: \'advent pro\', sans-serif; font-size:16px">' + this.name +'</span><br/><span style="font-size:10px; color:#ababaa">(total: ' + this.options.total + ')</span>';
}
},
series: [{
name: 'honeywell',
total: 9150,
data: [700,725,750,850,950,1000,1025,1050,1050,1050]
}, {
name: 'bombardier',
total: 10548,
data: [661,758,880,990,1065,1136,1193,1241,1289,1335]
}, {
name: 'embraer',
total: 9301,
data: [747,789,839,861,890,908,984,1030,1097,1156]
}]
});
});
score:12
a more generic & dynamic answer:
legend: {
labelformatter: function() {
var total = 0;
for(var i=this.ydata.length; i--;) { total += this.ydata[i]; };
return this.name + '- total: ' + total;
}
}
Source: stackoverflow.com
Related Query
- Add series total to legend in Highcharts
- HighCharts Hide Series Name from the Legend
- Hiding a Highcharts series without using the legend
- Add additional data to a Highcharts series for use in formatters
- Filtering legend of a Highcharts by only visible series
- Add tooltip to legend in highcharts when hovering
- Add a gap between the second and third series in a Highcharts column plot with four series displayed
- Highcharts add legend on export
- Highcharts add series dynamically
- Highcharts: add different colors to legend in one series histogram
- Highcharts add tooltip that has a small arrow pointing toward the series
- Dynamically add data to series in Highcharts
- Highcharts hide series without change legend color
- Highcharts JS- add third variable to tooltip for two series
- How to color series legend in highcharts when colorbypoint is set to true
- Showing HighCharts series name on x-axis and in legend
- Highcharts solidgauge legend symbol not taking series color
- How to add series after click event in HighCharts
- How do i add mouse wheel code in Angular2 highcharts in typescript
- Highcharts error when add and shift data to hidden series
- Adding different style to a series in legend in Highcharts
- How to keep the highcharts legend "on" while hiding the series
- How to add multiple series in highcharts synchronously
- Highcharts - Add Series Name As X-Axis Label
- Dynamically add an event to Highcharts series
- Filtering legend of a Highcharts by only visible series only in Export
- Add a max width to legend in Highcharts
- Highcharts no longer animates and readjusts/rescales chart upon addition and removal of series in legend after upgrading to jQuery 1.10
- How can I add a text link just below the legend box in highcharts
- How to add Series data in Highcharts from MVC
More Query from same tag
- Does highcharts (or vaadin) have built-in abilities to use an algorithm like Ramer–Douglas–Peucker?
- highcharts and canvg scaling issue
- How to change the background color of the Highcharts(HighMaps in specific) dynamically?
- Highchart : Json Array For ToolTip
- Add label to column chart of Highchart
- Highchart Array Xaxis
- How to use highcharts to display data of only five point when the page is initialized?
- Highcharts zoom issue when panning reversed xAxis
- Printing table with charts in html through FireFox
- Range Selector date always goes to 1970-01-01 in Highcharts.Chart()
- Trying to add a button to a iframe HighCharts document, chart variable not found
- Webpack Highcharts Plugin IIFE
- Angular 2 Typescript Highcharts Highmap mouse wheel scroll
- Hide segment of a line in Highcharts
- Highcharts ajax load
- Highcharts - how to set custom content in point tooltip (popup) on 3D scatter chart or how to customize point tooltip information?
- Javascript datepicker date defaulting to 01-01-1970 HighCharts
- how to show same labels as bar chart on inverted column chart
- highcharts clickable labels how to goto anchor
- How to open new chart to the adjacent <div> on bar click in highchart
- Adding information to xAxis - r shiny
- Pixelpadding between bars?
- HighCharts PieChart with just one segment doesn't show a label
- what should be the initial dataset from millions of data points for stock line highcharts
- Background on the bar not getting removed from Highcharts
- Pie Chart tooltip thousand seperator and rtl labels doesn't work in highchart
- How to draw disconnected straight lines over a graph?
- Hide first yAxis label in Highcharts
- Convert DataTable to array for highcharts
- How to create a scatter plot with non-numbers as values?