score:12
Accepted answer
I would use the Renderer.text to annotate the chart (and not do it in the legend since you have so many data points).
chart: {
events: {
load: function(event) {
var total = 0; // get total of data
for (var i = 0, len = this.series[0].yData.length; i < len; i++) {
total += this.series[0].yData[i];
}
var text = this.renderer.text(
'Total: ' + total,
this.plotLeft,
this.plotTop - 20
).attr({
zIndex: 5
}).add() // write it to the upper left hand corner
}
}
},
Fiddle example.
score:6
In addition to Mark's answer, to calculate the total, we do not need the for-loop statement. So, the code can be reduced.
chart: {
events: {
load: function(event) {
var total = this.series[0].data[0].total;
var text = this.renderer.text(
'Total: ' + total,
this.plotLeft,
this.plotTop - 20
).attr({
zIndex: 5
}).add() // write it to the upper left hand corner
}
}
},
Source: stackoverflow.com
Related Query
- Total of values in HighCharts Pie Chart
- Highcharts - Pie chart with negative values
- Highcharts display label for pie chart using html table as data source
- Highcharts pie chart plotting different values
- Highcharts Pie chart not accepting values
- HighCharts Pie Chart - Displaying multiple series values in Tooltip
- HighCharts pie chart X-axies values are not displayed while trying to get data from MySQL database using PHP
- HighCharts : Total Value is not showing in Pie Chart
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- HighCharts - Make the pie chart 100% of the div
- Place text in center of pie chart - Highcharts
- Highcharts percentage of total for simple bar chart
- Highcharts - labels inside and outside a pie chart
- Highcharts Pie Chart ignores percentageDecimals tooltip setting and has floating point inaccuracy issue
- Highcharts pie chart dynamically changes size
- Highcharts not displaying data labels for Pie chart in arabic
- HighCharts Pie Chart - Add text inside each slice
- highcharts - chart names for multiple pie chart series in one chart
- Highcharts Pie Chart Drilldown not showing on third drill
- Highcharts - best way to handle and display zero (or negative) values in a line chart series with logarithmic Y axis
- Highcharts Pie Chart Label Threshold
- HighCharts - Pie chart drilldown for multilevel (3 to 4 level)
- Grand Totals in HighCharts Pie Chart Legend
- HighCharts Pie Chart Legend value alignment
- Hide 0 values in Stacked Column Chart in Highcharts
- How get data name in Highcharts pie chart legend instead of "Slice" using array of values?
- Rotating dataLabels in a Highcharts pie chart
- Highcharts connecting scatter chart and pie chart with single legend
- Highcharts Donut chart is rendered as a Pie chart in IE 8
- How to create an inner circle pie chart in Highcharts
More Query from same tag
- In a multiple column layout my highchart is not visible in Safari
- Highcharts issue when dealing with 3D pie and large labels
- Some xAxis labels are not showing in Highchart : Area Chart
- Basic Javascript: How can I link my HTML and Javascript on a Highcharts example?
- Highcharts update grouped data point color
- Highcharts - not able to resize onclick a button in angular 6
- Highchart ticks start point change when categories names are set
- How to draw SVG lines inside HighCharts barcharts?
- How do you change the height value when more items are added to highcharts dynamically?
- It's not possible load Highstock from the CDN as an AMD module
- Highcharts Export PDF offline by clicking external button
- parse file from input with papaparse
- Highcharts scatter plot - make tooltip not follow pointer
- How to scale Highcharts height on window resize with React
- Highcharts renderTo container not found (error 13)
- Highchart plot points are being displayed incorrectly
- Timestamp in Highcharts
- Mouse wheel event, not working as expected in Firefox, when using Highcharts with PerfectScrollbar
- Highcharts Pie Slice Offset on Legend Click
- Highchart - Datalabel overlaps across slices
- Highcharts displaying decimals on yearly xAxis
- Highchart pie legend circles
- highcharts additional title opinion
- Pass data to Stacked Column Chart (Highcharts Framework)
- Display all labels in x-axis in HighCharts Stock
- Highcharts series hover state enables after adding series
- Converting svg from Highcharts data into data points
- Combined Stacked Grouped Columns and Line
- How can I plot regions using HighCharts GeoMaps?
- Highcharts not printing the line when there is empty data in the beginning