Class ChartModel


  • public class ChartModel
    extends java.lang.Object
    A simple model of time series chart data.

    Note that this is not a full MVC type model; the expected usage pattern is to create an empty chart, add data points (by consulting the business model), and produce the list of data points which contain a label and a set of data values for all serials.

    • Constructor Detail

      • ChartModel

        public ChartModel​(java.lang.String... series)
        Constructs a chart model with initialized series set.
        Parameters:
        series - a set of series
    • Method Detail

      • seriesCount

        public int seriesCount()
        Returns the number of series in this chart model.
        Returns:
        number of series
      • addDataPoint

        public ChartModel.DataPoint addDataPoint​(java.lang.Object label)
        Adds a data point to the chart model.
        Parameters:
        label - label instance
        Returns:
        the data point, for chaining
      • getSeries

        public java.lang.String[] getSeries()
        Returns all of series.
        Returns:
        an array of series
      • getDataPoints

        public ChartModel.DataPoint[] getDataPoints()
        Returns all of data points in order.
        Returns:
        an array of data points
      • getLabels

        public java.lang.Object[] getLabels()
        Returns all of labels in order.
        Returns:
        an array of labels
      • dataPointCount

        public int dataPointCount()
        Returns the number of data points in this chart model.
        Returns:
        number of data points
      • getLastDataPoint

        public ChartModel.DataPoint getLastDataPoint()
        Returns the last element inside all of data points.
        Returns:
        data point
      • addAnnotation

        public void addAnnotation​(java.lang.String key,
                                  java.lang.Object value)
        Inserts a new annotation.
        Parameters:
        key - key of annotation
        value - value of annotation
      • getAnnotations

        public java.util.Collection<ChartModel.Annot> getAnnotations()
        Returns the annotations in this chart.
        Returns:
        annotations