Highcharts renderer.text仅作为导出 [英] Highcharts renderer.text as export only

查看:237
本文介绍了Highcharts renderer.text仅作为导出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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*/
             }
         }
    );


推荐答案

您是对的 - 您应该使用load事件为导出的图片添加额外文字: http://jsfiddle.net/3bQne/88/

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();
                }
            }
        }
    });

这篇关于Highcharts renderer.text仅作为导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆