2 * Copyright © 2017 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
15 package org.altusmetrum.altosuilib_11;
20 import org.altusmetrum.altoslib_11.*;
22 import org.jfree.ui.*;
23 import org.jfree.chart.*;
24 import org.jfree.chart.plot.*;
25 import org.jfree.chart.axis.*;
26 import org.jfree.chart.renderer.*;
27 import org.jfree.chart.renderer.xy.*;
28 import org.jfree.chart.labels.*;
29 import org.jfree.data.xy.*;
30 import org.jfree.data.*;
32 class AltosUITimeSeriesAxis {
39 public AltosUITimeSeriesAxis(Color color, boolean enabled, AltosUIAxis axis, XYPlot plot, boolean marker) {
41 this.enabled = enabled;
48 public class AltosUIFlightSeries extends AltosFlightSeries {
50 Hashtable<String,AltosUITimeSeriesAxis> axes;
52 AltosUIFlightSeries flight_series;
54 void fill_axes(String label, AltosUITimeSeriesAxis axis) {
55 for (AltosTimeSeries ts : series) {
56 AltosUITimeSeries uts = (AltosUITimeSeries) ts;
58 if (label.equals(ts.label) || (label.equals("default") && uts.color == null)) {
60 uts.set_marker(axis.color, axis.enabled, axis.plot);
62 uts.set_axis(axis.color, axis.enabled, axis.axis);
67 public void register_axis(String label,
71 AltosUITimeSeriesAxis tsa = new AltosUITimeSeriesAxis(color,
77 fill_axes(label, tsa);
80 public void register_marker(String label,
84 AltosUITimeSeriesAxis tsa = new AltosUITimeSeriesAxis(color,
90 fill_axes(label, tsa);
93 public AltosTimeSeries make_series(String label, AltosUnits units) {
96 AltosUITimeSeries time_series = new AltosUITimeSeries(label, units);
98 AltosUITimeSeriesAxis tsa = axes.get(label);
100 tsa = axes.get("default");
103 time_series.set_marker(tsa.color, tsa.enabled, tsa.plot);
105 time_series.set_axis(tsa.color, tsa.enabled, tsa.axis);
110 public AltosUITimeSeries[] series(AltosCalData cal_data) {
112 return series.toArray(new AltosUITimeSeries[0]);
115 public AltosUIFlightSeries (AltosCalData cal_data) {
117 axes = new Hashtable<String,AltosUITimeSeriesAxis>();