I have create a graph which shows years and salaries and I want to show a label mark every 5 years and a mark tevery years on my horizontal axis .My graph is a scatter graph and I find to show the label every 5 years,not to show ticks marks every years .Can somebody help me ?
Here is my code :
jfreechart = ChartFactory.createScatterPlot(
"",
"Age",
"Salaire",
new XYSeriesCollection(),
PlotOrientation.VERTICAL,
false,
true,
false);
jfreechart.getXYPlot().getDomainAxis().setRange(
miniAge,
maxiAge);
jfreechart.getXYPlot().getRangeAxis().setRange(
miniSalaire,
maxiSalaire);
}
XYPlot plot = jfreechart.getXYPlot();
// changer l'incrémentation de l'axe horizontal
NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
Stroke stroke= domainAxis.getTickMarkStroke();
domainAxis.setTickUnit(new NumberTickUnit(5));
domainAxis.setTickLabelsVisible(true);
jfreechart.setBackgroundPaint(new Color(226, 240, 204));
how to show tickslabel with scatterplot
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Unfortunately there is no support for major/minor tick marks in the current NumberAxis or DateAxis classes. It would be a good feature to have, you are not the first to ask for it.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

