Class AbstractChartWidget<C extends IsChart>

    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

        com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
      • Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets

        com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
    • Field Summary

      • Fields inherited from class com.google.gwt.user.client.ui.UIObject

        DEBUG_ID_PREFIX
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractChartWidget​(C chart)
      Creates a chart widget for GWT by chart element instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      HandlerRegistration addHandler​(EventHandler handler, EventType type)
      Adds this handler to the widget.
      void checkAxes​(Axis... axes)
      Checks if axes, requested to be stored, are an acceptable type or amount.
      If a axis type or the amount of axes are not consistent for the chart, a IllegalArgumentException will be thrown.
      void checkDatasets​(Dataset... datasets)
      Checks if datasets, requested to be stored, are an acceptable type or amount.
      If a dataset type or the amount of datasets are not consistent for the chart, a IllegalArgumentException will be thrown.
      void createAndSetTimer​(ChartTimerTask task, int interval)
      Creates a CTimer instance inside chart.
      It can be created only once during the life cycle of the chart.
      void destroy()
      Use this to destroy any chart instances that are created.
      void draw()
      Draws the chart
      void fireEvent​(Event event)
      Fires the event to the handlers.
      List<ActiveDatasetElement> getActiveElements()
      Returns the active (hovered) elements for the chart.
      Type getBaseType()
      Returns the base type of chart that in case of ChartType is the same of IsChart.getType() otherwise, in case the type of the chart is a ControllerType is the chart type extension if there is or null.
      Canvas getCanvas()
      Returns the canvas element used to draw the chart.
      C getChart()
      Returns the chart instance, wrapped by this GWT widget.
      Div getChartElement()
      Gets a handle to the object's underlying DOM element.
      Data getData()
      Returns the data object with all passed datasets.
      List<DatasetReference> getDatasetAtEvent​(BaseNativeEvent event)
      Looks for the dataset that matches the event.
      DatasetItem getDatasetItem​(int index)
      Looks for the dataset that matches the current index and returns.
      IsDefaultScaledOptions getDefaultChartOptions()
      Returns the default options created based on chart type.
      int getDrawCount()
      Returns the draw count of the chart.
      DatasetReference getElementAtEvent​(BaseNativeEvent event)
      Calling on your chart instance passing an argument of an event, will return the single element at the event position.
      If there are multiple items within range, only the first is returned.
      List<DatasetReference> getElementsAtEvent​(BaseNativeEvent event)
      Looks for the element under the event point, then returns all elements at the same data index.
      Calling it on your chart instance passing an argument of an event, will return the point elements that are at that the same position of that event.
      int getHandlerCount​(EventType type)
      Returns the amount of handlers for a specific event type.
      String getId()
      Returns the ID of chart.
      It could be considered as chart unique ID.
      CursorType getInitialCursor()
      Returns the initial cursor of the chart.
      ChartNode getNode()
      Returns the chart node with runtime data.
      Plugins getPlugins()
      Returns the plugins element to manage inline plugins.
      CTimer getTimer()
      Returns a CTimer instance inside chart.
      List<ActiveDatasetElement> getTooltipActiveElements()
      Returns the active tooltip elements for the chart.
      Type getType()
      Returns the type of chart.
      int getVisibleDatasetCount()
      Returns the amount of datasets which are visible
      IsDefaultScaledOptions getWholeOptions()
      Returns the default options by a chart instance, merging global, chart type global and chart options.
      void hide​(int datasetIndex)
      Sets the visibility for the given dataset to false.
      Updates the chart and animates the dataset with 'hide' mode.
      This animation can be configured under the hide key in animation options.
      void hide​(int datasetIndex, int dataIndex)
      Sets the hidden flag of that element index to true and updates the chart.
      boolean isChartAttached()
      Returns true whether this chart is currently attached to the browser's document.
      boolean isDatasetVisible​(int index)
      Looks for the dataset if it's visible or not, selected by index.
      boolean isDataVisible​(int index)
      Returns the stored visibility state of an data index for all datasets.
      boolean isDestroyOnDetach()
      Returns true if the chart is configured to be destroyed on the attach of DIV element, otherwise false.
      boolean isDrawOnAttach()
      Returns true if the chart is configured to be drawn on the attach of DIV element, otherwise false.
      boolean isEventHandled​(EventType type)
      Returns true if there is any event handler for event type passed as argument.
      boolean isInitialized()
      Returns true if CHART.JS chart has been initialized, otherwise false.
      void reconfigure()
      Triggers an update of the chart.
      This can be safely called after updating the data object.
      This will update the options, mutating the options property in place.
      void reconfigure​(TransitionKey mode)
      Triggers an update of the chart.
      This can be safely called after updating the data object.
      This will update the options, mutating the options property in place.
      A animation mode key can be provided for the update process using a specific animation configuration.
      This is useful when update is manually called inside an event handler and some different animation is desired.
      void reconfigure​(UpdateConfiguration config)
      Triggers an update of the chart.
      This can be safely called after updating the data object.
      This will update the options, mutating the options property in place.
      A configuration object can be provided with additional configuration for the update process.
      This is useful when update is manually called inside an event handler and some different animation is desired.
      void removeCanvasPreventDefault()
      Remove the registration of prevent default mouse listener from canvas.
      This is necessary when you will add your mouse down listener.
      void render()
      Triggers a redraw of all chart elements.
      Note, this does not update elements for new data.
      void reset()
      Reset the chart to it's state before the initial animation.
      void resetActiveElements()
      Resets the active (hovered) elements for the chart.
      void resetTooltipActiveElements()
      Resets the active tooltip elements for the chart.
      void resize()
      Use this to manually resize the canvas element.
      void resize​(int width, int height)
      Use this to manually resize the canvas element.
      This is run each time the canvas container is resized, but can be called this method manually if you change the size of the canvas nodes container element.
      void setActiveElements​(List<ActiveDatasetElement> elements)
      Sets the active (hovered) elements for the chart.
      void setActiveElements​(ActiveDatasetElement... elements)
      Sets the active (hovered) elements for the chart.
      void setDatasetVisibility​(int datasetIndex, boolean visibility)
      Sets the visibility for a given dataset.
      This can be used to build a chart legend in HTML.
      During click on one of the HTML items, you can call it to change the appropriate dataset.
      void setDestroyOnDetach​(boolean destroyOnDetach)
      Sets true if the chart is configured to be destroyed on the attach of DIV element, otherwise false.
      void setDrawOnAttach​(boolean drawOnAttach)
      Sets true if the chart is configured to be draw on the attach of DIV element, otherwise false.
      void setTooltipActiveElements​(List<ActiveDatasetElement> elements)
      Sets the active tooltip elements for the chart.
      void setTooltipActiveElements​(IsPoint point, List<ActiveDatasetElement> elements)
      Sets the active tooltip elements for the chart.
      void setTooltipActiveElements​(IsPoint point, ActiveDatasetElement... elements)
      Sets the active tooltip elements for the chart.
      void setTooltipActiveElements​(ActiveDatasetElement... elements)
      Sets the active tooltip elements for the chart.
      void show​(int datasetIndex)
      Sets the visibility for the given dataset to true.
      Updates the chart and animates the dataset with 'show' mode.
      This animation can be configured under the show key in animation options.
      void show​(int datasetIndex, int dataIndex)
      Sets the hidden flag of that element index to false and updates the chart.
      void stop()
      Use this to stop any current animation loop.
      String toBase64Image​(ImageMimeType type, double encoderOptions)
      Returns a base 64 encoded string of the chart in it's current state.
      void toggleDataVisibility​(int index)
      Toggles the visibility of an item in all datasets.
      A dataset needs to explicitly support this feature for it to have an effect.
      From internal chart types, doughnut / pie and polar area use this.
      void update()
      Triggers an update of the chart.
      This can be safely called after updating the data object.
      This will update all scales, legends, and then re-render the chart.
      void update​(TransitionKey mode)
      Triggers an update of the chart.
      This can be safely called after updating the data object.
      This will update all scales, legends, and then re-render the chart.
      A config object can be provided with additional configuration for the update process.
      This is useful when update is manually called inside an event handler and some different animation is desired.
      void update​(UpdateConfiguration config)
      Triggers an update of the chart.
      This can be safely called after updating the data object.
      This will update all scales, legends, and then re-render the chart.
      A config object can be provided with additional configuration for the update process.
      This is useful when update is manually called inside an event handler and some different animation is desired.
      • Methods inherited from class com.google.gwt.user.client.ui.SimplePanel

        add, getContainerElement, getWidget, iterator, remove, setWidget, setWidget
      • Methods inherited from class com.google.gwt.user.client.ui.Panel

        add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
      • Methods inherited from class com.google.gwt.user.client.ui.Widget

        addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
      • Methods inherited from class com.google.gwt.user.client.ui.UIObject

        addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
    • Constructor Detail

      • AbstractChartWidget

        protected AbstractChartWidget​(C chart)
        Creates a chart widget for GWT by chart element instance.
        Parameters:
        chart - chart instance to wrap by the widget
    • Method Detail

      • getChart

        public final C getChart()
        Returns the chart instance, wrapped by this GWT widget.
        Returns:
        the chart instance, wrapped by this GWT widget
      • fireEvent

        public final void fireEvent​(Event event)
        Description copied from interface: IsChart
        Fires the event to the handlers.
        Specified by:
        fireEvent in interface IsChart
        Parameters:
        event - the event to fire
      • addHandler

        public final HandlerRegistration addHandler​(EventHandler handler,
                                                    EventType type)
        Description copied from interface: IsChart
        Adds this handler to the widget.
        Specified by:
        addHandler in interface IsChart
        Parameters:
        handler - the handler
        type - the event type
        Returns:
        handler registration used to remove the handler
      • getHandlerCount

        public int getHandlerCount​(EventType type)
        Description copied from interface: IsChart
        Returns the amount of handlers for a specific event type.
        Specified by:
        getHandlerCount in interface IsChart
        Parameters:
        type - event type to use to get the amount of handlers
        Returns:
        the amount of handlers for a specific event type
      • isEventHandled

        public boolean isEventHandled​(EventType type)
        Description copied from interface: IsChart
        Returns true if there is any event handler for event type passed as argument.
        Specified by:
        isEventHandled in interface IsChart
        Parameters:
        type - event type to check
        Returns:
        true if there is any event handler for event type passed as argument
      • getChartElement

        public final Div getChartElement()
        Description copied from interface: IsChart
        Gets a handle to the object's underlying DOM element.
        Specified by:
        getChartElement in interface IsChart
        Returns:
        the object's browser element
      • isChartAttached

        public final boolean isChartAttached()
        Description copied from interface: IsChart
        Returns true whether this chart is currently attached to the browser's document.
        Specified by:
        isChartAttached in interface IsChart
        Returns:
        true whether this chart is currently attached to the browser's document
      • getType

        public final Type getType()
        Description copied from interface: IsChart
        Returns the type of chart.
        Specified by:
        getType in interface IsChart
        Returns:
        the type of chart.
      • getBaseType

        public final Type getBaseType()
        Description copied from interface: IsChart
        Returns the base type of chart that in case of ChartType is the same of IsChart.getType() otherwise, in case the type of the chart is a ControllerType is the chart type extension if there is or null.
        Specified by:
        getBaseType in interface IsChart
        Returns:
        the base type of chart.
      • getId

        public final String getId()
        Description copied from interface: IsChart
        Returns the ID of chart.
        It could be considered as chart unique ID.
        Specified by:
        getId in interface IsChart
        Returns:
        the ID of chart
      • getDrawCount

        public int getDrawCount()
        Description copied from interface: IsChart
        Returns the draw count of the chart.
        Specified by:
        getDrawCount in interface IsChart
        Returns:
        the draw count of the chart
      • getCanvas

        public final Canvas getCanvas()
        Description copied from interface: IsChart
        Returns the canvas element used to draw the chart.
        Specified by:
        getCanvas in interface IsChart
        Returns:
        the canvas
      • removeCanvasPreventDefault

        public final void removeCanvasPreventDefault()
        Description copied from interface: IsChart
        Remove the registration of prevent default mouse listener from canvas.
        This is necessary when you will add your mouse down listener.
        Specified by:
        removeCanvasPreventDefault in interface IsChart
      • getInitialCursor

        public final CursorType getInitialCursor()
        Description copied from interface: IsChart
        Returns the initial cursor of the chart.
        Specified by:
        getInitialCursor in interface IsChart
        Returns:
        the initial cursor of the chart.
      • isInitialized

        public final boolean isInitialized()
        Description copied from interface: IsChart
        Returns true if CHART.JS chart has been initialized, otherwise false.
        Specified by:
        isInitialized in interface IsChart
        Returns:
        true if CHART.JS chart has been initialized, otherwise false.
      • getNode

        public final ChartNode getNode()
        Description copied from interface: IsChart
        Returns the chart node with runtime data.
        Specified by:
        getNode in interface IsChart
        Returns:
        the chart node.
      • getData

        public final Data getData()
        Description copied from interface: IsChart
        Returns the data object with all passed datasets.
        Specified by:
        getData in interface IsChart
        Returns:
        the data configuration object
      • getPlugins

        public final Plugins getPlugins()
        Description copied from interface: IsChart
        Returns the plugins element to manage inline plugins.
        Specified by:
        getPlugins in interface IsChart
        Returns:
        the plugins configuration object
      • getDefaultChartOptions

        public final IsDefaultScaledOptions getDefaultChartOptions()
        Description copied from interface: IsChart
        Returns the default options created based on chart type.
        Specified by:
        getDefaultChartOptions in interface IsChart
        Returns:
        the default options of the chart
      • getWholeOptions

        public final IsDefaultScaledOptions getWholeOptions()
        Description copied from interface: IsChart
        Returns the default options by a chart instance, merging global, chart type global and chart options.
        Specified by:
        getWholeOptions in interface IsChart
        Returns:
        the default options by a chart instance, merging global, chart type global and chart options
      • getTimer

        public final CTimer getTimer()
        Description copied from interface: IsChart
        Returns a CTimer instance inside chart.
        Specified by:
        getTimer in interface IsChart
        Returns:
        the timer instance of the chart
      • createAndSetTimer

        public final void createAndSetTimer​(ChartTimerTask task,
                                            int interval)
        Description copied from interface: IsChart
        Creates a CTimer instance inside chart.
        It can be created only once during the life cycle of the chart.
        Specified by:
        createAndSetTimer in interface IsChart
        Parameters:
        task - the task to be executed repeatedly
        interval - the time, in milliseconds (thousands of a second), the timer should delay in between executions of the specified task.
        Must be greater than 0.
      • isDrawOnAttach

        public final boolean isDrawOnAttach()
        Description copied from interface: IsChart
        Returns true if the chart is configured to be drawn on the attach of DIV element, otherwise false.
        Specified by:
        isDrawOnAttach in interface IsChart
        Returns:
        the drawOnAttach true if the chart is configured to be drawn on the attach of DIV element, otherwise false.
      • setDrawOnAttach

        public final void setDrawOnAttach​(boolean drawOnAttach)
        Description copied from interface: IsChart
        Sets true if the chart is configured to be draw on the attach of DIV element, otherwise false.
        Specified by:
        setDrawOnAttach in interface IsChart
        Parameters:
        drawOnAttach - the drawOnAttach to set
      • isDestroyOnDetach

        public final boolean isDestroyOnDetach()
        Description copied from interface: IsChart
        Returns true if the chart is configured to be destroyed on the attach of DIV element, otherwise false.
        Specified by:
        isDestroyOnDetach in interface IsChart
        Returns:
        the destroyOnDetach true if the chart is configured to be destroyed on the attach of DIV element, otherwise false.
      • setDestroyOnDetach

        public final void setDestroyOnDetach​(boolean destroyOnDetach)
        Description copied from interface: IsChart
        Sets true if the chart is configured to be destroyed on the attach of DIV element, otherwise false.
        Specified by:
        setDestroyOnDetach in interface IsChart
        Parameters:
        destroyOnDetach - the destroyOnDetach to set
      • setActiveElements

        public void setActiveElements​(List<ActiveDatasetElement> elements)
        Description copied from interface: IsChart
        Sets the active (hovered) elements for the chart.
        Specified by:
        setActiveElements in interface IsChart
        Parameters:
        elements - list of active elements
      • setActiveElements

        public void setActiveElements​(ActiveDatasetElement... elements)
        Description copied from interface: IsChart
        Sets the active (hovered) elements for the chart.
        Specified by:
        setActiveElements in interface IsChart
        Parameters:
        elements - array of active elements
      • resetActiveElements

        public void resetActiveElements()
        Description copied from interface: IsChart
        Resets the active (hovered) elements for the chart.
        Specified by:
        resetActiveElements in interface IsChart
      • setTooltipActiveElements

        public void setTooltipActiveElements​(List<ActiveDatasetElement> elements)
        Description copied from interface: IsChart
        Sets the active tooltip elements for the chart.
        Specified by:
        setTooltipActiveElements in interface IsChart
        Parameters:
        elements - list of active tooltip elements
      • setTooltipActiveElements

        public void setTooltipActiveElements​(ActiveDatasetElement... elements)
        Description copied from interface: IsChart
        Sets the active tooltip elements for the chart.
        Specified by:
        setTooltipActiveElements in interface IsChart
        Parameters:
        elements - array of active tooltip elements
      • setTooltipActiveElements

        public void setTooltipActiveElements​(IsPoint point,
                                             List<ActiveDatasetElement> elements)
        Description copied from interface: IsChart
        Sets the active tooltip elements for the chart.
        Specified by:
        setTooltipActiveElements in interface IsChart
        Parameters:
        point - synthetic event position used in positioning
        elements - list of active tooltip elements
      • setTooltipActiveElements

        public void setTooltipActiveElements​(IsPoint point,
                                             ActiveDatasetElement... elements)
        Description copied from interface: IsChart
        Sets the active tooltip elements for the chart.
        Specified by:
        setTooltipActiveElements in interface IsChart
        Parameters:
        point - synthetic event position used in positioning
        elements - array of active tooltip elements
      • resetTooltipActiveElements

        public void resetTooltipActiveElements()
        Description copied from interface: IsChart
        Resets the active tooltip elements for the chart.
        Specified by:
        resetTooltipActiveElements in interface IsChart
      • destroy

        public final void destroy()
        Description copied from interface: IsChart
        Use this to destroy any chart instances that are created. This will clean up any references stored to the chart object within Chart.js, along with any associated event listeners attached by Chart.js.
        Specified by:
        destroy in interface IsChart
      • stop

        public final void stop()
        Description copied from interface: IsChart
        Use this to stop any current animation loop. This will pause the chart during any current animation frame. Call .render() to re-animate.
        Specified by:
        stop in interface IsChart
      • reset

        public final void reset()
        Description copied from interface: IsChart
        Reset the chart to it's state before the initial animation. A new animation can then be triggered using update.
        Specified by:
        reset in interface IsChart
      • toBase64Image

        public String toBase64Image​(ImageMimeType type,
                                    double encoderOptions)
        Description copied from interface: IsChart
        Returns a base 64 encoded string of the chart in it's current state.
        Specified by:
        toBase64Image in interface IsChart
        Parameters:
        type - indicating the image format
        encoderOptions - between 0 and 1 indicating the image quality to use for image formats that use lossy compression.
        If this argument is anything else, the default value for image quality is used. The default value is 0.92.
        Returns:
        base 64 image or Undefined.STRING if chart is not initialized.
      • resize

        public final void resize()
        Description copied from interface: IsChart
        Use this to manually resize the canvas element. This is run each time the canvas container is resized, but can be called this method manually if you change the size of the canvas nodes container element.
        Specified by:
        resize in interface IsChart
      • resize

        public void resize​(int width,
                           int height)
        Description copied from interface: IsChart
        Use this to manually resize the canvas element.
        This is run each time the canvas container is resized, but can be called this method manually if you change the size of the canvas nodes container element.
        Specified by:
        resize in interface IsChart
        Parameters:
        width - width size of resize
        height - height size of resize
      • update

        public final void update()
        Description copied from interface: IsChart
        Triggers an update of the chart.
        This can be safely called after updating the data object.
        This will update all scales, legends, and then re-render the chart.
        Specified by:
        update in interface IsChart
      • update

        public final void update​(TransitionKey mode)
        Description copied from interface: IsChart
        Triggers an update of the chart.
        This can be safely called after updating the data object.
        This will update all scales, legends, and then re-render the chart.
        A config object can be provided with additional configuration for the update process.
        This is useful when update is manually called inside an event handler and some different animation is desired.
        Specified by:
        update in interface IsChart
        Parameters:
        mode - an animation mode can be provided to indicate what should be updated and what animation configuration should be used
      • update

        public final void update​(UpdateConfiguration config)
        Description copied from interface: IsChart
        Triggers an update of the chart.
        This can be safely called after updating the data object.
        This will update all scales, legends, and then re-render the chart.
        A config object can be provided with additional configuration for the update process.
        This is useful when update is manually called inside an event handler and some different animation is desired.
        Specified by:
        update in interface IsChart
        Parameters:
        config - a config object can be provided with additional configuration for the update process
      • reconfigure

        public void reconfigure()
        Description copied from interface: IsChart
        Triggers an update of the chart.
        This can be safely called after updating the data object.
        This will update the options, mutating the options property in place.
        Specified by:
        reconfigure in interface IsChart
      • reconfigure

        public void reconfigure​(TransitionKey mode)
        Description copied from interface: IsChart
        Triggers an update of the chart.
        This can be safely called after updating the data object.
        This will update the options, mutating the options property in place.
        A animation mode key can be provided for the update process using a specific animation configuration.
        This is useful when update is manually called inside an event handler and some different animation is desired.
        Specified by:
        reconfigure in interface IsChart
        Parameters:
        mode - an animation mode can be provided to indicate what should be updated and what animation configuration should be used
      • reconfigure

        public void reconfigure​(UpdateConfiguration config)
        Description copied from interface: IsChart
        Triggers an update of the chart.
        This can be safely called after updating the data object.
        This will update the options, mutating the options property in place.
        A configuration object can be provided with additional configuration for the update process.
        This is useful when update is manually called inside an event handler and some different animation is desired.
        Specified by:
        reconfigure in interface IsChart
        Parameters:
        config - a configuration object can be provided with additional configuration for the update process
      • render

        public final void render()
        Description copied from interface: IsChart
        Triggers a redraw of all chart elements.
        Note, this does not update elements for new data. Use .update() in that case.
        Specified by:
        render in interface IsChart
      • getDatasetItem

        public final DatasetItem getDatasetItem​(int index)
        Description copied from interface: IsChart
        Looks for the dataset that matches the current index and returns.
        Specified by:
        getDatasetItem in interface IsChart
        Parameters:
        index - dataset index
        Returns:
        dataset item.
      • isDatasetVisible

        public final boolean isDatasetVisible​(int index)
        Description copied from interface: IsChart
        Looks for the dataset if it's visible or not, selected by index.
        Specified by:
        isDatasetVisible in interface IsChart
        Parameters:
        index - dataset index
        Returns:
        true if dataset is visible otherwise false.
      • getVisibleDatasetCount

        public final int getVisibleDatasetCount()
        Description copied from interface: IsChart
        Returns the amount of datasets which are visible
        Specified by:
        getVisibleDatasetCount in interface IsChart
        Returns:
        the amount of datasets which are visible. If chart is not initialized, return Undefined.INTEGER.
      • setDatasetVisibility

        public void setDatasetVisibility​(int datasetIndex,
                                         boolean visibility)
        Description copied from interface: IsChart
        Sets the visibility for a given dataset.
        This can be used to build a chart legend in HTML.
        During click on one of the HTML items, you can call it to change the appropriate dataset.
        Specified by:
        setDatasetVisibility in interface IsChart
        Parameters:
        datasetIndex - dataset index
        visibility - if true enables the visibility otherwise false
      • toggleDataVisibility

        public void toggleDataVisibility​(int index)
        Description copied from interface: IsChart
        Toggles the visibility of an item in all datasets.
        A dataset needs to explicitly support this feature for it to have an effect.
        From internal chart types, doughnut / pie and polar area use this.
        Specified by:
        toggleDataVisibility in interface IsChart
        Parameters:
        index - data index
      • isDataVisible

        public boolean isDataVisible​(int index)
        Description copied from interface: IsChart
        Returns the stored visibility state of an data index for all datasets.
        Specified by:
        isDataVisible in interface IsChart
        Parameters:
        index - data index
        Returns:
        true if the data item is visible
      • hide

        public void hide​(int datasetIndex)
        Description copied from interface: IsChart
        Sets the visibility for the given dataset to false.
        Updates the chart and animates the dataset with 'hide' mode.
        This animation can be configured under the hide key in animation options.
        Specified by:
        hide in interface IsChart
        Parameters:
        datasetIndex - dataset index
      • hide

        public void hide​(int datasetIndex,
                         int dataIndex)
        Description copied from interface: IsChart
        Sets the hidden flag of that element index to true and updates the chart.
        Specified by:
        hide in interface IsChart
        Parameters:
        datasetIndex - dataset index
        dataIndex - data index
      • show

        public void show​(int datasetIndex)
        Description copied from interface: IsChart
        Sets the visibility for the given dataset to true.
        Updates the chart and animates the dataset with 'show' mode.
        This animation can be configured under the show key in animation options.
        Specified by:
        show in interface IsChart
        Parameters:
        datasetIndex - dataset index
      • show

        public void show​(int datasetIndex,
                         int dataIndex)
        Description copied from interface: IsChart
        Sets the hidden flag of that element index to false and updates the chart.
        Specified by:
        show in interface IsChart
        Parameters:
        datasetIndex - dataset index
        dataIndex - data index
      • getElementAtEvent

        public final DatasetReference getElementAtEvent​(BaseNativeEvent event)
        Description copied from interface: IsChart
        Calling on your chart instance passing an argument of an event, will return the single element at the event position.
        If there are multiple items within range, only the first is returned.
        Specified by:
        getElementAtEvent in interface IsChart
        Parameters:
        event - event of chart.
        Returns:
        single element at the event position or null.
      • getElementsAtEvent

        public final List<DatasetReference> getElementsAtEvent​(BaseNativeEvent event)
        Description copied from interface: IsChart
        Looks for the element under the event point, then returns all elements at the same data index.
        Calling it on your chart instance passing an argument of an event, will return the point elements that are at that the same position of that event.
        Specified by:
        getElementsAtEvent in interface IsChart
        Parameters:
        event - event of chart.
        Returns:
        all elements at the same data index or an empty list.
      • draw

        public final void draw()
        Description copied from interface: IsChart
        Draws the chart
        Specified by:
        draw in interface IsChart
      • checkDatasets

        public final void checkDatasets​(Dataset... datasets)
        Description copied from interface: IsChart
        Checks if datasets, requested to be stored, are an acceptable type or amount.
        If a dataset type or the amount of datasets are not consistent for the chart, a IllegalArgumentException will be thrown.
        Specified by:
        checkDatasets in interface IsChart
        Parameters:
        datasets - list of datasets to check.
      • checkAxes

        public final void checkAxes​(Axis... axes)
        Description copied from interface: IsChart
        Checks if axes, requested to be stored, are an acceptable type or amount.
        If a axis type or the amount of axes are not consistent for the chart, a IllegalArgumentException will be thrown.
        Specified by:
        checkAxes in interface IsChart
        Parameters:
        axes - list of axes to check.