Class AbstractChart<CHART_ITEM_TYPE extends AbstractChartItem>

  • All Implemented Interfaces:
    Chart<CHART_ITEM_TYPE>
    Direct Known Subclasses:
    AbstractAxisChart, PieChart

    public abstract class AbstractChart<CHART_ITEM_TYPE extends AbstractChartItem>
    extends Object
    implements Chart<CHART_ITEM_TYPE>
    Common implementation between each chart.
    Author:
    Yohann Chastagnier
    • Constructor Detail

      • AbstractChart

        public AbstractChart()
    • Method Detail

      • addExtra

        public <T extends AbstractChart<CHART_ITEM_TYPE>> T addExtra​(String key,
                                                                     String value)
        Adds an extra information associated to the chart, but not necessary for the chart rendering. Useful to provide data from a treatment to an other one.
        Type Parameters:
        T -
        Parameters:
        key - the key at which the given information is registered.
        value - the value registered.
        Returns:
        the instance of the chart itself.
      • getExtra

        public Object getExtra​(String key)
        Gets the value of an information associated to the chart, but not necessary for the chart rendering. Useful to provide data from a treatment to an other one.
        Parameters:
        key - the ket at which the extra data is registered.
        Returns:
        the extra data as it has been registered.
      • withTitle

        public final <T extends AbstractChart<CHART_ITEM_TYPE>> T withTitle​(String title)
        Sets the title of the chart.
        Parameters:
        title - the title of the chart.
        Returns:
        the instance of the chart itself.
      • computeExtraDataAsJson

        protected void computeExtraDataAsJson​(JSONCodec.JSONObject jsonChart)
        Overriding this method if necessary.
        Parameters:
        jsonChart - the json object that represents the chart.
      • add

        protected <T extends AbstractChart<CHART_ITEM_TYPE>> T add​(CHART_ITEM_TYPE item)
        Adds an item into the list of chart items.
        Type Parameters:
        T -
        Parameters:
        item - the chart item to add.
        Returns:
        the instance of the chart itself.