Code: Select all
DefaultHighLowDataset dataset1 = createStockDataset(stock, stockData, start, end);
TimeSeriesCollection dataset3 = createSignalsDataset(stock, stockData, start, end);
JFreeChart chart = createChart(dataset1, stock);
XYPlot plot = (XYPlot) chart.getPlot();
XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
renderer2.setUseOutlinePaint(false);
renderer2.setSeriesPaint(0, Color.green);
renderer2.setSeriesPaint(1, Color.red);
renderer2.setSeriesStroke(0, new BasicStroke(0.0f));
renderer2.setSeriesStroke(1, new BasicStroke(0.0f));
plot.setDataset(2, dataset3);
plot.setRenderer(2, renderer2);
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxisForDataset(2);
rangeAxis.setAutoRangeIncludesZero(false);
rangeAxis.setTickMarkInsideLength(1.0f);
rangeAxis.setTickMarkOutsideLength(1.0f);
rangeAxis.setMinorTickCount(1);
rangeAxis.setMinorTickMarksVisible(true);
ChartPanel chartPanel = new ChartPanel(chart, false);
chartPanel.setPreferredSize(new Dimension(1000, 500));
setContentPane(chartPanel);
What I am really trying to get is:
(I used an image editor to get this)
I am very, very close. Can anybody help get this right?