2013-02-07 28 views
2

設置標題我正在尋找一種方法:在HTML頁面結果highcharts:對出口

  • 隱藏標題
  • 秀上,當我導出(PDF,PNG,JPEG或highcharts圖形標題打印)

我不知道如何繼續。有人能夠幫助我嗎?

回答

2

把這個功能在下面的文檔準備功能是改變highcharts打印原型和公正的補丁或使其工作擺rangeSelector選項,您導出代碼並將其設置爲false,如下所述,您可以將其設置爲將來的需要

 Highcharts.wrap(Highcharts.Chart.prototype, 'print', function (proceed) { 

        var applyMethod = function (whatToDo, margin) { 
        this.extraTopMargin = margin; 
        this.resetMargins(); 
        this.setSize(this.container.clientWidth , this.container.clientHeight , false); 

        this.setTitle(null, { text: 'SET TITLE HERE' :'}); 

        this.rangeSelector.zoomText[whatToDo](); 
        $.each(this.rangeSelector.buttons, function (index, button) { 
         button[whatToDo](); 
        }); 
       }; 
       if (this.rangeSelector) { 
        var extraMargin = this.extraTopMargin; 
        applyMethod.apply(this, ['hide', null]); 
        var returnValue = proceed.call(this); 
        applyMethod.apply(this, ['show', extraMargin]); 
        this.setTitle(null, { text: '' }); 
       } else { 
        return proceed.call(this); 
        this.setTitle(null, { text: '' }); 
        this.yAxis[0].setExtremes(); 
       }      } 


    }); 

,並在圖表選項設置此(根據您的需要更改,我只是把我的代碼爲參考 )

 exporting: { 
      scale: 1, 
      sourceWidth: 1600, 
      sourceHeight: 900, 

      chartOptions: { 
       rangeSelector: { 
        enabled: false 
      }, 
    }