2 * Copyright © 2013 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; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 package org.altusmetrum.altosuilib_3;
21 import java.util.ArrayList;
25 import org.altusmetrum.altoslib_5.*;
27 import org.jfree.ui.*;
28 import org.jfree.chart.*;
29 import org.jfree.chart.plot.*;
30 import org.jfree.chart.axis.*;
31 import org.jfree.chart.renderer.*;
32 import org.jfree.chart.renderer.xy.*;
33 import org.jfree.chart.labels.*;
34 import org.jfree.data.xy.*;
35 import org.jfree.data.*;
37 public class AltosUIMarker implements AltosUIGrapher {
38 ArrayList<ValueMarker> markers;
45 private void remove_markers() {
46 for (ValueMarker marker : markers)
47 plot.removeDomainMarker(marker);
50 private void add_markers() {
51 for (ValueMarker marker : markers)
52 plot.addDomainMarker(marker);
55 public void set_units() {
58 public void set_enable(boolean enable) {
59 if (enabled == enable)
71 markers = new ArrayList<ValueMarker>();
74 public void add(AltosUIDataPoint dataPoint) {
76 int id = dataPoint.id(fetch);
81 ValueMarker marker = new ValueMarker(dataPoint.x());
82 marker.setLabel(dataPoint.id_name(fetch));
83 marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
84 marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
85 marker.setPaint(color);
87 plot.addDomainMarker(marker);
90 } catch (AltosUIDataMissing m) {
94 public AltosUIMarker (int fetch, Color color, XYPlot plot, boolean enable) {
95 markers = new ArrayList<ValueMarker>();
100 this.enabled = enable;
103 public void setNotify(boolean notify) {
106 public void fireSeriesChanged() {
109 public AltosUIMarker (int fetch, Color color, XYPlot plot) {
110 this(fetch, color, plot, true);