首页 > 解决方案 > 从导出菜单打印高图时隐藏滚动条

问题描述

有什么办法可以在printing chartwhile时隐藏滚动条exporting。我可以scrollbar在导出时image & pdf隐藏,但在选择print chart选项时无法隐藏。

我已经尝试过exporting.chartOptions如下配置

      chart_options.exporting.chartOptions = {
        xAxis : [{
          categories: timeline,
          min: 0,
          minRange: timeline.length-1,
          max: timeline.length-1
        }],
        scrollbar:{
          enabled: false
      }

它可以与其他导出选项一起正常工作,但不能在print chart选项中使用。

https://jsfiddle.net/harishk3499/gdv7oz9w/

请帮忙!

标签: javascripthighcharts

解决方案


您可以使用beforePrintafterPrint事件来更改图表:

chart: {
    events: {
        beforePrint: function() {
            this.update({
                scrollbar: {
                    enabled: false
                }
            });
        },
        afterPrint: function() {
            this.update({
                scrollbar: {
                    enabled: true
                }
            });
        }
    }
}

现场演示:http: //jsfiddle.net/BlackLabel/ae905yfx/

API参考:

https://api.highcharts.com/highcharts/chart.events.afterPrint

https://api.highcharts.com/highcharts/chart.events.beforePrint


推荐阅读