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
0f21d74a
Commit
0f21d74a
authored
11 years ago
by
Tim Molter
Browse files
Options
Downloads
Patches
Plain Diff
bug fix - some axis tick labels that should be '0' were looking like 2e-17 instead.
parent
f649c526
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickNumericalCalculator.java
+7
-5
7 additions, 5 deletions
...chart/internal/chartpart/AxisTickNumericalCalculator.java
with
7 additions
and
5 deletions
xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickNumericalCalculator.java
+
7
−
5
View file @
0f21d74a
...
...
@@ -15,6 +15,8 @@
*/
package
com.xeiam.xchart.internal.chartpart
;
import
java.math.BigDecimal
;
import
com.xeiam.xchart.StyleManager
;
import
com.xeiam.xchart.internal.Utils
;
import
com.xeiam.xchart.internal.chartpart.Axis.Direction
;
...
...
@@ -59,15 +61,15 @@ public class AxisTickNumericalCalculator extends AxisTickCalculator {
// where the tick should begin in the working space in pixels
double
margin
=
Utils
.
getTickStartOffset
(
workingSpace
,
tickSpace
);
// in plot space double gridStep = getGridStepForDecimal(tickSpace);
double
gridStep
=
getNumericalGridStep
(
tickSpace
);
double
firstPosition
=
getFirstPosition
(
gridStep
);
BigDecimal
gridStep
=
BigDecimal
.
valueOf
(
getNumericalGridStep
(
tickSpace
)
)
;
BigDecimal
firstPosition
=
BigDecimal
.
valueOf
(
getFirstPosition
(
gridStep
.
doubleValue
())
);
// generate all tickLabels and tickLocations from the first to last position
for
(
double
tickPosition
=
firstPosition
;
tickPosition
<=
maxValue
;
tickPosition
=
tickPosition
+
gridStep
)
{
for
(
BigDecimal
tickPosition
=
firstPosition
;
tickPosition
.
compareTo
(
BigDecimal
.
valueOf
(
maxValue
))
<=
0
;
tickPosition
=
tickPosition
.
add
(
gridStep
)
)
{
tickLabels
.
add
(
numberFormatter
.
formatNumber
(
tickPosition
));
tickLabels
.
add
(
numberFormatter
.
formatNumber
(
tickPosition
.
doubleValue
()
));
// here we convert tickPosition finally to plot space, i.e. pixels
double
tickLabelPosition
=
margin
+
((
tickPosition
-
minValue
)
/
(
maxValue
-
minValue
)
*
tickSpace
);
double
tickLabelPosition
=
margin
+
((
tickPosition
.
doubleValue
()
-
minValue
)
/
(
maxValue
-
minValue
)
*
tickSpace
);
tickLocations
.
add
(
tickLabelPosition
);
}
}
...
...
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