Highcharts renderer.text as export only

不问归期 提交于 2019-12-08 12:44:06

问题


I have an optional feature for a chart that adds a renderer.text text object. When the chart is exported I would like this to be added only in that case. Below I have source code on how I have been accessing the renderer and the exporter. In the commented section Insert Here is where I was thinking it might go but I am unsure of the syntax. Thank you

    myChart.renderer.text('Filtered', 5, 10)
        .attr({rotation: 0})
        .css({color: '#4572A7', fontSize: '8px', fontStyle:'italic'})
        .add();
    myChart.exportChart(null, 
         {chart: 
             {backgroundColor: '#FFFFFF', width: 972, height:480 /*Insert Here*/
             }
         }
    );

回答1:


You are right - there you should use load event to add extra text for exported image: http://jsfiddle.net/3bQne/88/

chart.exportChart(null, {
        chart: {
            backgroundColor: '#FFFFFF',
            width: 972,
            height: 480,
            events: {
                load: function () {
                    this.renderer.text('Filtered', 5, 10)
                        .attr({
                        rotation: 0
                    })
                        .css({
                        color: '#4572A7',
                        fontSize: '8px',
                        fontStyle: 'italic'
                    })
                        .add();
                }
            }
        }
    });


来源:https://stackoverflow.com/questions/16474712/highcharts-renderer-text-as-export-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!