Jfreechart版本1.0.19,实现效果 — 鼠标滑动显示横纵坐标线,标题显示鼠标当前点对应的数据。
import java.awt.Font;
import java.text.DecimalFormat;
import java.util.Date;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.StandardChartTheme;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.axis.NumberTickUnit;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.data.time.Day;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.data.xy.XYDataset;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RectangleEdge;
import org.jfree.ui.RefineryUtilities;
import com.fda.fc.chart.GraphPanel;
import com.fda.fc.utils.DateUtils;
public class GraphChartDemo extends ApplicationFrame {
private static final long serialVersionUID = 6034161131043097089L;
private static final String FRAME_NAME = "资金曲线分析图";
private String varietyCode = "RB";
public GraphChartDemo() {
super(FRAME_NAME);
try {
JFreeChart chart = createChart();
ChartPanel panel = new GraphPanel(chart, varietyCode);
// panel = new ChartPanel(chart);
// panel.setHorizontalAxisTrace(true);
// panel.setVerticalAxisTrace(true);
// panel.setDomainZoomable(true);