I need that this method show the points of the values (in addition to the XYline) (In order to know in what points of the line are the values)
My code I use is:
Code: Select all
public JFreeChart XYLine(String vInDep, String vDep){
XYSeries series = new XYSeries("Leyenda de Línea");
/* We cross the bidimensional Array adding it to the chart, as long as null value by row does not exist */
for (int i=0; i<arrayVars.length; i++){
if( (null != arrayVars[i][0]) && (null != arrayVars[i][1]) ){
float x= Float.parseFloat(arrayVars[i][0]);
float y= Float.parseFloat(arrayVars[i][1]);
series.add(x,y);
}
}
XYDataset ColeccionDatos = new XYSeriesCollection(series);
JFreeChart chart = ChartFactory.createXYLineChart(
"Chart Simple "+vDep+" vs "+vInDep, //Titulo
vInDep, //Leyenda Eje X
vDep, //Leyenda Eje Y
ColeccionDatos, //Dataset
PlotOrientation.HORIZONTAL, //Orientacion
false, //Flag que identifica que la leyenda sea requerida o no
true, //Flag que identifica si se debe generar el tooltip
false //Flag que identifica si el chart debe o no generar URLs
);
XYPlot plot = (XYPlot) chart.getPlot();
NumberAxis rangeAxis = (NumberAxis) plot.getDomainAxis();
rangeAxis.setInverted(true);
/* line´s color */
final XYItemRenderer renderer = (XYItemRenderer)plot.getRenderer();
renderer.setSeriesPaint(0,Color.blue); //since you only have one series.
/* line´s color */
return chart;
}
Other question:
How can I do that the line of the graph is fatter?
Thanks very much!!