Skip to content
Snippets Groups Projects
Commit 11204bc4 authored by Tim Molter's avatar Tim Molter
Browse files

rename/cleanup [ci skip]

parent a5c2f77e
No related branches found
No related tags found
No related merge requests found
Showing
with 21 additions and 18 deletions
......@@ -195,7 +195,7 @@ public class XChartDemo extends JPanel implements TreeSelectionListener {
defaultMutableTreeNode = new DefaultMutableTreeNode(new ChartInfo("AreaChart02 - Null Y-Axis Data Points", new AreaChart02().getChart()));
category.add(defaultMutableTreeNode);
defaultMutableTreeNode = new DefaultMutableTreeNode(new ChartInfo("AreaLineChart03 - Combination Line & Area Chart", new AreaLineChart03().getChart()));
defaultMutableTreeNode = new DefaultMutableTreeNode(new ChartInfo("AreaLineChart03 - Combination Are & Line Chart", new AreaLineChart03().getChart()));
category.add(defaultMutableTreeNode);
// Line category
......
......@@ -255,8 +255,8 @@ public class AreaLineChart03 implements ExampleChart {
chart.getStyleManager().setYAxisDecimalPattern("$ #,###.##");
chart.getStyleManager().setPlotPadding(0);
chart.getStyleManager().setAxisTickSpaceRatio(1);
chart.getStyleManager().setYAxisMax(1620725 * 1.15); // We want to ensure there is a % of padding on the top of the chart
chart.getStyleManager().setAxisTickSpacePercentage(.95);
// chart.getStyleManager().setYAxisMax(1620725 * 1.15); // We want to ensure there is a % of padding on the top of the chart
return chart;
}
......
......@@ -120,7 +120,7 @@ public class StyleManager {
private Double xAxisMax;
private Double yAxisMin;
private Double yAxisMax;
private double axisTickSpaceRatio;
private double axisTickSpacePercentage;
private TextAlignment xAxisLabelAlignment = TextAlignment.Centre;
private TextAlignment yAxisLabelAlignment = TextAlignment.Left;
......@@ -208,7 +208,7 @@ public class StyleManager {
xAxisMax = null;
yAxisMin = null;
yAxisMax = null;
axisTickSpaceRatio = .95;
axisTickSpacePercentage = .95;
// Chart Plot Area ///////////////////////////////
isPlotGridLinesVisible = theme.isPlotGridLinesVisible();
......@@ -872,14 +872,14 @@ public class StyleManager {
return yAxisMax;
}
public void setAxisTickSpaceRatio(double axisTickSpaceRatio) {
public void setAxisTickSpacePercentage(double axisTickSpacePercentage) {
this.axisTickSpaceRatio = axisTickSpaceRatio;
this.axisTickSpacePercentage = axisTickSpacePercentage;
}
public double getAxisTickSpaceRatio() {
public double getAxisTickSpacePercentage() {
return axisTickSpaceRatio;
return axisTickSpacePercentage;
}
public TextAlignment getXAxisLabelAlignment() {
......
......@@ -51,7 +51,7 @@ public class AxisTickBarChartCalculator extends AxisTickCalculator {
private void calculate(ChartPainter chartPainter) {
// tick space - a percentage of the working space available for ticks
int tickSpace = (int) (styleManager.getAxisTickSpaceRatio() * workingSpace); // in plot space
int tickSpace = (int) (styleManager.getAxisTickSpacePercentage() * workingSpace); // in plot space
// where the tick should begin in the working space in pixels
double margin = Utils.getTickStartOffset(workingSpace, tickSpace); // in plot space double gridStep = getGridStepForDecimal(tickSpace);
......
......@@ -47,7 +47,7 @@ public class AxisTickDateCalculator extends AxisTickCalculator {
private void calculate() {
// tick space - a percentage of the working space available for ticks
double tickSpace = styleManager.getAxisTickSpaceRatio() * workingSpace; // in plot space
double tickSpace = styleManager.getAxisTickSpacePercentage() * workingSpace; // in plot space
// where the tick should begin in the working space in pixels
double margin = Utils.getTickStartOffset(workingSpace, tickSpace); // in plot space double gridStep = getGridStepForDecimal(tickSpace);
......
......@@ -69,6 +69,7 @@ public class AxisTickLabels implements ChartPart {
for (int i = 0; i < axisTick.getTickLabels().size(); i++) {
String tickLabel = axisTick.getTickLabels().get(i);
// System.out.println("** " + tickLabel);
double tickLocation = axisTick.getTickLocations().get(i);
double flippedTickLocation = yOffset + height - tickLocation;
......
......@@ -56,7 +56,7 @@ public class AxisTickLogarithmicCalculator extends AxisTickCalculator {
}
// tick space - a percentage of the working space available for ticks
double tickSpace = styleManager.getAxisTickSpaceRatio() * workingSpace; // in plot space
double tickSpace = styleManager.getAxisTickSpacePercentage() * workingSpace; // in plot space
// where the tick should begin in the working space in pixels
double margin = Utils.getTickStartOffset(workingSpace, tickSpace); // in plot space double gridStep = getGridStepForDecimal(tickSpace);
......
......@@ -57,7 +57,7 @@ public class AxisTickNumericalCalculator extends AxisTickCalculator {
}
// tick space - a percentage of the working space available for ticks
double tickSpace = styleManager.getAxisTickSpaceRatio() * workingSpace; // in plot space
double tickSpace = styleManager.getAxisTickSpacePercentage() * workingSpace; // in plot space
// where the tick should begin in the working space in pixels
double margin = Utils.getTickStartOffset(workingSpace, tickSpace); // in plot space double gridStep = getGridStepForDecimal(tickSpace);
......@@ -74,7 +74,9 @@ public class AxisTickNumericalCalculator extends AxisTickCalculator {
// generate all tickLabels and tickLocations from the first to last position
for (BigDecimal tickPosition = cleanedFirstPosition; tickPosition.compareTo(BigDecimal.valueOf(maxValue + 2 * cleanedGridStep.doubleValue())) < 0; tickPosition = tickPosition.add(cleanedGridStep)) {
tickLabels.add(numberFormatter.formatNumber(tickPosition, minValue, maxValue, axisDirection));
String tickLabel = numberFormatter.formatNumber(tickPosition, minValue, maxValue, axisDirection);
// System.out.println(tickLabel);
tickLabels.add(tickLabel);
// here we convert tickPosition finally to plot space, i.e. pixels
double tickLabelPosition = margin + ((tickPosition.doubleValue() - minValue) / (maxValue - minValue) * tickSpace);
tickLocations.add(tickLabelPosition);
......
......@@ -47,11 +47,11 @@ public class PlotContentBarChart extends PlotContent {
StyleManager styleManager = plot.getChartPainter().getStyleManager();
// X-Axis
double xTickSpace = styleManager.getAxisTickSpaceRatio() * bounds.getWidth();
double xTickSpace = styleManager.getAxisTickSpacePercentage() * bounds.getWidth();
double xLeftMargin = Utils.getTickStartOffset(bounds.getWidth(), xTickSpace);
// Y-Axis
double yTickSpace = styleManager.getAxisTickSpaceRatio() * bounds.getHeight();
double yTickSpace = styleManager.getAxisTickSpacePercentage() * bounds.getHeight();
double yTopMargin = Utils.getTickStartOffset(bounds.getHeight(), yTickSpace);
int numBars = getChartPainter().getAxisPair().getSeriesMap().values().iterator().next().getXData().size();
......
......@@ -55,11 +55,11 @@ public class PlotContentLineChart extends PlotContent {
g.setClip(bounds);
// X-Axis
double xTickSpace = styleManager.getAxisTickSpaceRatio() * bounds.getWidth();
double xTickSpace = styleManager.getAxisTickSpacePercentage() * bounds.getWidth();
double xLeftMargin = Utils.getTickStartOffset((int) bounds.getWidth(), xTickSpace);
// Y-Axis
double yTickSpace = styleManager.getAxisTickSpaceRatio() * bounds.getHeight();
double yTickSpace = styleManager.getAxisTickSpacePercentage() * bounds.getHeight();
double yTopMargin = Utils.getTickStartOffset((int) bounds.getHeight(), yTickSpace);
for (Series series : getChartPainter().getAxisPair().getSeriesMap().values()) {
......
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