score:1
Accepted answer
You need to keep the options 'left by a user' and recreate shapes/labels on the export chart load event with those kept options. Depending on what a user can do in your chart keeping the options might be complex but for simple shapes/labels it comes down to saving attrs and css options.
// the labels storage
const customLabels = []
// a util for creating a label and saving its options
function createLabel (renderer, { args, attr, css }) {
const label = renderer.label(...args).attr(attr).css(css).add()
label.userOptions = { args, attr, css}
return label
}
const chart = Highcharts.chart('container', {
chart: {
events: {
redraw () {
const userOptions = {
args: ['The chart was just redrawn', 100, 120],
attr: {
fill: Highcharts.getOptions().colors[0],
padding: 10,
r: 5,
zIndex: 8
},
css: {
color: '#FFFFFF'
}
}
const label = createLabel(this.renderer, userOptions)
customLabels.push(label)
}
}
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}],
exporting: {
chartOptions: {
chart: {
events: {
load () { // recreate the labels
this.labelsForExport = customLabels.map(({ userOptions }) => createLabel(this.renderer, userOptions))
},
destroy () { // clean up the labels
this.labelsForExport.forEach(label => label.destroy())
}
}
}
}
}
});
Source: stackoverflow.com
Related Query
- Highcharts don't export custom SVG elements added after created
- Highcharts manually added svg elements not following stock graph on pan
- Highcharts SVG Export from Python Server Side Code
- Highcharts export chart exportSettings with svg file
- HighCharts Custom SVG Marker Symbol
- Highcharts export with custom HTML graph
- Highcharts : Export multiple charts to pdf in custom layout
- Highcharts Custom SVG Marker Symbol is Shaped Different in Legend
- Add Source to Highcharts Export CSV
- Highcharts Export Renderer Image - Only SVG visible
- Highcharts custom legend SVG symbol does not fade when you click to turn off series
- Dynamically add and remove custom export button in highcharts
- Highcharts custom export hidding on Reset
- Toggle Show/Hide on Highcharts custom export button
- Highcharts custom text right to left export
- Alter SVG After Highcharts is Redrawn
- Highcharts export to svg
- Custom SVG Symbol for location for highcharts
- Highcharts custom SVG marker
- Inserting mouseover event to custom label created with SVGRenderer, highcharts
- Highcharts : remove custom legend tooltip from export
- Highcharts export customize axis label and fontsize: No effect after migration
- Highcharts - how to export chart with a custom legend?
- How to change export button to custom icon in highcharts
- Highcharts Node.js Export Server - gettting output in SVG string
- Highcharts - How to get the particular chart id on click of custom label in export options
- Getting value from tooltip when hover on svg element on the graph created with highcharts
- Highcharts resize chart size using custom export button and replace expand and collapse button dynamically
- Highcharts export server fails after a few seconds
- Highcharts Export after updating colorAxis
More Query from same tag
- JSON data with angular2-highcharts
- highcharts - error when updating a series to have less categories than previously
- How to plot the X axis data point for uneven tick interval at in Highcharts
- Passing arrays to series data not working
- highcharts grouping with overflow
- How to add data labels for highchart?
- Force min/max in Highcharts and avoid 0 for min
- HighChart: Stacked Column Chart with dropdown
- highstock series.stochastic "k d" in different colors
- Highcharts: Remove left and right padding in column chart
- Higchahrts click entire column to trigger point click event
- Highcharts: How to draw a line on top of a column?
- Border Styles for the Highchart tooltip
- How to subtract one month from each month in a Date.UTC Array with jQuery
- Highcharts on rails app renders twice every time it's loaded
- In highcharts,series without dynamic data does not shift
- Highcharts: Datalabels outside when unsufficient space inside, using Google spreadsheets
- Highmaps: what is the code for a county?
- Repeating Javascript Code
- HighCharts : Shared Tooltip with shared Data LABELS (in Series)
- HighCharts navigator and range scale not working?
- How to align the xaxis tick mark center
- Origin of a coordinate space
- Highcharts shared tooltip for line series and scatter plot not working
- Performance issue adding series through loop in Highcharts
- How can I reload chart following data update?
- Display highchart figure in ASP.NET MVC5 view
- Highcharts: hide lines for categories
- Embedding the view of a url inside the header of another view
- Highcharts - Pie Chart - link in tooltip