Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
XChart
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Brady James Garvin
XChart
Commits
b6327806
Commit
b6327806
authored
12 years ago
by
Tim Molter
Browse files
Options
Downloads
Patches
Plain Diff
made tick mark step hint different for x and y axis
parent
ca0c00b1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/xeiam/xchart/internal/chartpart/AxisTick.java
+13
-7
13 additions, 7 deletions
...in/java/com/xeiam/xchart/internal/chartpart/AxisTick.java
with
13 additions
and
7 deletions
src/main/java/com/xeiam/xchart/internal/chartpart/AxisTick.java
+
13
−
7
View file @
b6327806
...
@@ -26,6 +26,7 @@ import java.util.List;
...
@@ -26,6 +26,7 @@ import java.util.List;
import
java.util.Locale
;
import
java.util.Locale
;
import
com.xeiam.xchart.internal.chartpart.Axis.AxisType
;
import
com.xeiam.xchart.internal.chartpart.Axis.AxisType
;
import
com.xeiam.xchart.internal.chartpart.Axis.Direction
;
import
com.xeiam.xchart.internal.interfaces.IChartPart
;
import
com.xeiam.xchart.internal.interfaces.IChartPart
;
import
com.xeiam.xchart.internal.interfaces.IHideable
;
import
com.xeiam.xchart.internal.interfaces.IHideable
;
...
@@ -34,8 +35,11 @@ import com.xeiam.xchart.internal.interfaces.IHideable;
...
@@ -34,8 +35,11 @@ import com.xeiam.xchart.internal.interfaces.IHideable;
*/
*/
public
class
AxisTick
implements
IChartPart
,
IHideable
{
public
class
AxisTick
implements
IChartPart
,
IHideable
{
/** the default tick mark step hint */
/** the default tick mark step hint for x axis */
private
static
final
int
DEFAULT_TICK_MARK_STEP_HINT
=
64
;
private
static
final
int
DEFAULT_TICK_MARK_STEP_HINT_X
=
74
;
/** the default tick mark step hint for y axis */
private
static
final
int
DEFAULT_TICK_MARK_STEP_HINT_Y
=
44
;
/** the padding between the tick labels and the tick marks */
/** the padding between the tick labels and the tick marks */
protected
final
static
int
AXIS_TICK_PADDING
=
4
;
protected
final
static
int
AXIS_TICK_PADDING
=
4
;
...
@@ -83,7 +87,7 @@ public class AxisTick implements IChartPart, IHideable {
...
@@ -83,7 +87,7 @@ public class AxisTick implements IChartPart, IHideable {
// formatting
// formatting
locale
=
Locale
.
getDefault
();
locale
=
Locale
.
getDefault
();
normalDecimalPattern
=
"#.###"
;
normalDecimalPattern
=
"#.###
#
"
;
scientificDecimalPattern
=
"0.##E0"
;
scientificDecimalPattern
=
"0.##E0"
;
datePattern
=
"HHmmss"
;
datePattern
=
"HHmmss"
;
...
@@ -122,12 +126,13 @@ public class AxisTick implements IChartPart, IHideable {
...
@@ -122,12 +126,13 @@ public class AxisTick implements IChartPart, IHideable {
axisTickMarks
.
paint
(
g
);
axisTickMarks
.
paint
(
g
);
if
(
axis
.
direction
==
Axis
.
Direction
.
Y
)
{
if
(
axis
.
direction
==
Axis
.
Direction
.
Y
)
{
bounds
=
new
Rectangle
((
int
)
axisTickLabels
.
getBounds
().
getX
(),
(
int
)
(
axisTickLabels
.
getBounds
().
getY
()),
bounds
=
new
Rectangle
((
int
)
axisTickLabels
.
getBounds
().
getX
(),
(
int
)
(
axisTickLabels
.
getBounds
().
getY
()),
(
int
)
(
axisTickLabels
.
getBounds
().
getWidth
()
+
AXIS_TICK_PADDING
+
axisTickMarks
(
int
)
(
axisTickLabels
.
getBounds
().
getWidth
()
+
AXIS_TICK_PADDING
+
axisTickMarks
.
getBounds
().
getWidth
()),
(
int
)
(
axisTickMarks
.
getBounds
().
getHeight
()));
.
getBounds
().
getWidth
()),
(
int
)
(
axisTickMarks
.
getBounds
().
getHeight
()));
// g.setColor(Color.red);
// g.setColor(Color.red);
// g.draw(bounds);
// g.draw(bounds);
}
else
{
}
else
{
bounds
=
new
Rectangle
((
int
)
axisTickMarks
.
getBounds
().
getX
(),
(
int
)
(
axisTickMarks
.
getBounds
().
getY
()),
(
int
)
axisTickLabels
.
getBounds
().
getWidth
(),
(
int
)
(
axisTickMarks
.
getBounds
().
getHeight
()
bounds
=
new
Rectangle
((
int
)
axisTickMarks
.
getBounds
().
getX
(),
(
int
)
(
axisTickMarks
.
getBounds
().
getY
()),
(
int
)
axisTickLabels
.
getBounds
().
getWidth
(),
(
int
)
(
axisTickMarks
.
getBounds
()
.
getHeight
()
+
AXIS_TICK_PADDING
+
axisTickLabels
.
getBounds
().
getHeight
()));
+
AXIS_TICK_PADDING
+
axisTickLabels
.
getBounds
().
getHeight
()));
// g.setColor(Color.red);
// g.setColor(Color.red);
// g.draw(bounds);
// g.draw(bounds);
...
@@ -186,7 +191,8 @@ public class AxisTick implements IChartPart, IHideable {
...
@@ -186,7 +191,8 @@ public class AxisTick implements IChartPart, IHideable {
// System.out.println(axis.getMax());
// System.out.println(axis.getMax());
// System.out.println(axis.min);
// System.out.println(axis.min);
// System.out.println(length);
// System.out.println(length);
double
gridStepHint
=
length
/
tickSpace
*
DEFAULT_TICK_MARK_STEP_HINT
;
int
tickMarkSpaceHint
=
(
axis
.
direction
==
Direction
.
X
?
DEFAULT_TICK_MARK_STEP_HINT_X
:
DEFAULT_TICK_MARK_STEP_HINT_Y
);
double
gridStepHint
=
length
/
tickSpace
*
tickMarkSpaceHint
;
// gridStepHint --> mantissa * 10 ** exponent
// gridStepHint --> mantissa * 10 ** exponent
// e.g. 724.1 --> 7.241 * 10 ** 2
// e.g. 724.1 --> 7.241 * 10 ** 2
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment