-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAxis.java
More file actions
94 lines (88 loc) · 2.79 KB
/
Copy pathAxis.java
File metadata and controls
94 lines (88 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package sysmlinjava.analysis.common;
import java.io.Serializable;
import java.util.Optional;
/**
* Axis definition for a numerical axis in a chart display, e.g. line, bar,
* timing, etc.
*
* @author ModelerOne
*
*/
public class Axis implements Serializable
{
/** Serializable ID*/private static final long serialVersionUID = 8854669832371302383L;
/**
* Title of the axis, not including the parenthetical units portion
*/
public String title;
/**
* Parenthetical units portion of the title
*/
public String units;
/**
* Minimum value on the axis.
*/
public double minTicValue;
/**
* Maimum value on the axis. Chart will automatically determine max value from
* data if value is not present
*/
public double maxTicValue;
/**
* Whether chart will automatically determine range of values on the axis from
* data. Note this boolean is used (versus making the {@code min/maxTicValue}s
* optional) to enable serialization, i.e. {@code Optional} is not serializable.
*/
public boolean autoRange;
/**
* Increment between major (numbered) tics on the axis
*/
public double majorTicValue;
/**
* Number of tics between the major tics.
*/
public int minorTicCount;
/**
* Constructor
*
* @param title Title of the axis, not including the parenthetical units
* portion
* @param units Parenthetical units portion of the title
* @param minTicValue Optional minimum value on the axis. Chart will
* automatically determine min value from data if value is
* not present.
* @param maxTicValue Optional maximum value on the axis. Chart will
* automatically determine max value from data if value is
* not present.
* @param majorTicValue Increment between major (numbered) tics on the axis
* @param minorTicCount Number of tics between the major tics.
*/
public Axis(String title, String units, Optional<Double> minTicValue, Optional<Double> maxTicValue, double majorTicValue, int minorTicCount)
{
super();
this.title = title;
this.units = units;
this.autoRange = false;
if (minTicValue.isPresent())
this.minTicValue = minTicValue.get();
else
{
this.minTicValue = 0;
this.autoRange = true;
}
if (maxTicValue.isPresent())
this.maxTicValue = maxTicValue.get();
else
{
this.maxTicValue = 100;
this.autoRange = true;
}
this.majorTicValue = majorTicValue;
this.minorTicCount = minorTicCount;
}
@Override
public String toString()
{
return String.format("Axis [title=%s, units=%s, minValue=%s, maxValue=%s, majorTicValue=%s, minorTicCount=%s]", title, units, minTicValue, maxTicValue, majorTicValue, minorTicCount);
}
}