how to show tickslabel with scatterplot

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
ahury
Posts: 14
Joined: Tue Apr 24, 2007 3:20 pm

how to show tickslabel with scatterplot

Post by ahury » Tue Apr 24, 2007 3:40 pm

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));

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Apr 25, 2007 8:33 am

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

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

ahury
Posts: 14
Joined: Tue Apr 24, 2007 3:20 pm

Post by ahury » Wed Apr 25, 2007 10:58 am

Is it possible to make this by rewrite the method refreshTicksHorizontal of NumberAxis.

Locked