Highcharts renderer.text仅作为导出

时间:2013-05-10 03:27:31

标签: text highcharts renderer exporter

我有一个图表的可选功能,可以添加一个renderer.text文本对象。导出图表时,我希望仅在这种情况下添加。下面我有关于我如何访问渲染器和导出器的源代码。在评论部分插入这里是我认为可能会去的地方,但我不确定语法。谢谢

    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 个答案:

答案 0 :(得分:2)

你是对的 - 你应该使用load事件为导出的图像添加额外的文本: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();
                }
            }
        }
    });