Class Exporting
- java.lang.Object
-
- org.zkoss.chart.Optionable
-
- org.zkoss.chart.Exporting
-
- All Implemented Interfaces:
Serializable,OptionDataListener,org.zkoss.json.JSONAware
public class Exporting extends Optionable
Options for the exporting module. For an overview on the matter, see the docs .All the options in this class support
DynamicalAttribute.- Author:
- jumperchen
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.zkoss.chart.Optionable
NOT_NULL_VALUE, options
-
-
Constructor Summary
Constructors Constructor Description Exporting()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExportingAccessibilitygetAccessibility()Accessibility options for the exporting menu, or create a new one.ExportingButtongetButtons()Returns context button for the export button.Map<String,ExportingButton>getButtonsMap()Returns a map of buttons for the export button.<V> Map<String,V>getChartOptions()Returns additional chart options to be merged into an exported chart.StringgetFilename()Returns the filename, without extension, to use for the exported chart.<T> List<T>getFormAttributes()Returns an object containing additional attributes for the POST form that sends the SVG to the export server.StringgetLibURL()Returns path where Highcharts will look for export module dependencies to load on demand if they don't already exist on window.Map<String,MenuItem>getMenuItemDefinitions()Returns a map consisting of definitions for the menu items in the context menu.PDFFontgetPdfFont()Returns the settings for a custom font for the exported PDF.NumbergetScale()Returns the scale or zoom factor for the exported image compared to the on-screen display.NumbergetSourceHeight()Returns the height of the original chart when exported, unless an explicit chart.width is set.NumbergetSourceWidth()Returns the width of the original chart when exported, unless an explicit chart.width is set.StringgetType()Returns the default MIME type for exporting if chart.exportChart() is called without specifying a type option.StringgetUrl()Returns the URL for the server module converting the SVG string to an image format.NumbergetWidth()Returns the pixel width of charts exported to PNG or JPG.booleanisAllowHTML()Experimental setting.booleanisEnabled()Returns whether to enable buttons.booleanisLocal()Returns whether the chart is exported using the browser's built-in capabilities (offline export) rather than being sent to the Highcharts export server.booleanisShowTable()Returns whether to show a HTML table below the chart with the chart's current data.voidsetAccessibility(ExportingAccessibility accessibility)Accessibility options for the exporting menu.voidsetAllowHTML(boolean allowHTML)Sets whether allows HTML inside the chart (added through theuseHTMLoptions), directly in the exported image.voidsetButtons(Map<String,ExportingButton> buttons)Sets multiple buttons within a mapvoidsetButtons(ExportingButton button)Sets an options for the export context button.<V> voidsetChartOptions(Map<String,V> chartOptions)Sets additional chart options to be merged into an exported chart.voidsetEnabled(boolean enabled)Sets whether to enable buttons.voidsetFilename(String filename)Sets the filename, without extension, to use for the exported chart.<T> voidsetFormAttributes(List<T> formAttributes)Sets an object containing additional attributes for the POST form that sends the SVG to the export server.voidsetLibURL(String libURL)Sets path where Highcharts will look for export module dependencies to load on demand if they don't already exist on window.voidsetLocal(boolean local)Sets whether to force browser-local export.voidsetMenuItemDefinitions(Map<String,MenuItem> menuItems)Sets to a map consisting of definitions for the menu items in the context menu.voidsetPdfFont(PDFFont pdfFont)Sets settings for a custom font for the exported PDFvoidsetScale(Number scale)Sets the scale or zoom factor for the exported image compared to the on-screen display.voidsetShowTable(boolean showTable)Sets whether to show a HTML table below the chart with the chart's current data.voidsetSourceHeight(Number sourceHeight)Sets the height of the original chart when exported, unless an explicit chart.width is set.voidsetSourceWidth(Number sourceWidth)Sets the width of the original chart when exported, unless an explicit chart.width is set.voidsetType(String type)Sets the default MIME type for exporting if chart.exportChart() is called without specifying a type option.voidsetUrl(String url)Sets the URL for the server module converting the SVG string to an image format.voidsetWidth(Number width)Sets the pixel width of charts exported to PNG or JPG.-
Methods inherited from class org.zkoss.chart.Optionable
addExtraAttr, addOptionDataListener, clearOptonDataListener, clone, containsKey, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getAttr, getAttr, getClientState, getExtraAttr, merge, onChange, removeExtraAttr, removeKey, removeOptionDataListener, setAttr, setAttr, setAttr, setAttr, toJSONString, toString
-
-
-
-
Method Detail
-
getAccessibility
public ExportingAccessibility getAccessibility()
Accessibility options for the exporting menu, or create a new one.Default: an instance of
ExportingAccessibility- Since:
- 10.2.1.0
-
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 theuseHTMLoptions), 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 aforeignObjecttag 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 theuseHTMLoptions), 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 aforeignObjecttag 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.
-
getButtonsMap
public Map<String,ExportingButton> getButtonsMap()
Returns a map of buttons 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
-
isLocal
public boolean isLocal()
Returns whether the chart is exported using the browser's built-in capabilities (offline export) rather than being sent to the Highcharts export server. This flag explicitly forces one path; in contrast,fallbackToExportServeronly falls back to the server if local export fails.Default: true
- Since:
- 12.5.0.0
-
setLocal
public void setLocal(boolean local)
Sets whether to force browser-local export.- Since:
- 12.5.0.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.
-
-