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 {
40 public AltosUITimeSeriesAxis(Color color, boolean enabled, AltosUIAxis axis, XYPlot plot, boolean marker, boolean marker_top) {
42 this.enabled = enabled;
46 this.marker_top = marker_top;
50 public class AltosUIFlightSeries extends AltosFlightSeries {
52 Hashtable<String,AltosUITimeSeriesAxis> axes;
54 AltosUIFlightSeries flight_series;
56 void fill_axes(String label, AltosUITimeSeriesAxis axis) {
57 for (AltosTimeSeries ts : series) {
58 AltosUITimeSeries uts = (AltosUITimeSeries) ts;
60 if (label.equals(ts.label) || (label.equals("default") && uts.color == null)) {
62 uts.set_marker(axis.color, axis.enabled, axis.plot, axis.marker_top);
64 uts.set_axis(axis.color, axis.enabled, axis.axis);
69 public void register_axis(String label,
73 AltosUITimeSeriesAxis tsa = new AltosUITimeSeriesAxis(color,
80 fill_axes(label, tsa);
83 public void register_marker(String label,
88 AltosUITimeSeriesAxis tsa = new AltosUITimeSeriesAxis(color,
95 fill_axes(label, tsa);
98 public AltosTimeSeries make_series(String label, AltosUnits units) {
101 AltosUITimeSeries time_series = new AltosUITimeSeries(label, units);
103 AltosUITimeSeriesAxis tsa = axes.get(label);
105 tsa = axes.get("default");
108 time_series.set_marker(tsa.color, tsa.enabled, tsa.plot, tsa.marker_top);
110 time_series.set_axis(tsa.color, tsa.enabled, tsa.axis);
115 public AltosUITimeSeries[] series(AltosCalData cal_data) {
117 return series.toArray(new AltosUITimeSeries[0]);
120 public AltosUIFlightSeries (AltosCalData cal_data) {
122 axes = new Hashtable<String,AltosUITimeSeriesAxis>();