Class Exporting

    • Constructor Detail

      • Exporting

        public Exporting()
    • Method Detail

      • setAccessibility

        public void setAccessibility​(ExportingAccessibility accessibility)
        Accessibility options for the exporting menu.
        Since:
        10.2.1.0
      • isAllowHTML

        public boolean isAllowHTML()
        Experimental setting. Returns whether allows HTML inside the chart (added through the useHTML options), directly in the exported image. This allows you to preserve complicated HTML structures like tables or bi-directional text in exported charts. Disclaimer: The HTML is rendered in a foreignObject tag in the generated SVG. The official export server is based on PhantomJS, which supports this, but other SVG clients, like Batik, does not support it. This also applies to downloaded SVG that you want to open in a desktop client.

        Default: false

        Since:
        7.2.1.0
      • setAllowHTML

        public void setAllowHTML​(boolean allowHTML)
        Sets whether allows HTML inside the chart (added through the useHTML options), directly in the exported image. This allows you to preserve complicated HTML structures like tables or bi-directional text in exported charts. Disclaimer: The HTML is rendered in a foreignObject tag in the generated SVG. The official export server is based on PhantomJS, which supports this, but other SVG clients, like Batik, does not support it. This also applies to downloaded SVG that you want to open in a desktop client.
        Since:
        7.2.1.0
      • setButtons

        public void setButtons​(ExportingButton button)
        Sets an options for the export context button.
        Parameters:
        button -
      • setButtons

        public void setButtons​(Map<String,​ExportingButton> buttons)
        Sets multiple buttons within a map
        Parameters:
        buttons -
      • getButtons

        public ExportingButton getButtons()
        Returns context button for the export button.
      • setLibURL

        public void setLibURL​(String libURL)
        Sets path where Highcharts will look for export module dependencies to load on demand if they don't already exist on window.

        Default: null

        Parameters:
        libURL - The library path for JSPDF and SVG2PDF.js
        Since:
        11.4.7.0
      • getLibURL

        public String getLibURL()
        Returns path where Highcharts will look for export module dependencies to load on demand if they don't already exist on window.

        Default: null

        Since:
        11.4.7.0
      • getMenuItemDefinitions

        public Map<String,​MenuItem> getMenuItemDefinitions()
        Returns a map consisting of definitions for the menu items in the context menu.
        Since:
        7.2.2.0
      • setMenuItemDefinitions

        public void setMenuItemDefinitions​(Map<String,​MenuItem> menuItems)
        Sets to a map consisting of definitions for the menu items in the context menu.
        Since:
        7.2.2.0
      • getPdfFont

        public PDFFont getPdfFont()
        Returns the settings for a custom font for the exported PDF. If null, create a new one.
        Since:
        10.2.1.0
      • setPdfFont

        public void setPdfFont​(PDFFont pdfFont)
        Sets settings for a custom font for the exported PDF
        Since:
        10.2.1.0
      • setChartOptions

        public <V> void setChartOptions​(Map<String,​V> chartOptions)
        Sets additional chart options to be merged into an exported chart. For example, the exported chart can be given a specific width and height, or a printer-friendly color scheme.

        Defaults to null.

        For example, to export a chart with different size from the displaying chart,

         
         Map<String, Number> options = new HashMap<String, Number>();
         options.put("width", 350);
         options.put("height", 600);
         chart.getExporting().setChartOptions(options);
         

        To export a chart with different background image from the displaying chart,

         
         Map<String, String> options = new HashMap<String, String>();
         options.put("plotBackgroundImage", "http://www.example.com/sky.png");
         chart.getExporting().setChartOptions(options);
         

        To export a chart with both different background image and size from the displaying chart,

         
         Map<String, Object> options = new HashMap<String, Object>();
         options.put("width", 350);
         options.put("height", 600);
         options.put("plotBackgroundImage", "http://www.example.com/sky.png");
         chart.getExporting().setChartOptions(options);
         

        Do notice the different type signature in the options map declaration.

        Type Parameters:
        V - type for the value of chart option, usually String or Number, sometimes Object if mixing String and Number
      • getChartOptions

        public <V> Map<String,​V> getChartOptions()
        Returns additional chart options to be merged into an exported chart. For example, the exported chart can be given a specific width and height, or a printer-friendly color scheme.

        Defaults to null.

        Type Parameters:
        V - type for the value of chart option, usually String or Number, sometimes Object if mixing String and Number
        See Also:
        setChartOptions(Map)
      • isEnabled

        public boolean isEnabled()
        Returns whether to enable buttons.

        Default: true

      • setEnabled

        public void setEnabled​(boolean enabled)
        Sets whether to enable buttons.
      • getFilename

        public String getFilename()
        Returns the filename, without extension, to use for the exported chart.

        Defaults to chart.

      • setFilename

        public void setFilename​(String filename)
        Sets the filename, without extension, to use for the exported chart. Defaults to chart.
      • setFormAttributes

        public <T> void setFormAttributes​(List<T> formAttributes)
        Sets an object containing additional attributes for the POST form that sends the SVG to the export server. For example, a target can be set to make sure the generated image is received in another frame, or a custom enctype or encoding can be set.
      • getFormAttributes

        public <T> List<T> getFormAttributes()
        Returns an object containing additional attributes for the POST form that sends the SVG to the export server. For example, a target can be set to make sure the generated image is received in another frame, or a custom enctype or encoding can be set.

        Defaults to null.

      • getScale

        public Number getScale()
        Returns the scale or zoom factor for the exported image compared to the on-screen display. While for instance a 600px wide chart may look good on a website, it will look bad in print. The default scale of 2 makes this chart export to a 1200px PNG or JPG..

        Default: 2

      • setScale

        public void setScale​(Number scale)
        Sets the scale or zoom factor for the exported image compared to the on-screen display. While for instance a 600px wide chart may look good on a website, it will look bad in print. The default scale of 2 makes this chart export to a 1200px PNG or JPG..

        Default: 2

      • isShowTable

        public boolean isShowTable()
        Returns whether to show a HTML table below the chart with the chart's current data.

        Default: false

        Since:
        11.2.0.0
      • setShowTable

        public void setShowTable​(boolean showTable)
        Sets whether to show a HTML table below the chart with the chart's current data.

        Default: false

        Since:
        11.2.0.0
      • getSourceHeight

        public Number getSourceHeight()
        Returns the height of the original chart when exported, unless an explicit chart.width is set. The width exported raster image is then multiplied by scale.

        Default: null

      • setSourceHeight

        public void setSourceHeight​(Number sourceHeight)
        Sets the height of the original chart when exported, unless an explicit chart.width is set. The width exported raster image is then multiplied by scale.

        Default: null

      • getSourceWidth

        public Number getSourceWidth()
        Returns the width of the original chart when exported, unless an explicit chart.width is set. The width exported raster image is then multiplied by scale.

        Default: null

      • setSourceWidth

        public void setSourceWidth​(Number sourceWidth)
        Sets the width of the original chart when exported, unless an explicit chart.width is set. The width exported raster image is then multiplied by scale.

        Default: null

      • setType

        public void setType​(String type)
        Sets the default MIME type for exporting if chart.exportChart() is called without specifying a type option. Possible values are image/png, image/jpeg, application/pdf and image/svg+xml.

        Defaults to image/png.

        Parameters:
        type -
      • getType

        public String getType()
        Returns the default MIME type for exporting if chart.exportChart() is called without specifying a type option. Possible values are image/png, image/jpeg, application/pdf and image/svg+xml.

        Defaults to image/png.

      • setUrl

        public void setUrl​(String url)
        Sets the URL for the server module converting the SVG string to an image format. By default this points to Highslide Software's free web service.

        Defaults to https://export.highcharts.com.

      • getUrl

        public String getUrl()
        Returns the URL for the server module converting the SVG string to an image format. By default this points to Highslide Software's free web service.

        Defaults to https://export.highcharts.com.

      • getWidth

        public Number getWidth()
        Returns the pixel width of charts exported to PNG or JPG. As of Highcharts 3.0, the default pixel width is a function of the chart.width or exporting.sourceWidth and the exporting.scale.

        Defaults to null.

      • setWidth

        public void setWidth​(Number width)
        Sets the pixel width of charts exported to PNG or JPG. As of Highcharts 3.0, the default pixel width is a function of the chart.width or exporting.sourceWidth and the exporting.scale.

        Defaults to null.