Class AbstractChart

    • Field Summary

      Fields 
      Modifier and Type Field Description
      org.pepstock.charba.client.AbstractChart.DatasetReferenceFactory datasetReferenceFactory  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractChart​(Type type)
      Initializes simple panel and canvas which are used by CHART.JS.
      It sets also some default behaviors (width in percentage) for resizing
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      HandlerRegistration addHandler​(EventHandler handler, EventType type)
      Adds a event handler.
      protected void applyConfiguration()
      Called before any drawing or reconfiguration in order that the chart which implements it can override options
      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.
      protected abstract boolean checkDataset​(Dataset dataset)
      Returns true if the dataset can be managed by a this chart type.
      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 clear()
      Will clear the chart canvas.
      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.
      This will clean up any references stored to the chart object within Chart.js, along with any associated event listeners attached by Chart.js.
      void draw()
      Draws the chart.
      It can be invoked once during the life cycle of the chart.
      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.
      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​(NativeBaseEvent event)
      Looks for the data sets that matches the event and returns the data set items references as a list.
      DatasetItem getDatasetItem​(int index)
      Looks for the data set that matches the current index.
      NativeObjectContainerFactory<DatasetReference> getDatasetReferenceFactory()
      Returns the factory to create DatasetReference when required, based on the data element type of the chart.
      IsDefaultScaledOptions getDefaultChartOptions()
      Returns the default options created based on chart type.
      int getDrawCount()
      Returns the draw count of the chart.
      DatasetReference getElementAtEvent​(NativeBaseEvent 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.
      DatasetReference getElementAtEvent​(NativeBaseEvent event, InteractionOptions interaction)
      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​(NativeBaseEvent 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.
      List<DatasetReference> getElementsAtEvent​(NativeBaseEvent event, InteractionOptions interaction)
      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.
      String getId()
      Returns the ID of chart.
      It could be considered as chart unique ID.
      CursorType getInitialCursor()
      Returns the initial cursor of the chart.
      protected int getMaximumAxesCount()
      Returns the maximum amount of axes that the chart can manage.
      protected int getMaximumDatasetsCount()
      Returns the maximum amount of datasets that the chart can manage.
      ChartNode getNode()
      Returns the chart node with runtime data.
      Plugins getPlugins()
      Returns the plugins element to manage inline plugins.
      List<DatasetItem> getSortedVisibleDatasetItems()
      Returns an array of all the dataset items in the order that they are drawn on the canvas that are not hidden.
      protected IsChart getSource()
      Returns a chart instance as source for all events.
      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 data sets which are visible
      IsDefaultScaledOptions getWholeOptions()
      Returns the default options by a chart instance, merging global, chart type global and chart options.
      If the options is not consistent, it will returns the getDefaultChartOptions().
      void hide​(int datasetIndex)
      Sets the visibility for the given data set to false.
      Updates the chart and animates the data set 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 data set if it's visible or not, selected by index.
      boolean isDataVisible​(int index)
      Returns the stored visibility state of an data index for all data sets.
      boolean isDestroyOnDetach()
      Returns true if the chart is configured to be destroyed on the detach from 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 isInitialized()
      Returns true if CHART.JS chart has been initialized, otherwise false.
      boolean isPluginEnabled​(String pluginId)
      Check if a plugin with the specific ID is registered and enabled.
      void onAttach​(MutationItem item)  
      void onDetach​(MutationItem item)  
      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​(TransitionMode 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 configuration)
      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.
      Use .update() in that case.
      void reset()
      Reset the chart to it's state before the initial animation.
      A new animation can then be triggered using update.
      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.
      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 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 data set.
      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 data set.
      void setDestroyOnDetach​(boolean destroyOnDetach)
      Sets true if the chart is configured to be destroyed on the detach from 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.
      This will pause the chart during any current animation frame.
      Call .render() to re-animate.
      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 data sets.
      A data set 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​(TransitionMode 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 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 update​(UpdateConfiguration configuration)
      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 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.
    • Field Detail

      • datasetReferenceFactory

        public final org.pepstock.charba.client.AbstractChart.DatasetReferenceFactory datasetReferenceFactory
    • Constructor Detail

      • AbstractChart

        protected AbstractChart​(Type type)
        Initializes simple panel and canvas which are used by CHART.JS.
        It sets also some default behaviors (width in percentage) for resizing
        Parameters:
        type - the type of chart
    • Method Detail

      • getSource

        protected final IsChart getSource()
        Description copied from class: HandlerManager
        Returns a chart instance as source for all events.
        Specified by:
        getSource in class HandlerManager
        Returns:
        a chart instance as source for all events
      • 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
      • 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.
      • getId

        public final String getId()
        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 final int getDrawCount()
        Returns the draw count of the chart.
        Specified by:
        getDrawCount in interface IsChart
        Returns:
        the draw count of the 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.
      • getCanvas

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

        public final void removeCanvasPreventDefault()
        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
      • isChartAttached

        public final boolean isChartAttached()
        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
      • getInitialCursor

        public final CursorType getInitialCursor()
        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()
        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()
        Returns the chart node with runtime data.
        Specified by:
        getNode in interface IsChart
        Returns:
        the chart node.
      • getData

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

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

        public final IsDefaultScaledOptions getWholeOptions()
        Returns the default options by a chart instance, merging global, chart type global and chart options.
        If the options is not consistent, it will returns the getDefaultChartOptions().
        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()
        Returns a CTimer instance inside chart.
        Specified by:
        getTimer in interface IsChart
        Returns:
        the timer instance of the chart
      • createAndSetTimer

        public 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.
        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()
        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)
        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()
        Returns true if the chart is configured to be destroyed on the detach from DIV element, otherwise false.
        Specified by:
        isDestroyOnDetach in interface IsChart
        Returns:
        the destroyOnDetach true if the chart is configured to be destroyed on the detach from DIV element, otherwise false.
      • setDestroyOnDetach

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

        public final void onAttach​(MutationItem item)
      • onDetach

        public final void onDetach​(MutationItem item)
      • setActiveElements

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

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

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

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

        public final void setTooltipActiveElements​(IsPoint point,
                                                   List<ActiveDatasetElement> elements)
        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 final void setTooltipActiveElements​(ActiveDatasetElement... elements)
        Sets the active tooltip elements for the chart.
        Specified by:
        setTooltipActiveElements in interface IsChart
        Parameters:
        elements - array of active tooltip elements
      • setTooltipActiveElements

        public final void setTooltipActiveElements​(IsPoint point,
                                                   ActiveDatasetElement... elements)
        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 final void resetTooltipActiveElements()
        Resets the active tooltip elements for the chart.
        Specified by:
        resetTooltipActiveElements in interface IsChart
      • destroy

        public final void destroy()
        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()
        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
      • clear

        public final void clear()
        Will clear the chart canvas.
        Specified by:
        clear in interface IsChart
      • reset

        public final void reset()
        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 final String toBase64Image​(ImageMimeType type,
                                          double encoderOptions)
        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()
        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 final 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.
        Specified by:
        resize in interface IsChart
        Parameters:
        width - width size of resize
        height - height size of resize
      • update

        public final 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.
        Specified by:
        update in interface IsChart
      • update

        public final void update​(TransitionMode 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 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:
        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 configuration)
        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 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:
        update in interface IsChart
        Parameters:
        configuration - a configuration object can be provided with additional configuration for the update process
      • reconfigure

        public final 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.
        Specified by:
        reconfigure in interface IsChart
      • reconfigure

        public final void reconfigure​(TransitionMode 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.
        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 final void reconfigure​(UpdateConfiguration configuration)
        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:
        configuration - a configuration object can be provided with additional configuration for the update process
      • render

        public final void render()
        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)
        Looks for the data set that matches the current index.
        Specified by:
        getDatasetItem in interface IsChart
        Parameters:
        index - data set index
        Returns:
        data set item or null if the index is out of range of data sets count.
      • getSortedVisibleDatasetItems

        public List<DatasetItem> getSortedVisibleDatasetItems()
        Returns an array of all the dataset items in the order that they are drawn on the canvas that are not hidden.
        Specified by:
        getSortedVisibleDatasetItems in interface IsChart
        Returns:
        an array of all the dataset items in the order that they are drawn on the canvas that are not hidden.
      • getDatasetAtEvent

        public final List<DatasetReference> getDatasetAtEvent​(NativeBaseEvent event)
        Looks for the data sets that matches the event and returns the data set items references as a list.
        Specified by:
        getDatasetAtEvent in interface IsChart
        Parameters:
        event - event of chart.
        Returns:
        data set items references list or or an empty list.
      • isDatasetVisible

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

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

        public final void setDatasetVisibility​(int datasetIndex,
                                               boolean visibility)
        Sets the visibility for a given data set.
        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 data set.
        Specified by:
        setDatasetVisibility in interface IsChart
        Parameters:
        datasetIndex - data set index
        visibility - if true enables the visibility otherwise false
      • toggleDataVisibility

        public final void toggleDataVisibility​(int index)
        Toggles the visibility of an item in all data sets.
        A data set 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 final boolean isDataVisible​(int index)
        Returns the stored visibility state of an data index for all data sets.
        Specified by:
        isDataVisible in interface IsChart
        Parameters:
        index - data index
        Returns:
        true if the data item is visible
      • hide

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

        public final void hide​(int datasetIndex,
                               int dataIndex)
        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 final 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.
        Specified by:
        show in interface IsChart
        Parameters:
        datasetIndex - dataset index
      • show

        public final void show​(int datasetIndex,
                               int dataIndex)
        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​(NativeBaseEvent 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.
        Specified by:
        getElementAtEvent in interface IsChart
        Parameters:
        event - event of chart.
        Returns:
        single element at the event position or null if event is not consistent
      • getElementAtEvent

        public final DatasetReference getElementAtEvent​(NativeBaseEvent event,
                                                        InteractionOptions interaction)
        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.
        interaction - how the elements will be checked.
        Returns:
        single element at the event position or null if event is not consistent
      • getElementsAtEvent

        public final List<DatasetReference> getElementsAtEvent​(NativeBaseEvent 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.
        Specified by:
        getElementsAtEvent in interface IsChart
        Parameters:
        event - event of chart.
        Returns:
        all elements at the same data index or an empty list.
      • getElementsAtEvent

        public final List<DatasetReference> getElementsAtEvent​(NativeBaseEvent event,
                                                               InteractionOptions interaction)
        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.
        interaction - how the elements will be checked.
        Returns:
        all elements at the same data index or an empty list.
      • isPluginEnabled

        public final boolean isPluginEnabled​(String pluginId)
        Check if a plugin with the specific ID is registered and enabled.
        Specified by:
        isPluginEnabled in interface IsChart
        Parameters:
        pluginId - the ID of the plugin of which to check if it is enabled
        Returns:
        boolean returns true if plugin is registered and enabled
      • draw

        public final void draw()
        Draws the chart.
        It can be invoked once during the life cycle of the chart.
        Specified by:
        draw in interface IsChart
      • applyConfiguration

        protected void applyConfiguration()
        Called before any drawing or reconfiguration in order that the chart which implements it can override options
      • 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.
      • checkDataset

        protected abstract boolean checkDataset​(Dataset dataset)
        Returns true if the dataset can be managed by a this chart type.
        Parameters:
        dataset - dataset to check
        Returns:
        true if the dataset can be managed by a this chart type
      • getMaximumDatasetsCount

        protected int getMaximumDatasetsCount()
        Returns the maximum amount of datasets that the chart can manage.
        Returns:
        the maximum amount of datasets that the chart can manage.
      • checkAxes

        public 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.
      • getMaximumAxesCount

        protected int getMaximumAxesCount()
        Returns the maximum amount of axes that the chart can manage.
        Returns:
        the maximum amount of axes that the chart can manage.