Can not exporting renderer shapes added in callback function in highcharts / highstock

后端 未结 2 1043
半阙折子戏
半阙折子戏 2020-12-22 05:33

I want to dynamically added several primitive shapes like text and images into highcharts / highstock.

Please see this fiddle.

$(function () {
    v         


        
相关标签:
2条回答
  • 2020-12-22 05:45

    You can use chart.exportChart() function to achieve that: http://jsfiddle.net/B6s7V/38/

    The same solution as here.

    $("#export").click(function () {
        chart.exportChart(null, {
            chart: {
                events: {
                    load: function () {
                        this.renderer.image('http://highcharts.com/demo/gfx/sun.png', 100, 100, 30, 30).add();
                    }
                }
            }
        });
    });
    
    0 讨论(0)
  • 2020-12-22 06:06

    When you export a chart, the chart SVG is regenerated from the original .Chart call. If you want to add things after the chart has drawn, do it in the charts:events:load callback.

        chart: {
            renderTo: 'container',
            spacingBottom: 50,
            events: {
                load: function(){
                    this.renderer.image('http://highcharts.com/demo/gfx/sun.png', 100, 100, 30, 30).add();
                }
            }
        }, 
    

    See updated fiddle here.

    0 讨论(0)
提交回复
热议问题