Package org.onosproject.ui.chart
Class ChartModel
- java.lang.Object
-
- org.onosproject.ui.chart.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ChartModel.Annot
Model of an annotation.class
ChartModel.DataPoint
A class of data point.
-
Constructor Summary
Constructors Constructor Description ChartModel(java.lang.String... series)
Constructs a chart model with initialized series set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnnotation(java.lang.String key, java.lang.Object value)
Inserts a new annotation.ChartModel.DataPoint
addDataPoint(java.lang.Object label)
Adds a data point to the chart model.int
dataPointCount()
Returns the number of data points in this chart model.java.util.Collection<ChartModel.Annot>
getAnnotations()
Returns the annotations in this chart.ChartModel.DataPoint[]
getDataPoints()
Returns all of data points in order.java.lang.Object[]
getLabels()
Returns all of labels in order.ChartModel.DataPoint
getLastDataPoint()
Returns the last element inside all of data points.java.lang.String[]
getSeries()
Returns all of series.int
seriesCount()
Returns the number of series in this chart model.
-
-
-
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 annotationvalue
- value of annotation
-
getAnnotations
public java.util.Collection<ChartModel.Annot> getAnnotations()
Returns the annotations in this chart.- Returns:
- annotations
-
-