Bonjour,

Projet complet :
http://docs.google.com/leaf?id=0B4mZ...YzRhNDdm&hl=en

Résultat de l'exécution de ce projet :


Le jour ou il n'y a pas de cotations, je ne souhaite pas d'espace sur le graphique.

Comment contrôler l'espace entre la bougie et l'axe des Y ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package chart;
 
import java.awt.Color;
import java.awt.Dimension;
 
import javax.swing.JFrame;
 
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.axis.DateTickUnit;
import org.jfree.chart.axis.DateTickUnitType;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.axis.SegmentedTimeline;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.CandlestickRenderer;
import org.jfree.data.xy.XYDataset;
 
public class WinChart extends JFrame {
	// private Quotes quotes;
	private XYPlot mainPlot;
	private ChartPanel chartPanel;
 
	public WinChart() {
		super();
 
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
		DateAxis domainAxis = new DateAxis("Date");
		NumberAxis rangeAxis = new NumberAxis("Price");
		CandlestickRenderer renderer = new CandlestickRenderer();
		XYDataset dataset = null;
		mainPlot = new XYPlot(dataset, domainAxis, rangeAxis, renderer);
 
		// Do some setting up, see the API Doc
		renderer.setSeriesPaint(0, Color.BLACK);
		renderer.setDrawVolume(false);
 
		rangeAxis.setAutoRangeIncludesZero(false);
		domainAxis.setTimeline(SegmentedTimeline
				.newMondayThroughFridayTimeline());
		domainAxis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 1));
 
		// Now create the chart and chart panel
		JFreeChart chart = new JFreeChart("", null, mainPlot, false);
		chartPanel = new ChartPanel(chart);
		chartPanel.setPreferredSize(new Dimension(600, 300));
 
		this.add(chartPanel);
		this.pack();
		this.setLocationRelativeTo(null);
 
		QuotesChart quotesChart = new QuotesChart();
		mainPlot.setDataset(quotesChart.BuildChart());
	}
 
}