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_14;
18 import java.util.ArrayList;
22 import org.altusmetrum.altoslib_14.*;
24 import org.jfree.ui.*;
25 import org.jfree.chart.*;
26 import org.jfree.chart.plot.*;
27 import org.jfree.chart.axis.*;
28 import org.jfree.chart.renderer.*;
29 import org.jfree.chart.renderer.xy.*;
30 import org.jfree.chart.labels.*;
31 import org.jfree.data.xy.*;
32 import org.jfree.data.*;
34 public class AltosUILineStyle {
38 static private Color color(int r, int g, int b) {
39 return new Color(r,g,b);
42 static final private Color[] colors = {
44 new Color(230,0,0), // red
45 new Color(216,103,0), // orange
46 new Color(200,200,0), // yellow
47 new Color(0,180,0), // green
48 new Color(0,140,140), // cyan
49 new Color(130,0,0), // dark red
50 new Color(0,100,0), // dark green
51 new Color(0,0,255), // blue
52 new Color(140,0,140), // magenta
53 new Color(150,150,150), // gray
56 static final private float[][] dashes = {
64 static int color_index, dash_index;
66 public AltosUILineStyle () {
67 color = colors[color_index];
68 dash = dashes[dash_index];
69 color_index = (color_index + 1) % colors.length;
70 if (color_index == 0) {
71 dash_index = (dash_index + 1) % dashes.length;
73 System.out.printf("too many line styles\n");
77 public AltosUILineStyle(int index) {
78 index = index % (colors.length * dashes.length);
79 int c = index % colors.length;
80 int d = index / colors.length;