Highcharts-导出选项以进行打印以匹配导出到png

时间:2018-12-17 20:09:07

标签: highcharts

如何为打印导出选项与png,jpg等的导出选项完全匹配。 基本上,我有一个具有缩放功能的图表,当用户选择打印时,我想删除rangeSelector,导航器和滚动条。 我已经设置了如下所示的导出选项,但它似乎仅适用于不涉及打印的导出选项。

exporting: {
    chartOptions: {
        rangeSelector: {
            selected: 4,
            inputEnabled: false,
            buttonTheme: {
                visibility: 'hidden'
            },
            labelStyle: {
                visibility: 'hidden'
            }
        },
        navigator: {
            enabled: false
        },
        scrollbar: {
            enabled: false
        }
    },
    scale: 3,
    fallbackToExportServer: false
}

1 个答案:

答案 0 :(得分:0)

您可以使用 LD_LIBRARY_PATH=/usr/local/gcc-7/lib64:$LD_LIBRARY_PATH LD_LIBRARY_PATH=/usr/local/gcc-7/lib:$LD_LIBRARY_PATH LD_LIBRARY_PATH=/usr/local/cuda-10.0/NsightCompute-1.0/host/linux-desktop-glibc_2_11_3-glx-x64/Plugins:$LD_LIBRARY_PATH LD_LIBRARY_PATH=/usr/local/cuda-10.0/NsightCompute-1.0/target/linux-desktop-glibc_2_11_3-glx-x64:$LD_LIBRARY_PATH LD_LIBRARY_PATH=/usr/local/cuda-10.0/targets/x86_64-linux/lib/stubs:$LD_LIBRARY_PATH PATH=/usr/local/gcc-7/bin:$PATH PATH=/usr/local/cuda-10.0/bin:$PATH PATH=$HOME/big/cuda.samples/NVIDIA_CUDA-10.0_Samples/bin/x86_64/linux/release:$PATH 事件并使用新选项更新图表来实现它。之后,使用beforePrint event使用旧选项更新图表。

代码:

afterPrint

演示:
https://jsfiddle.net/fs80h3qg/

Api参考:
https://api.highcharts.com/highcharts/chart.events.beforePrint
https://api.highcharts.com/highcharts/chart.events.afterPrint
https://api.highcharts.com/class-reference/Highcharts.Chart#update