Question

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*/
             }
         }
    );
Was it helpful?

Solution

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();
                }
            }
        }
    });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top