【问题标题】:Exporting HighCharts chart specific height width导出 HighCharts 图表特定高度宽度
【发布时间】:2023-04-03 23:40:01
【问题描述】:

为了将导出的高度和宽度属性更改为 HighCharts 图表,您必须添加导出参数:

var chart = Highcharts.mapChart('container', {
    title: {
        text: 'USA 2016 Presidential Election Results'
    },

    chart: {
        animation: false
    },

    exporting: { height: 200, width: 700}  //<---- exporting

在以下图表中,我遇到了困难:

https://jsfiddle.net/kmr6kv6L/2/

无论我设置什么高度或宽度,输出都会返回默认设置的任何尺寸。此图表是否不遵循相同的功能?

这些值仅作为示例,但它也不适用于其他值。

谢谢

【问题讨论】:

    标签: javascript highcharts


    【解决方案1】:

    根据Documentation和this sample

    sourceWidth:数字 导出时原始图表的宽度,除非设置了明确的 chart.width。然后将导出的光栅图像的宽度乘以比例。

    而不是使用以下导出选项:

     exporting: { height: 200, width: 700}  //<---- exporting
    

    试试这个:

        exporting: {
            sourceWidth: 700,
            sourceHeight: 400,
        },
    

    编辑

    除了我之前说的,你还应该像下面这样设置scale = 1:

     exporting: {
        sourceWidth: 700,
        sourceHeight: 400,
        scale: 1 
    },
    

    jsfiddle link

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-25
      • 1970-01-01
      相关资源
      最近更新 更多