Hello,
I'm building few charts the same way but some of them is not showing the y axis ticks.
Any idea why?
I cant know the charts range before. It can be negative\positive numbers, can be very small, or large numbers.
This is my code:
JFreeChart chart = ChartFactory.createXYLineChart(
chartName,
"",
"",
seriesCollection,
PlotOrientation.VERTICAL,
seriesCollection.getSeries().size() > 1,
true,
false
);
XYPlot plot = (XYPlot) chart.getPlot();
chart.addSubtitle(new TextTitle(chartName);
ValueMarker lowMarker = new ValueMarker();
ValueMarker highMarker = new ValueMarker();
lowMarker.setPaint(Color.BLACK);
lowMarker.setLabel("Minimum");
lowMarker.setLabelAnchor(RectangleAnchor.TOP);
highMarker.setPaint(Color.BLACK);
highMarker.setLabelAnchor(RectangleAnchor.BOTTOM);
highMarker.setLabel("Maximum");
plot.addRangeMarker(lowMarker);
plot.addRangeMarker(highMarker);
ValueMarker marker = new ValueMarker(dataInfo.getTakeoffTime().getTime(), Color.RED, new BasicStroke(1f));
marker.setLabelOffset(new RectangleInsets(10, 0, 0, 0));
plot.addDomainMarker(marker);
ValueMarker marker = new ValueMarker(dataInfo.getLandingTime().getTime(), Color.RED, new BasicStroke(1f));
marker.setLabelOffset(new RectangleInsets(10, 0, 0, 0));
plot.addDomainMarker(marker);
DateAxis dateAxis = new DateAxis();
dateAxis.setDateFormatOverride(dateFormat);
plot.setDomainAxis(dateAxis);
NumberAxis yAxis = new NumberAxis();
yAxis.setFixedDimension(35);
yAxis.setAutoRangeIncludesZero(false);
yAxis.setLabel(seriesCollection.getYAxisLabel());
yAxis.setNumberFormatOverride(decimalFormat);
yAxis.setTickMarksVisible(false);
yAxis.setAutoTickUnitSelection(isAutoTickUnitSelection());
plot.setRangeAxis(yAxis);
Y axis numbers dissapeared
-
- Posts: 1
- Joined: Wed Oct 17, 2018 10:28 am
- antibot: No, of course not.
Re: Y axis numbers dissapeared
I have also encountered the same problemzoltanik wrote: ↑Sun Mar 04, 2018 10:47 amHello,
I'm building few charts the same way but some of them is not showing the y axis ticks.
Any idea why?
I cant know the charts range before. It can be negative\positive numbers, can be very small, or large numbers.
This is my code:
JFreeChart chart = ChartFactory.createXYLineChart(
chartName,
"",
"",
seriesCollection,
PlotOrientation.VERTICAL,
seriesCollection.getSeries().size() > 1,
true,
false
);
XYPlot plot = (XYPlot) chart.getPlot();
chart.addSubtitle(new TextTitle(chartName);
ValueMarker lowMarker = new ValueMarker();
ValueMarkerbest cordless drill best miter saw best gaming laptop under 500 best reel mowerhighMarker = new ValueMarker();
lowMarker.setPaint(Color.BLACK);
lowMarker.setLabel("Minimum");
lowMarker.setLabelAnchor(RectangleAnchor.TOP);
highMarker.setPaint(Color.BLACK);
highMarker.setLabelAnchor(RectangleAnchor.BOTTOM);
highMarker.setLabel("Maximum");
plot.addRangeMarker(lowMarker);
plot.addRangeMarker(highMarker);
ValueMarker marker = new ValueMarker(dataInfo.getTakeoffTime().getTime(), Color.RED, new BasicStroke(1f));
marker.setLabelOffset(new RectangleInsets(10, 0, 0, 0));
plot.addDomainMarker(marker);
ValueMarker marker = new ValueMarker(dataInfo.getLandingTime().getTime(), Color.RED, new BasicStroke(1f));
marker.setLabelOffset(new RectangleInsets(10, 0, 0, 0));
plot.addDomainMarker(marker);
DateAxis dateAxis = new DateAxis();
dateAxis.setDateFormatOverride(dateFormat);
plot.setDomainAxis(dateAxis);
NumberAxis yAxis = new NumberAxis();
yAxis.setFixedDimension(35);
yAxis.setAutoRangeIncludesZero(false);
yAxis.setLabel(seriesCollection.getYAxisLabel());
yAxis.setNumberFormatOverride(decimalFormat);
yAxis.setTickMarksVisible(false);
yAxis.setAutoTickUnitSelection(isAutoTickUnitSelection());
plot.setRangeAxis(yAxis);