Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BraillePlot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Georg Graßnick
BraillePlot
Commits
12970f40
Commit
12970f40
authored
5 years ago
by
Georg Graßnick
Browse files
Options
Downloads
Patches
Plain Diff
Truncate legend values to two rational digits
parent
6f0c9d43
No related branches found
Branches containing commit
No related tags found
1 merge request
!43
Feat/scatterplot rasterizer 34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/tudresden/inf/mci/brailleplot/rendering/ScatterPlotRasterizer.java
+8
-2
8 additions, 2 deletions
.../inf/mci/brailleplot/rendering/ScatterPlotRasterizer.java
with
8 additions
and
2 deletions
src/main/java/de/tudresden/inf/mci/brailleplot/rendering/ScatterPlotRasterizer.java
+
8
−
2
View file @
12970f40
...
...
@@ -12,6 +12,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
java.util.HashMap
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.Objects
;
...
...
@@ -26,6 +27,7 @@ public class ScatterPlotRasterizer implements Rasterizer<ScatterPlot> {
private
static
final
int
X_AXIS_STEP_WIDTH
=
3
;
// The distance between two tick marks on the x axis [cells]
private
static
final
int
Y_AXIS_STEP_WIDTH
=
3
;
// The distance between two tick marks on the y axis [cells]
private
static
final
int
AXIS_TICK_SIZE
=
1
;
// The length of the ticks on the axis [dots]
private
static
final
Locale
NUMBER_LOCALE
=
new
Locale
(
"en"
,
"US"
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ScatterPlotRasterizer
.
class
);
...
...
@@ -173,7 +175,7 @@ public class ScatterPlotRasterizer implements Rasterizer<ScatterPlot> {
int
tickPos
=
x
*
xAxisStepWidth
;
double
val
=
tickPos
/
xRatio
;
LOG
.
debug
(
"Adding x axis label {{},{}} for tick #{}"
,
label
,
val
,
x
);
xAxisLegendSymbols
.
put
(
String
.
valueOf
(
label
),
String
.
valueOf
(
val
));
xAxisLegendSymbols
.
put
(
String
.
valueOf
(
label
),
formatDouble
(
val
));
label
++;
}
...
...
@@ -189,7 +191,7 @@ public class ScatterPlotRasterizer implements Rasterizer<ScatterPlot> {
int
tickPos
=
y
*
yAxisStepWidth
;
double
val
=
tickPos
/
yRatio
;
LOG
.
debug
(
"Adding y axis label {{},{}} for tick #{}"
,
label
,
val
,
y
);
yAxisLegendSymbols
.
put
(
String
.
valueOf
(
label
),
String
.
valueOf
(
val
));
yAxisLegendSymbols
.
put
(
String
.
valueOf
(
label
),
formatDouble
(
val
));
label
++;
}
...
...
@@ -220,4 +222,8 @@ public class ScatterPlotRasterizer implements Rasterizer<ScatterPlot> {
LOG
.
trace
(
"Stretching {} to {}, cellSize: {}"
,
dots
,
result
,
cellDots
);
return
result
;
}
private
static
String
formatDouble
(
final
double
d
)
{
return
String
.
format
(
NUMBER_LOCALE
,
"%.2f"
,
d
);
}
}
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