繁体   English   中英

增加出口图表的高度

[英]Increase Height Of Chart On Export

使用最新的图表(3.0.7)。 我们正在尝试在导出图表的顶部添加文本。 为此,我需要增加spacingTop以便我们不会覆盖任何图表元素。 然后,在相同的图表高度下,通过该spacingTop数量,图表将变得不那么高。 如何获得当前图表的高度,并在导出时为其添加X值? 我努力了:

exporting: {
    sourceWidth: 400,
    //sourceHeight: this.chartHeight,
    //sourceHeight: this.chartHeight + 200,
    scale: 1, //(default)
    chartOptions: {
        subtitle: null,
        height: this.chartHeight + 200
    }
}

这似乎被忽略了。 看到这个小提琴 这只是测试,看看我是否可以做到这一点。 似乎应该是直截了当的。 如果我取消注释sourceHeight它仍然无法达到我的预期-图表仍为400px高。 因此,似乎this.chartHeight不包含任何内容。

最后,这个高度变化代码将存在于我们称为的函数中:

chartMainLoc.exportChart({
    type: 'image/jpeg',
    sourceHeight: this.chartHeight + 200,
    sourceWidth: this.chartWidth,
    scale: 1
}, {
    chart: {
        events: {
            load: function () {
                this.renderer.text('Occupational Employment and Wage Rates (OES) for Multiple Occupations in Louisiana in 2012<br /> The graph below shows the annual occupational employment and annual wage data for Multiple Occupations in Louisiana in 2012.<br /> ', 5, 15).attr({
                    rotation: 0
                }).css({
                    color: '#4572A7',
                    fontSize: '10px',
                    fontStyle: 'italic',
                    width: this.chartWidth
                }).add();
                this.renderer.rect(5, 5, this.chartWidth - 10, 60, 5).attr({
                    'stroke-width': 2,
                    stroke: 'black',
                    zIndex: 2
                }).add();
            }
        },
        spacingTop: 200,
        shadow: false
    }
})

由于我事先不知道图表的高度或宽度,因此必须以某种方式获取此值。

您需要像示例http://jsfiddle.net/GQUDJ/2/中那样设置带有对象( chart / series等)的图表优化

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM