Class AbstractChartItem<D>

    • Constructor Detail

      • AbstractChartItem

        public AbstractChartItem()
    • Method Detail

      • getTitle

        public String getTitle()
        Description copied from interface: ChartItem
        Gets the label of the item.
        Specified by:
        getTitle in interface ChartItem
        Returns:
        a string representation of the label that defines the item, empty if no label.
      • addExtra

        public <T extends AbstractChartItem<D>> 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 <T extends AbstractChartItem<D>> T withTitle​(String title)
        Sets the title that defines the item.
        Type Parameters:
        T -
        Parameters:
        title - a title as string.
        Returns:
        the instance of the chart itself.
      • asJson

        public final String asJson()
        Gets the json representation of the item.
        Specified by:
        asJson in interface ChartItem
        Returns:
        a string that represents the item as a json array.
      • getJsonProducer

        protected final UnaryOperator<JSONCodec.JSONObject> getJsonProducer()
        Gets the json representation of the item.
        Returns:
        a string that represents the item as a json array.
      • completeJsonData

        protected abstract void completeJsonData​(JSONCodec.JSONObject itemAsJson)
        Completes the given json object with the data of specific implementations.
        Parameters:
        itemAsJson - the json object to complete.