// - For each sample, add points and extend the lines of the
// corresponding Line objects.
synchronized (StatCollector.getHistorical()) {
for (int i = 0; i < StatCollector.getHistorical().size(); i++) {
final MultiStatSample sample = StatCollector.getHistorical().get(i);
// First figure out the max value.
double max = 0;
for (final StatType type : sample.getStatTypes()) {
if (_config.containsKey(type)) {
max = Math.max(sample.getStatValue(type).getAccumulatedValue(), max);
}
}
double accum = 0;
for (final StatType type : sample.getStatTypes()) {
if (_config.containsKey(type)) {
AreaEntry entry = _entries.get(type);
// Prepare our entry object as needed.
if (entry == null || entry.maxSamples != StatCollector.getMaxSamples()) {
entry = new AreaEntry(StatCollector.getMaxSamples(), type);
_entries.put(type, entry);
}
// average by max and bump by accumulated total.
final double value = sample.getStatValue(type).getAccumulatedValue() / max;
final Vector3 point1 = new Vector3(i, (float) (value + accum), 0);
entry.verts.add(point1);
final Vector3 point2 = new Vector3(i, (float) (accum), 0);
entry.verts.add(point2);
entry.visited = true;