Skip to content
Snippets Groups Projects
Commit cf355efa authored by Georg Graßnick's avatar Georg Graßnick :thinking:
Browse files

Use final static constant for legend tick start char

parent b345ffb8
No related branches found
No related tags found
1 merge request!43Feat/scatterplot rasterizer 34
...@@ -29,6 +29,7 @@ public class ScatterPlotRasterizer implements Rasterizer<ScatterPlot> { ...@@ -29,6 +29,7 @@ public class ScatterPlotRasterizer implements Rasterizer<ScatterPlot> {
private static final int Y_AXIS_STEP_WIDTH = 3; // The distance between two tick marks on the y 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 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 Locale NUMBER_LOCALE = new Locale("en", "US");
private static final char LEGEND_TICK_START_CHAR = 'a';
private static final Logger LOG = LoggerFactory.getLogger(ScatterPlotRasterizer.class); private static final Logger LOG = LoggerFactory.getLogger(ScatterPlotRasterizer.class);
...@@ -155,7 +156,7 @@ public class ScatterPlotRasterizer implements Rasterizer<ScatterPlot> { ...@@ -155,7 +156,7 @@ public class ScatterPlotRasterizer implements Rasterizer<ScatterPlot> {
Map<Integer, String> xAxisLabels = new HashMap<>(); Map<Integer, String> xAxisLabels = new HashMap<>();
xAxis.setLabels(xAxisLabels); xAxis.setLabels(xAxisLabels);
final int xAxisTickCount = xDots / xAxisStepWidth; final int xAxisTickCount = xDots / xAxisStepWidth;
char label = 'a'; char label = LEGEND_TICK_START_CHAR;
for (int x = 0; x < xAxisTickCount; x++) { for (int x = 0; x < xAxisTickCount; x++) {
xAxisLabels.put(x, String.valueOf(label)); xAxisLabels.put(x, String.valueOf(label));
int tickPos = x * xAxisStepWidth; int tickPos = x * xAxisStepWidth;
...@@ -261,6 +262,6 @@ public class ScatterPlotRasterizer implements Rasterizer<ScatterPlot> { ...@@ -261,6 +262,6 @@ public class ScatterPlotRasterizer implements Rasterizer<ScatterPlot> {
@SuppressWarnings("checkstyle:MagicNumber") @SuppressWarnings("checkstyle:MagicNumber")
// char 'a' = 97 -> set to 96 so the lowest element is set to 'a' itself // char 'a' = 97 -> set to 96 so the lowest element is set to 'a' itself
private static char getStartChar(final int elemCount) { private static char getStartChar(final int elemCount) {
return (char) (96 + elemCount); return (char) (LEGEND_TICK_START_CHAR - 1 + elemCount);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment