4.3.8 Line Plot charts

A line plot is a graph that represents raw data in groups and shows distribution of the data by frequency of occurrence by classes.

Sample

For instance, factory is producing steel cables. Its lengths were measured at 25 different occurrences by taking 4 samples each time.

S1144 146 154 146
S2150 150 134 153
S3145 139 143 152
S4154 146 152 148
S5157 153 155 157
S6157 150 145 147
S7149 144 137 155
S8141 147 149 155
S9158 150 149 156
S10145 148 152 154
S11151 150 154 153
S12155 145 152 148
S13152 146 152 142
S14144 160 150 149
S15150 146 148 157
S16147 144 148 149
S17155 150 153 148
S18157 148 149 153
S19153 155 149 151
S20155 142 150 150
S21146 156 148 160
S22152 147 158 154
S23143 156 151 151
S24151 152 157 149
S25154 140 157 151

In order to draw a LinePlot chart for the gathered data:

Create chart's data model:

1
2
3
4
5
6
7
8
/*
 * Creating data model
*/
ChartDataModel dataModel = new ChartDataModel();
dataModel.addKeyValues(("S1"), new Object[] { 144., 146., 154., 146. });
dataModel.addKeyValues(("S2"), new Object[] { 151., 150., 134., 153. });
dataModel.addKeyValues(("S3"), new Object[] { 145., 139., 143., 152. });
//.......

Create chart:

1
2
3
4
/* Creates LinePlotChart object named chart, where
*    dataModel contains data which we want to plot
*    1 - is the number which indicates how many intervals there should be */
LinePlotChart chart = new LinePlotChart(dataModel, 1);

Figure 4.3.8.1 Line Plot Chart Demonstration

View Source