簡體   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