* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altosuilib_12;
+package org.altusmetrum.altosuilib_14;
import java.io.*;
import java.util.ArrayList;
import java.awt.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_12.*;
+import org.altusmetrum.altoslib_14.*;
import org.jfree.ui.*;
import org.jfree.chart.*;
}
public class AltosUITimeSeries extends AltosTimeSeries implements AltosUIGrapher {
- Color color;
- boolean enable;
- AltosUIAxis axis;
- boolean marker;
- boolean marker_top;
- XYItemRenderer renderer;
- XYPlot plot;
- AltosXYSeries xy_series;
+ AltosUILineStyle line_style;
+ boolean enable;
+ boolean custom_axis_set;
+ AltosUIAxis axis;
+ boolean marker;
+ boolean marker_top;
+ XYLineAndShapeRenderer renderer;
+ XYPlot plot;
+ AltosXYSeries xy_series;
ArrayList<ValueMarker> markers;
-
+ float width;
/* AltosUIGrapher interface */
public boolean need_reset() {
public void fireSeriesChanged() {
}
- void set_data() {
+ public void set_data() {
if (marker) {
if (markers != null) {
for (ValueMarker marker : markers)
marker.setLabelAnchor(RectangleAnchor.BOTTOM_RIGHT);
marker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
}
- marker.setPaint(color);
+ marker.setPaint(line_style.color);
+ marker.setStroke(new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
if (enable)
plot.addDomainMarker(marker);
markers.add(marker);
}
xy_series.setNotify(true);
}
+ clear_changed();
}
public void set_units() {
}
}
- public void set_axis(Color color, boolean enable, AltosUIAxis axis) {
- this.color = color;
+ // public BasicStroke(float width, int cap, int join, float miterlimit,
+ // float dash[], float dash_phase)
+
+ public void set_line_width(float width) {
+ this.width = width;
+ if (markers != null) {
+ for (ValueMarker marker : markers) {
+ marker.setStroke(new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
+ }
+ } else {
+ if (line_style.dash[0] == 0.0)
+ renderer.setSeriesStroke(0, new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+ else
+ renderer.setSeriesStroke(0, new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10.0f, line_style.dash, 0.0f));
+ }
+ }
+
+ public void set_axis(AltosUILineStyle line_style, boolean enable, AltosUIAxis axis) {
+ this.line_style = line_style;
this.enable = enable;
this.axis = axis;
this.marker = false;
+ this.width = 1.0f;
axis.ref(this.enable);
renderer = new XYLineAndShapeRenderer(true, false);
- renderer.setSeriesPaint(0, color);
- renderer.setSeriesStroke(0, new BasicStroke(2, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+ renderer.setSeriesPaint(0, line_style.color);
+ set_line_width(this.width);
renderer.setSeriesVisible(0, enable);
xy_series = new AltosXYSeries(label);
}
- public void set_marker(Color color, boolean enable, XYPlot plot, boolean marker_top) {
- this.color = color;
+ public void set_marker(AltosUILineStyle line_style, boolean enable, XYPlot plot, boolean marker_top) {
+ this.line_style = line_style;
this.enable = enable;
this.marker = true;
this.plot = plot;
this.marker_top = marker_top;
}
+ public void set_shapes_visible(boolean shapes_visible) {
+ renderer.setSeriesShapesVisible(0, shapes_visible);
+ }
+
public AltosUITimeSeries(String label, AltosUnits units) {
super(label, units);
}
public AltosUITimeSeries(String label, AltosUnits units,
- Color color, boolean enable,
+ AltosUILineStyle line_style, boolean enable,
AltosUIAxis axis) {
this(label, units);
- set_axis(color, enable, axis);
+ set_axis(line_style, enable, axis);
}
}