MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / XYAxis

Class XYAxis

src/org/opensourcephysics/display/axes/XYAxis.java:25–429  ·  view source on GitHub ↗

A superclass for the x axis and y axis. @author Wolfgang Christian @version 1.0

Source from the content-addressed store, hash-verified

23 * @version 1.0
24 */
25abstract public class XYAxis implements Interactive {
26 /** Field DRAW_IN_DISPLAY */
27 public static final int DRAW_IN_DISPLAY = 0;
28
29 /** Field DRAW_IN_GUTTER */
30 public static final int DRAW_IN_GUTTER = 1;
31
32 /** Field DRAW_AT_LOCATION */
33 public static final int DRAW_AT_LOCATION = 2;
34
35 /** Field LINEAR */
36 public static final int LINEAR = 0;
37 protected double x = 0;
38 protected double y = 0;
39 boolean enabled = false; // enables interaction
40
41 /** Field LOG10 */
42 public static final int LOG10 = 1;
43 int locationType = DRAW_IN_DISPLAY;
44 int axisType = LINEAR;
45 String logBase = "10"; //$NON-NLS-1$
46 DecimalFormat labelFormat = org.opensourcephysics.numerics.Util.newDecimalFormat("0.0"); //$NON-NLS-1$
47 DecimalFormat integerFormat = org.opensourcephysics.numerics.Util.newDecimalFormat("000"); //$NON-NLS-1$
48 double label_step = -14;
49 double label_start = 2;
50 DrawableTextLine axisLabel = new DrawableTextLine("x", 0, 0); //$NON-NLS-1$
51 Font labelFont = new Font("Dialog", Font.PLAIN, 12); //$NON-NLS-1$
52 int label_exponent = 0;
53 String label_string[] = new String[0]; // String to contain the labels.
54 double label_value[] = new double[0]; // The actual values of the axis labels
55 double decade_multiplier = 1;
56 int label_count = 0; // The number of labels
57 double location = 0; // The position of the axis
58 Font titleFont = new Font("Dialog", Font.PLAIN, 12); //$NON-NLS-1$
59 boolean showMajorGrid = false;
60 // Color majorGridColor = new Color(223, 223, 223); // light gray
61
62 Color majorGridColor = new Color(0, 0, 0, 32); // light gray
63
64 /**
65 * Constructor XYAxis
66 */
67 public XYAxis() {
68 axisLabel.setJustification(TextLine.CENTER);
69 axisLabel.setFont(labelFont);
70 }
71
72 /**
73 * Draws the axis in a drawing panel.
74 * @param panel
75 * @param g
76 */
77 @Override
78abstract public void draw(DrawingPanel panel, Graphics g);
79
80 /**
81 * Method setLabelFormat
82 *

Callers

nothing calls this directly

Calls 1

newDecimalFormatMethod · 0.80

Tested by

no test coverage detected