Class ChartsEngine

  • All Implemented Interfaces:
    Serializable, ChartsApi

    public class ChartsEngine
    extends Object
    implements ChartsApi, Serializable
    An engine of Charts. Does not need a ZK execution to work. It is used mainly to generate options as JSON format for Highcharts Export Server. Typical usage:
    
     ChartsEngine chart = new ChartsEngine();
     chart.setTitle("Monthly Average Temperature");
     chart.setSubTitle("Source: WorldClimate.com");
     chart.setType(Charts.LINE);
     chart.setTheme(Theme.DEFAULT);
     chart.setModel(model);
     chart.getXAxis().setCategories(Arrays.asList(new String[]{
         "Jan", "Feb", "Mar", "Apr", "May", "Jun",
         "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
     }));
     chart.getYAxis().getTitle().setText("Temperature (°C)");
     return chart.toJSON(); // {"xAxis":{}...}
     
    Since:
    3.0.2
    Author:
    rudyhuang
    See Also:
    toJSON(), Serialized Form
    • Constructor Detail

      • ChartsEngine

        public ChartsEngine()
    • Method Detail

      • getPlotData

        public PlotData getPlotData()
        Description copied from interface: ChartsApi
        Returns the plot data which is a JSON object to collect all chart's options for Charts JS.
        Specified by:
        getPlotData in interface ChartsApi
      • getData

        public Data getData()
        Description copied from interface: ChartsApi
        Returns the data object.
        Specified by:
        getData in interface ChartsApi
      • setColors

        public void setColors​(List<Color> colors)
        Description copied from interface: ChartsApi
        Sets the default colors for the chart's series. When all colors are used, new colors are pulled from the start again.
        Specified by:
        setColors in interface ChartsApi
      • setColors

        public void setColors​(String... source)
        Description copied from interface: ChartsApi
        Sets the default colors for the chart's series. When all colors are used, new colors are pulled from the start again.
        Specified by:
        setColors in interface ChartsApi
      • getColors

        public List<Color> getColors()
        Description copied from interface: ChartsApi
        Returns the default colors for the chart's series. When all colors are used, new colors are pulled from the start again.
        Specified by:
        getColors in interface ChartsApi
      • getClassName

        public String getClassName()
        Description copied from interface: ChartsApi
        Returns a CSS class name to apply to the charts container div, allowing unique CSS styling for each chart.
        Specified by:
        getClassName in interface ChartsApi
      • setClassName

        public void setClassName​(String className)
        Description copied from interface: ChartsApi
        Sets a CSS class name to apply to the charts container div, allowing unique CSS styling for each chart.
        Specified by:
        setClassName in interface ChartsApi
      • setTheme

        public void setTheme​(Theme theme)
        Description copied from interface: ChartsApi
        Sets the theme options for all Charts in the same browser page.
        Specified by:
        setTheme in interface ChartsApi
      • getTheme

        public Theme getTheme()
        Description copied from interface: ChartsApi
        Returns the global theme for all Charts.

        Default is null

        Specified by:
        getTheme in interface ChartsApi
      • getModel

        public ChartsModel getModel()
        Description copied from interface: ChartsApi
        Returns the chart model associated with this chart, or null if this chart is not associated with any chart data model.
        Specified by:
        getModel in interface ChartsApi
      • setModel

        public void setModel​(ChartsModel model)
        Description copied from interface: ChartsApi
        Sets the chart model associated with this chart. If a non-null model is assigned, no matter whether it is the same as the previous, it will always cause re-render.
        Specified by:
        setModel in interface ChartsApi
        Parameters:
        model - the chart model to associate, or null to dissociate any previous model.
      • setModel

        public void setModel​(org.zkoss.zul.ChartModel model)
        Specified by:
        setModel in interface ChartsApi
      • setType

        public void setType​(String type)
        Description copied from interface: ChartsApi
        Set the chart's type (Charts.PIE, Charts.BAR, Charts.LINE, etc.).

        Default: line.

        Specified by:
        setType in interface ChartsApi
      • getType

        public String getType()
        Description copied from interface: ChartsApi
        Get the chart's type.

        Default: line.

        Specified by:
        getType in interface ChartsApi
      • setAlignTicks

        public void setAlignTicks​(boolean alignTicks)
        Description copied from interface: ChartsApi
        Sets when using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks. This can be prevented by setting alignTicks to false. If the grid lines look messy, it's a good idea to hide them for the secondary axis by setting gridLineWidth to 0.
        Specified by:
        setAlignTicks in interface ChartsApi
        Parameters:
        alignTicks - when using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks
        See Also:
        Chart.setAlignTicks(boolean)
      • isAlignTicks

        public boolean isAlignTicks()
        Description copied from interface: ChartsApi
        Returns when using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks. This can be prevented by setting alignTicks to false. If the grid lines look messy, it's a good idea to hide them for the secondary axis by setting gridLineWidth to 0.

        Default: true.

        Specified by:
        isAlignTicks in interface ChartsApi
        See Also:
        Chart.isAlignTicks()
      • getAccessibility

        public Accessibility getAccessibility()
        Description copied from interface: ChartsApi
        Returns options for configuring accessibility for the chart, or create a new one.

        Requires the accessibility module to be loaded. For example,

        
         Library.setProperty("org.zkoss.chart.modules.accessibility", "true");
         
        Specified by:
        getAccessibility in interface ChartsApi
      • setAccessibility

        public void setAccessibility​(Accessibility accessibility)
        Description copied from interface: ChartsApi
        Sets options for configuring accessibility for the chart.

        Requires the accessibility module to be loaded. For example,

        
         Library.setProperty("org.zkoss.chart.modules.accessibility", "true");
         
        Specified by:
        setAccessibility in interface ChartsApi
      • isAnimation

        public boolean isAnimation()
        Description copied from interface: ChartsApi
        Returns whether enable the animation

        Default: true

        Specified by:
        isAnimation in interface ChartsApi
      • setIgnoreHiddenSeries

        public void setIgnoreHiddenSeries​(boolean ignoreHiddenSeries)
        Description copied from interface: ChartsApi
        Sets to ignore the hidden series, if true, the axes will scale to the remaining visible series once one series is hidden. If false, hiding and showing a series will not affect the axes or the other series. For stacks, once one series within the stack is hidden, the rest of the stack will close in around it even if the axis is not affected.
        Specified by:
        setIgnoreHiddenSeries in interface ChartsApi
        Parameters:
        ignoreHiddenSeries - if true, the axes will scale to the remaining visible series once one series is hidden
      • isIgnoreHiddenSeries

        public boolean isIgnoreHiddenSeries()
        Description copied from interface: ChartsApi
        Returns if true, the axes will scale to the remaining visible series once one series is hidden. If false, hiding and showing a series will not affect the axes or the other series. For stacks, once one series within the stack is hidden, the rest of the stack will close in around it even if the axis is not affected.

        Default: true.

        Specified by:
        isIgnoreHiddenSeries in interface ChartsApi
      • setBackgroundColor

        public void setBackgroundColor​(String backgroundColor)
        Description copied from interface: ChartsApi
        Sets the background color for the outer chart area.
        Specified by:
        setBackgroundColor in interface ChartsApi
        Parameters:
        backgroundColor - the background color for the outer chart area
      • setBackgroundColor

        public void setBackgroundColor​(Color color)
        Description copied from interface: ChartsApi
        Sets the background gradient for the outer chart area.
        Specified by:
        setBackgroundColor in interface ChartsApi
      • setBorderColor

        public void setBorderColor​(String borderColor)
        Description copied from interface: ChartsApi
        Sets the color of the outer chart border. The border is painted using vector graphic techniques to allow rounded corners.
        Specified by:
        setBorderColor in interface ChartsApi
      • setBorderColor

        public void setBorderColor​(LinearGradient borderColor)
        Description copied from interface: ChartsApi
        Sets the color of the outer chart border. The border is painted using vector graphic techniques to allow rounded corners.
        Specified by:
        setBorderColor in interface ChartsApi
      • setBorderColor

        public void setBorderColor​(RadialGradient borderColor)
        Description copied from interface: ChartsApi
        Sets the color of the outer chart border. The border is painted using vector graphic techniques to allow rounded corners.
        Specified by:
        setBorderColor in interface ChartsApi
      • setBorderColor

        public void setBorderColor​(Color borderColor)
        Description copied from interface: ChartsApi
        Sets the color of the outer chart border. The border is painted using vector graphic techniques to allow rounded corners.
        Specified by:
        setBorderColor in interface ChartsApi
      • getBorderColor

        public Color getBorderColor()
        Description copied from interface: ChartsApi
        Returns the color of the outer chart border. The border is painted using vector graphic techniques to allow rounded corners.

        Default: "#4572A7".

        Specified by:
        getBorderColor in interface ChartsApi
        See Also:
        Chart.getBorderColor()
      • setBorderRadius

        public void setBorderRadius​(Number borderRadius)
        Description copied from interface: ChartsApi
        Sets the corner radius of the outer chart border. In export, the radius defaults to 0.

        Default: 5.

        Specified by:
        setBorderRadius in interface ChartsApi
        Parameters:
        borderRadius - the corner radius of the outer chart border
        See Also:
        Chart.setBorderRadius(Number)
      • setBorderWidth

        public void setBorderWidth​(Number borderWidth)
        Description copied from interface: ChartsApi
        Sets the pixel width of the outer chart border. The border is painted using vector graphic techniques to allow rounded corners.
        Specified by:
        setBorderWidth in interface ChartsApi
        See Also:
        Chart.setBorderWidth(Number)
      • getBorderWidth

        public Number getBorderWidth()
        Description copied from interface: ChartsApi
        Returns the pixel width of the outer chart border. The border is painted using vector graphic techniques to allow rounded corners.

        Default: 0.

        Specified by:
        getBorderWidth in interface ChartsApi
        See Also:
        Chart.getBorderWidth()
      • setWidth

        public void setWidth​(Number width)
        Description copied from interface: ChartsApi
        Sets an explicit width for the chart. By default the width is calculated from the offset width of the containing element.
        Specified by:
        setWidth in interface ChartsApi
        Parameters:
        width - an explicit width for the chart
        See Also:
        Chart.setWidth(Number)
      • getWidth

        public Number getWidth()
        Description copied from interface: ChartsApi
        Returns an explicit width for the chart. By default the width is calculated from the offset width of the containing element.

        Default: null.

        Specified by:
        getWidth in interface ChartsApi
        See Also:
        Chart.getWidth()
      • setHeight

        public void setHeight​(Number height)
        Description copied from interface: ChartsApi
        Sets an explicit height for the chart. By default the height is calculated from the offset height of the containing element, or 400 pixels if the containing element's height is 0.
        Specified by:
        setHeight in interface ChartsApi
        Parameters:
        height - an explicit height for the chart
        See Also:
        Chart.setHeight(Number)
      • setHeight

        public void setHeight​(String height)
        Description copied from interface: ChartsApi
        Sets an explicit height for the chart. If given a percentage string (for example '56%'), the height is given as the percentage of the actual chart width. This allows for preserving the aspect ratio across responsive sizes.
        Specified by:
        setHeight in interface ChartsApi
      • getHeight

        public Number getHeight()
        Description copied from interface: ChartsApi
        Returns an explicit height for the chart. By default the height is calculated from the offset height of the containing element, or 400 pixels if the containing element's height is 0.

        Default: null.

        Specified by:
        getHeight in interface ChartsApi
        See Also:
        Chart.getHeight()
      • setInverted

        public void setInverted​(boolean inverted)
        Description copied from interface: ChartsApi
        Sets whether to invert the axes so that the x axis is vertical and y axis is horizontal. When true, the x axis is reversed by default. If a bar series is present in the chart, it will be inverted automatically.
        Specified by:
        setInverted in interface ChartsApi
        See Also:
        Chart.setInverted(boolean)
      • isInverted

        public boolean isInverted()
        Description copied from interface: ChartsApi
        Returns whether to invert the axes so that the x axis is vertical and y axis is horizontal. When true, the x axis is reversed by default. If a bar series is present in the chart, it will be inverted automatically.

        Default: false.

        Specified by:
        isInverted in interface ChartsApi
        See Also:
        Chart.isInverted()
      • setMargin

        public void setMargin​(Number margin)
        Description copied from interface: ChartsApi
        Sets the margin between the outer edge of the chart and the plot area.
        Specified by:
        setMargin in interface ChartsApi
      • setMarginBottom

        public void setMarginBottom​(Number marginBottom)
        Description copied from interface: ChartsApi
        Sets the margin between the bottom outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. See also ChartsApi.setSpacingBottom(Number).
        Specified by:
        setMarginBottom in interface ChartsApi
        Parameters:
        marginBottom - the margin between the bottom outer edge of the chart and the plot area
        See Also:
        Chart.setMarginBottom(Number)
      • setMarginLeft

        public void setMarginLeft​(Number marginLeft)
        Description copied from interface: ChartsApi
        Sets the margin between the left outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. See also ChartsApi.setSpacingLeft(Number)
        Specified by:
        setMarginLeft in interface ChartsApi
        Parameters:
        marginLeft - the margin between the left outer edge of the chart and the plot area
        See Also:
        Chart.setMarginLeft(Number)
      • setMarginRight

        public void setMarginRight​(Number marginRight)
        Description copied from interface: ChartsApi
        Sets the margin between the right outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. See also ChartsApi.setSpacingRight(Number).
        Specified by:
        setMarginRight in interface ChartsApi
        Parameters:
        marginRight - the margin between the right outer edge of the chart and the plot area
        See Also:
        Chart.setMarginRight(Number)
      • setMarginTop

        public void setMarginTop​(Number marginTop)
        Description copied from interface: ChartsApi
        Sets the margin between the top outer edge of the chart and the plot area. Use this to set a fixed pixel value for the margin as opposed to the default dynamic margin. See also ChartsApi.setSpacingTop(Number).
        Specified by:
        setMarginTop in interface ChartsApi
        Parameters:
        marginTop - the margin between the top outer edge of the chart and the plot area
        See Also:
        Chart.setMarginTop(Number)
      • getPinchType

        public String getPinchType()
        Description copied from interface: ChartsApi
        Returns equivalent to ChartsApi.getZoomType(), but for multitouch gestures only. By default, the pinchType is the same as the zoomType setting. However, pinching can be enabled separately in some cases, for example in stock charts where a mouse drag pans the chart, while pinching is enabled.

        Default: null.

        Specified by:
        getPinchType in interface ChartsApi
        See Also:
        Chart.getPinchType()
      • setPlotBackgroundColor

        public void setPlotBackgroundColor​(String plotBackgroundColor)
        Description copied from interface: ChartsApi
        Sets the background color for the plot area.
        Specified by:
        setPlotBackgroundColor in interface ChartsApi
      • setPlotBackgroundColor

        public void setPlotBackgroundColor​(Color plotBackgroundColor)
        Description copied from interface: ChartsApi
        Sets the background color for the plot area.
        Specified by:
        setPlotBackgroundColor in interface ChartsApi
      • setPlotBackgroundImage

        public void setPlotBackgroundImage​(String plotBackgroundImage)
        Description copied from interface: ChartsApi
        Sets the URL for an image to use as the plot background. To set an image as the background for the entire chart, set a CSS background image to the container element. Note that for the image to be applied to exported charts, its URL needs to be accessible by the export server.
        Specified by:
        setPlotBackgroundImage in interface ChartsApi
        Parameters:
        plotBackgroundImage - the URL for an image to use as the plot background
        See Also:
        Chart.setPlotBackgroundImage(String)
      • setPlotBorderColor

        public void setPlotBorderColor​(String plotBorderColor)
        Description copied from interface: ChartsApi
        Sets the color of the inner chart or plot area border.
        Specified by:
        setPlotBorderColor in interface ChartsApi
      • setPlotBorderColor

        public void setPlotBorderColor​(Color plotBorderColor)
        Description copied from interface: ChartsApi
        Sets the color of the inner chart or plot area border.
        Specified by:
        setPlotBorderColor in interface ChartsApi
      • setPolar

        public void setPolar​(boolean polar)
        Description copied from interface: ChartsApi
        Sets to true to enable the cartesian charts like line, spline, area and column are transformed into the polar coordinate system.
        Specified by:
        setPolar in interface ChartsApi
        Parameters:
        polar - when true, cartesian charts like line, spline, area and column are transformed into the polar coordinate system
        See Also:
        Chart.setPolar(boolean)
      • isPolar

        public boolean isPolar()
        Description copied from interface: ChartsApi
        Returns whether transforms into the polar coordinate system

        Default: false.

        Specified by:
        isPolar in interface ChartsApi
        See Also:
        Chart.isPolar()
      • isParallelCoordinates

        public boolean isParallelCoordinates()
        Description copied from interface: ChartsApi
        Returns a flag to render charts as a parallel coordinates plot. In a parallel coordinates plot (||-coords) by default all required yAxes are generated and the legend is disabled.

        Default: false

        Specified by:
        isParallelCoordinates in interface ChartsApi
      • setParallelCoordinates

        public void setParallelCoordinates​(boolean parallelCoordinates)
        Description copied from interface: ChartsApi
        Sets a flag to render charts as a parallel coordinates plot. In a parallel coordinates plot (||-coords) by default all required yAxes are generated and the legend is disabled.
        Specified by:
        setParallelCoordinates in interface ChartsApi
      • getPanKey

        public String getPanKey()
        Description copied from interface: ChartsApi
        Returns setting a key to switch between zooming and panning. Can be one of alt, ctrl, meta (the command key on Mac and Windows key on Windows) or shift. The keys are mapped directly to the key properties of the click event argument (event.altKey, event.ctrlKey, event.metaKey and event.shiftKey).

        Default: null

        Specified by:
        getPanKey in interface ChartsApi
      • setPanKey

        public void setPanKey​(String panKey)
        Description copied from interface: ChartsApi
        Sets setting a key to switch between zooming and panning. Can be one of alt, ctrl, meta (the command key on Mac and Windows key on Windows) or shift. The keys are mapped directly to the key properties of the click event argument (event.altKey, event.ctrlKey, event.metaKey and event.shiftKey).
        Specified by:
        setPanKey in interface ChartsApi
      • isPanning

        public boolean isPanning()
        Description copied from interface: ChartsApi
        Returns if allow panning in a chart. Best used with panKey to combine zooming and panning. On touch devices, when the tooltip.followTouchMove option is true (default), panning requires two fingers. To allow panning with one finger, set followTouchMove to false.

        Default: false

        Specified by:
        isPanning in interface ChartsApi
      • setPanning

        public void setPanning​(boolean panning)
        Description copied from interface: ChartsApi
        Sets if allow panning in a chart. Best used with panKey to combine zooming and panning. On touch devices, when the tooltip.followTouchMove option is true (default), panning requires two fingers. To allow panning with one finger, set followTouchMove to false.
        Specified by:
        setPanning in interface ChartsApi
      • getParallelAxes

        public ParallelAxes getParallelAxes()
        Description copied from interface: ChartsApi
        Returns common options for all yAxes rendered in a parallel coordinates plot, if any. Otherwise, create a new one.
        Specified by:
        getParallelAxes in interface ChartsApi
      • setParallelAxes

        public void setParallelAxes​(ParallelAxes parallelAxes)
        Description copied from interface: ChartsApi
        Sets common options for all yAxes rendered in a parallel coordinates plot.
        Specified by:
        setParallelAxes in interface ChartsApi
      • setReflow

        public void setReflow​(boolean reflow)
        Description copied from interface: ChartsApi
        Sets whether to reflow the chart to fit the width of the container div on resizing the window.
        Specified by:
        setReflow in interface ChartsApi
        Parameters:
        reflow - whether to reflow the chart to fit the width of the container div on resizing the window
        See Also:
        Chart.setReflow(boolean)
      • isReflow

        public boolean isReflow()
        Description copied from interface: ChartsApi
        Returns whether to reflow the chart to fit the width of the container div on resizing the window.

        Default: true.

        Specified by:
        isReflow in interface ChartsApi
        See Also:
        Chart.isReflow()
      • getResetZoomButton

        public ResetZoomButton getResetZoomButton()
        Description copied from interface: ChartsApi
        Returns the button that appears after a selection zoom, allowing the user to reset zoom.

        Default: null.

        Specified by:
        getResetZoomButton in interface ChartsApi
      • setResetZoomButton

        public void setResetZoomButton​(ResetZoomButton resetZoomButton)
        Description copied from interface: ChartsApi
        Sets the button that appears after a selection zoom, allowing the user to reset zoom.
        Specified by:
        setResetZoomButton in interface ChartsApi
        Parameters:
        resetZoomButton - the button that appears after a selection zoom, allowing the user to reset zoom
      • setSelectionMarkerFill

        public void setSelectionMarkerFill​(String selectionMarkerFill)
        Description copied from interface: ChartsApi
        Sets the background color of the marker square when selecting (zooming in on) an area of the chart.
        Specified by:
        setSelectionMarkerFill in interface ChartsApi
      • setSelectionMarkerFill

        public void setSelectionMarkerFill​(LinearGradient selectionMarkerFill)
        Description copied from interface: ChartsApi
        Sets the background color of the marker square when selecting (zooming in on) an area of the chart.
        Specified by:
        setSelectionMarkerFill in interface ChartsApi
      • setSelectionMarkerFill

        public void setSelectionMarkerFill​(RadialGradient selectionMarkerFill)
        Description copied from interface: ChartsApi
        Sets the background color of the marker square when selecting (zooming in on) an area of the chart.
        Specified by:
        setSelectionMarkerFill in interface ChartsApi
      • setSelectionMarkerFill

        public void setSelectionMarkerFill​(Color selectionMarkerFill)
        Description copied from interface: ChartsApi
        Sets the background color of the marker square when selecting (zooming in on) an area of the chart.
        Specified by:
        setSelectionMarkerFill in interface ChartsApi
      • setShadow

        public void setShadow​(boolean shadow)
        Description copied from interface: ChartsApi
        Sets whether to apply a drop shadow to the outer chart area. Requires that backgroundColor be set.
        Specified by:
        setShadow in interface ChartsApi
        Parameters:
        shadow - whether to apply a drop shadow to the outer chart area
        See Also:
        Chart.setShadow(boolean)
      • isShadow

        public boolean isShadow()
        Description copied from interface: ChartsApi
        Returns whether to apply a drop shadow to the outer chart area. Requires that backgroundColor be set.

        Default: false.

        Specified by:
        isShadow in interface ChartsApi
        See Also:
        Chart.isShadow()
      • setShowAxes

        public void setShowAxes​(boolean showAxes)
        Description copied from interface: ChartsApi
        Sets whether to show the axes initially. This only applies to empty charts where series are added dynamically, as axes are automatically added to cartesian series.
        Specified by:
        setShowAxes in interface ChartsApi
        Parameters:
        showAxes - whether to show the axes initially
        See Also:
        Chart.setShowAxes(boolean)
      • isShowAxes

        public boolean isShowAxes()
        Description copied from interface: ChartsApi
        Returns whether to show the axes initially. This only applies to empty charts where series are added dynamically, as axes are automatically added to cartesian series.

        Default: false.

        Specified by:
        isShowAxes in interface ChartsApi
        See Also:
        Chart.isShowAxes()
      • getSonification

        public Sonification getSonification()
        Description copied from interface: ChartsApi
        Returns the sonification options, if any. Otherwise, create a new one.
        Specified by:
        getSonification in interface ChartsApi
      • getSpacing

        public Number[] getSpacing()
        Description copied from interface: ChartsApi
        Returns the distance between the outer edge of the chart and the content, like title, legend, axis title or labels. The numbers in the array designate top, right, bottom and left respectively.

        Default: [10, 10, 15, 10].

        Specified by:
        getSpacing in interface ChartsApi
      • setSpacingBottom

        public void setSpacingBottom​(Number spacingBottom)
        Description copied from interface: ChartsApi
        Sets the space between the bottom edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).

        Specified by:
        setSpacingBottom in interface ChartsApi
        Parameters:
        spacingBottom - The space between the bottom edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position)
        See Also:
        Chart.setSpacingBottom(Number)
      • getSpacingBottom

        public Number getSpacingBottom()
        Description copied from interface: ChartsApi
        Returns the space between the bottom edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).

        Default: 15.

        Specified by:
        getSpacingBottom in interface ChartsApi
        See Also:
        Chart.getSpacingBottom()
      • setSpacingLeft

        public void setSpacingLeft​(Number spacingLeft)
        Description copied from interface: ChartsApi
        Sets the space between the left edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).

        Specified by:
        setSpacingLeft in interface ChartsApi
        Parameters:
        spacingLeft - The space between the left edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position)
        See Also:
        Chart.setSpacingLeft(Number)
      • getSpacingLeft

        public Number getSpacingLeft()
        Description copied from interface: ChartsApi
        Returns the space between the left edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).

        Default: 10.

        Specified by:
        getSpacingLeft in interface ChartsApi
        See Also:
        Chart.getSpacingLeft()
      • setSpacingRight

        public void setSpacingRight​(Number spacingRight)
        Description copied from interface: ChartsApi
        Sets the space between the right edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).
        Specified by:
        setSpacingRight in interface ChartsApi
        Parameters:
        spacingRight - The space between the right edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position)
        See Also:
        Chart.setSpacingRight(Number)
      • getSpacingRight

        public Number getSpacingRight()
        Description copied from interface: ChartsApi
        Returns the space between the right edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).

        Default: 10.

        Specified by:
        getSpacingRight in interface ChartsApi
        See Also:
        Chart.getSpacingRight()
      • setSpacingTop

        public void setSpacingTop​(Number spacingTop)
        Description copied from interface: ChartsApi
        Sets the space between the top edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).
        Specified by:
        setSpacingTop in interface ChartsApi
        Parameters:
        spacingTop - The space between the top edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position)
        See Also:
        Chart.setSpacingTop(Number)
      • getSpacingTop

        public Number getSpacingTop()
        Description copied from interface: ChartsApi
        Returns the space between the top edge of the chart and the content (plot area, axis title and labels, title, subtitle or legend in top position).

        Default: 10.

        Specified by:
        getSpacingTop in interface ChartsApi
        See Also:
        Chart.getSpacingTop()
      • setStyle

        public void setStyle​(String style)
        Description copied from interface: ChartsApi
        Sets additional CSS styles to apply inline to the container div. Note that since the default font styles are applied in the renderer, it is ignorant of the individual chart options and must be set globally.

        This method allows simple settings like

        
         label.setStyle("fontWeight: 'bold'; color: 'white'; textShadow: '0px 1px 2px black'");
         

        In the format of CSS key:value, and ";" separating multiple key:value pairs, if you have more a complex CSS styling, we recommend using ChartsApi.setStyle(Map)

        Specified by:
        setStyle in interface ChartsApi
        Parameters:
        style - one or many CSS key:value pairs in a single line string format
      • setStyle

        public <K,​V> void setStyle​(Map<K,​V> style)
        Description copied from interface: ChartsApi
        Sets additional CSS styles to apply inline to the container div. Note that since the default font styles are applied in the renderer, it is ignorant of the individual chart options and must be set globally.

        This method allows complex styling like:

         
         Map<String, Object> styles = new HashMap<String, Object>();
         styles.put("fill", "#E8E8EA");
         styles.put("stroke", "#6E6E78");
         styles.put("stroke-width", "1");
         styles.put("r", "0");
         Map<String, Object> states = new HashMap<String, Object>();
         Map<String, String> hover = new HashMap<String, String>();
         hover.put("fill", "#F4F4F6");
         hover.put("stroke", "#6E6E78");
         hover.put("stroke-width", "1");
         hover.put("r", "0");
         states.put("hover", hover);
         styles.put("states", states);
         Map<String, String> style = new HashMap<String, String>();
         style.put("color", "#4D5663");
         style.put("fontSize", "12px");
         style.put("fontFamily", "'Arial'");
         style.put("fontWeight", "normal");
         style.put("padding", "10px");
         styles.put("style", style);
         
        which will generate the final results like:
        
         {
             "fill": "#E8E8EA",
             "stroke": "#6E6E78",
             "stroke-width": "1",
             "r": "0",
             "states":
             {
                 "hover":
                 {
                     "fill": "#F4F4F6",
                     "stroke": "#6E6E78",
                     "stroke-width": "1",
                     "r": "0"
                 }
             },
             "style":
             {
                 "color": "#4D5663",
                 "fontSize": "12px",
                 "fontFamily": "'Arial'",
                 "fontWeight": "normal",
                 "padding": "10px"
             }
         }
         
        Specified by:
        setStyle in interface ChartsApi
        Type Parameters:
        K - Type for the key, usually String
        V - Type for the value, usually String. For nested maps, use Object or any other type.
        Parameters:
        style - the style object
      • getStyle

        public <K,​V> Map<K,​V> getStyle()
        Description copied from interface: ChartsApi
        Returns additional CSS styles to apply inline to the container div. Note that since the default font styles are applied in the renderer, it is ignorant of the individual chart options and must be set globally. Defaults to:
         fontFamily: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif; fontSize: 12px
         

        Specified by:
        getStyle in interface ChartsApi
        Type Parameters:
        K - type for the key

        if style was set using ChartsApi.setStyle(String), type will be String

        if style was set using ChartsApi.setStyle(Map), type will be the same as the type from the key of the map

        if style was not set, default style will be applied, and type will be String

        V - type for the value

        if style was set using ChartsApi.setStyle(String), type will be String

        if style was set using ChartsApi.setStyle(Map), type will be the same as the type from the key of the map

        if style was not set, default style will be applied, and type will be String

      • isStyledMode

        public boolean isStyledMode()
        Description copied from interface: ChartsApi
        Returns whether to apply styled mode. When in styled mode, no presentational attributes or CSS are applied to the chart SVG. Instead, CSS rules are required to style the chart. The default style sheet is available from highcharts.css.

        Default: false

        Specified by:
        isStyledMode in interface ChartsApi
      • setStyledMode

        public void setStyledMode​(boolean styledMode)
        Description copied from interface: ChartsApi
        Sets whether to apply styled mode. When in styled mode, no presentational attributes or CSS are applied to the chart SVG. Instead, CSS rules are required to style the chart. The default style sheet is available from highcharts.css.

        Default: false

        Specified by:
        setStyledMode in interface ChartsApi
      • setZoomType

        public void setZoomType​(String zoomType)
        Description copied from interface: ChartsApi
        Sets decides in what dimentions the user can zoom by dragging the mouse. Can be one of x, y or xy.
        Specified by:
        setZoomType in interface ChartsApi
        Parameters:
        zoomType - decides in what dimentions the user can zoom by dragging the mouse
        See Also:
        Chart.setZoomType(String)
      • getZoomType

        public String getZoomType()
        Description copied from interface: ChartsApi
        Returns decides in what dimentions the user can zoom by dragging the mouse. Can be one of x, y or xy.

        Default: null.

        Specified by:
        getZoomType in interface ChartsApi
        See Also:
        Chart.getZoomType()
      • getEventsMap

        public Map<String,​org.zkoss.json.JavaScriptValue> getEventsMap()
        Description copied from interface: ChartsApi
        Returns a map of client side event listeners for the chart.
        Specified by:
        getEventsMap in interface ChartsApi
      • setEvents

        public void setEvents​(Map<String,​org.zkoss.json.JavaScriptValue> events)
        Description copied from interface: ChartsApi
        Sets a map of client side event listeners for the chart.
        Specified by:
        setEvents in interface ChartsApi
      • addEvent

        public void addEvent​(String name,
                             org.zkoss.json.JavaScriptValue event)
        Description copied from interface: ChartsApi
        Sets a client side event for the chart.
        Specified by:
        addEvent in interface ChartsApi
      • smartDrawChart

        protected void smartDrawChart()
        mark a draw flag to inform that this Chart needs update.
      • getTooltip

        public Tooltip getTooltip()
        Description copied from interface: ChartsApi
        Returns the Tooltip options, if any. Otherwise, create a new one.
        Specified by:
        getTooltip in interface ChartsApi
        See Also:
        Tooltip
      • setTooltip

        public void setTooltip​(Tooltip tooltip)
        Description copied from interface: ChartsApi
        Sets the Tooltip options
        Specified by:
        setTooltip in interface ChartsApi
      • getChart

        public Chart getChart()
        Description copied from interface: ChartsApi
        Returns the Chart options, if any. Otherwise, create a new one.
        Specified by:
        getChart in interface ChartsApi
        See Also:
        Chart
      • setNoData

        public void setNoData​(NoData noData)
        Description copied from interface: ChartsApi
        Sets the no-data options
        Specified by:
        setNoData in interface ChartsApi
      • setCredits

        public void setCredits​(Credits credits)
        Description copied from interface: ChartsApi
        Sets the Credits options
        Specified by:
        setCredits in interface ChartsApi
      • getCredits

        public Credits getCredits()
        Description copied from interface: ChartsApi
        Returns the Credits options, if any. Otherwise, create a new one.
        Specified by:
        getCredits in interface ChartsApi
        See Also:
        Credits
      • setChart

        public void setChart​(Chart chart)
        Description copied from interface: ChartsApi
        Sets the Chart options
        Specified by:
        setChart in interface ChartsApi
      • getPane

        public Pane getPane()
        Description copied from interface: ChartsApi
        Returns the pane at the index 0
        Specified by:
        getPane in interface ChartsApi
      • getPane

        public Pane getPane​(int index)
        Description copied from interface: ChartsApi
        Returns the pane from the given index
        Specified by:
        getPane in interface ChartsApi
      • getPaneSize

        public int getPaneSize()
        Description copied from interface: ChartsApi
        Returns the size of the pane list
        Specified by:
        getPaneSize in interface ChartsApi
      • getLegend

        public Legend getLegend()
        Description copied from interface: ChartsApi
        Returns the Legend options, if any. Otherwise, create a new one.
        Specified by:
        getLegend in interface ChartsApi
        See Also:
        Legend
      • getLoading

        public Loading getLoading()
        Description copied from interface: ChartsApi
        Returns the Loading options, if any. Otherwise, create a new one.
        Specified by:
        getLoading in interface ChartsApi
        See Also:
        Loading
      • setLegend

        public void setLegend​(Legend legend)
        Description copied from interface: ChartsApi
        Sets the Legend options
        Specified by:
        setLegend in interface ChartsApi
      • setLabels

        public void setLabels​(Labels labels)
        Description copied from interface: ChartsApi
        Sets the labels options
        Specified by:
        setLabels in interface ChartsApi
      • getLang

        public Lang getLang()
        Description copied from interface: ChartsApi
        Returns the lang options
        Specified by:
        getLang in interface ChartsApi
      • setLang

        public void setLang​(Lang lang)
        Description copied from interface: ChartsApi
        Sets the lang options
        Specified by:
        setLang in interface ChartsApi
      • addSeries

        public void addSeries​(Series series)
        Description copied from interface: ChartsApi
        Add a series to the chart after render time. Note that this method should never be used when adding data synchronously at chart render time, as it adds expense to the calculations and rendering. When adding data at the same time as the chart is initiated, add the series as a configuration option instead.
        Specified by:
        addSeries in interface ChartsApi
      • addAxis

        public void addAxis​(Axis axis)
        Description copied from interface: ChartsApi
        Add an axis to the chart after render time. Note that this method should never be used when adding data synchronously at chart render time, as it adds expense to the calculations and rendering. When adding data at the same time as the chart is initiated, add the axis as a configuration option instead.
        Specified by:
        addAxis in interface ChartsApi
      • getSeriesSize

        public int getSeriesSize()
        Description copied from interface: ChartsApi
        Returns the size of series
        Specified by:
        getSeriesSize in interface ChartsApi
      • getSeries

        public Series getSeries​(int index)
        Description copied from interface: ChartsApi
        Returns the Series options from the given index, if any. Otherwise, create a new one.
        Specified by:
        getSeries in interface ChartsApi
        See Also:
        Series
      • getXAxis

        public XAxis getXAxis​(int index)
        Description copied from interface: ChartsApi
        Returns the XAxis options from the given index, if any. Otherwise, create a new one.
        Specified by:
        getXAxis in interface ChartsApi
        See Also:
        XAxis
      • getXAxisSize

        public int getXAxisSize()
        Description copied from interface: ChartsApi
        Returns the size of xAxis
        Specified by:
        getXAxisSize in interface ChartsApi
      • setXAxis

        public void setXAxis​(XAxis xaxis)
        Description copied from interface: ChartsApi
        Sets the xAxis with out putting it in an Array
        Specified by:
        setXAxis in interface ChartsApi
      • getYAxis

        public YAxis getYAxis​(int index)
        Description copied from interface: ChartsApi
        Returns the YAxis options from the given index, if any. Otherwise, create a new one.
        Specified by:
        getYAxis in interface ChartsApi
        See Also:
        YAxis
      • getyAxisSize

        public int getyAxisSize()
        Description copied from interface: ChartsApi
        Returns the size of yAxis
        Specified by:
        getyAxisSize in interface ChartsApi
      • getYAxisSize

        public int getYAxisSize()
        Description copied from interface: ChartsApi
        Returns the size of yAxis
        Specified by:
        getYAxisSize in interface ChartsApi
      • setYAxis

        public void setYAxis​(YAxis yaxis)
        Description copied from interface: ChartsApi
        Sets the yAxis with out putting it in an Array
        Specified by:
        setYAxis in interface ChartsApi
      • getZAxis

        public ZAxis getZAxis​(int index)
        Description copied from interface: ChartsApi
        Returns the ZAxis options from the given index, if any. Otherwise, create a new one.
        Specified by:
        getZAxis in interface ChartsApi
        See Also:
        ZAxis
      • getzAxisSize

        public int getzAxisSize()
        Description copied from interface: ChartsApi
        Returns the size of zAxis
        Specified by:
        getzAxisSize in interface ChartsApi
      • setZAxis

        public void setZAxis​(ZAxis zaxis)
        Description copied from interface: ChartsApi
        Sets the zAxis with out putting it in an Array
        Specified by:
        setZAxis in interface ChartsApi
      • getOptions3D

        public Options3D getOptions3D()
        Description copied from interface: ChartsApi
        Returns the options to render charts in 3 dimensions.

        Default: null.

        Specified by:
        getOptions3D in interface ChartsApi
      • setOptions3D

        public void setOptions3D​(Options3D options3D)
        Description copied from interface: ChartsApi
        Sets the options to render charts in 3 dimensions.
        Specified by:
        setOptions3D in interface ChartsApi
        Parameters:
        options3D - the options to render charts in 3 dimensions.
      • setTitle

        public void setTitle​(String title)
        Description copied from interface: ChartsApi
        Sets the chart title.
        Specified by:
        setTitle in interface ChartsApi
      • setTitle

        public void setTitle​(Title title)
        Description copied from interface: ChartsApi
        Sets the Title options
        Specified by:
        setTitle in interface ChartsApi
      • getTitle

        public Title getTitle()
        Description copied from interface: ChartsApi
        Returns the Title options, if any. Otherwise, create a new one.
        Specified by:
        getTitle in interface ChartsApi
        See Also:
        Title
      • getSubtitle

        public Subtitle getSubtitle()
        Description copied from interface: ChartsApi
        Returns the Subtitle options, if any. Otherwise, create a new one.
        Specified by:
        getSubtitle in interface ChartsApi
        See Also:
        Subtitle
      • setSubtitle

        public void setSubtitle​(String subtitle)
        Description copied from interface: ChartsApi
        Sets the chart subtitle
        Specified by:
        setSubtitle in interface ChartsApi
      • setSubtitle

        public void setSubtitle​(Subtitle subtitle)
        Description copied from interface: ChartsApi
        Sets the Subtitle options
        Specified by:
        setSubtitle in interface ChartsApi
      • toJSON

        public String toJSON()
        Gets the JSON result.
        Returns:
        JSON string
      • getAnnotation

        public Annotation getAnnotation​(int index)
        Description copied from interface: ChartsApi
        Returns the Annotation options from the given index, if any. Otherwise, create a new one.

        Specified by:
        getAnnotation in interface ChartsApi
        See Also:
        Annotation
      • getAnnotationSize

        public int getAnnotationSize()
        Description copied from interface: ChartsApi
        Returns the size of annotations
        Specified by:
        getAnnotationSize in interface ChartsApi
      • addAnnotation

        public void addAnnotation​(Annotation annotation)
        Description copied from interface: ChartsApi
        Add an annotation to the chart after render time. Note that this method should never be used when adding data synchronously at chart render time, as it adds expense to the calculations and rendering. When adding data at the same time as the chart is initiated, add the annotation as a configuration option instead.
        Specified by:
        addAnnotation in interface ChartsApi
      • setCaption

        public void setCaption​(String caption)
        Description copied from interface: ChartsApi
        Sets the chart caption.
        Specified by:
        setCaption in interface ChartsApi
      • setCaption

        public void setCaption​(Caption caption)
        Description copied from interface: ChartsApi
        Sets the Caption option.
        Specified by:
        setCaption in interface ChartsApi
      • getCaption

        public Caption getCaption()
        Description copied from interface: ChartsApi
        Returns the Caption options, if any. Otherwise, create a new one.
        Specified by:
        getCaption in interface ChartsApi
        See Also:
        Caption
      • getResponsive

        public Responsive getResponsive()
        Description copied from interface: ChartsApi
        Returns a set of rules to apply for different screen or chart sizes. Each rule specifies additional chart options.
        Specified by:
        getResponsive in interface ChartsApi
      • setResponsive

        public void setResponsive​(Responsive responsive)
        Description copied from interface: ChartsApi
        Sets a set of rules to apply for different screen or chart sizes. Each rule specifies additional chart options.
        Specified by:
        setResponsive in interface ChartsApi