private void plotTradeBubblesOnChart(ArrayList<Integer> toPlot, String p, int k, int j) { final Plot main_plot = (Plot)((CombinedDomainXYPlot)this.candlestickChart.getPlot()).getSubplots().get(0); final XYPlot plot = (XYPlot) main_plot; final TimeSeries series = new TimeSeries(p); ///* for(Integer i: toPlot) { switch(j) { case 0: series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getOpen()); break; case 1: series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getHigh()); break; case 2: series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getLow()); break; case 3: series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getClose()); break; } } /* for (int i = 0; i < defaultHighLowDataset.getSeriesCount(); i++) { series.add(new Minute(defaultHighLowDataset.getXDate(0, i)),plot[i]); } */ XYDataset dataSet = new TimeSeriesCollection(series); plot.setDataset(k, dataSet); XYItemRenderer ir = new XYShapeRenderer(); //ir.s plot.setRenderer(k, ir); }
private void customizeChart(JFreeChart chart) { XYPlot plot = chart.getXYPlot(); // XYLineAndShapeRenderer does both lines and shapes // XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); // For XYLineAndShapeRenderer: set thickness for series (using strokes) // renderer.setSeriesStroke(0, new BasicStroke(1.0f)); // XYShapeRenderer does shapes only XYShapeRenderer renderer = new XYShapeRenderer(); renderer.setSeriesShape(0, new Ellipse2D.Double(-1.5,-1.5,3,3)); // sets paint color renderer.setSeriesPaint(0, Color.RED); // sets paint color for plot outlines (chart borders) // plot.setOutlinePaint(Color.BLUE); // plot.setOutlineStroke(new BasicStroke(2.0f)); // sets renderer for lines plot.setRenderer(renderer); // sets plot background // plot.setBackgroundPaint(Color.DARK_GRAY); // sets paint color for the grid lines // plot.setRangeGridlinesVisible(true); // plot.setRangeGridlinePaint(Color.BLACK); // plot.setDomainGridlinesVisible(true); // plot.setDomainGridlinePaint(Color.BLACK); }
private void customizeChart(JFreeChart chart) { XYPlot plot = chart.getXYPlot(); // XYLineAndShapeRenderer does both lines and shapes // XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); // For XYLineAndShapeRenderer: set thickness for series (using strokes) // renderer.setSeriesStroke(0, new BasicStroke(1.0f)); // XYShapeRenderer does shapes only XYShapeRenderer renderer = new XYShapeRenderer(); renderer.setSeriesShape(0, new Ellipse2D.Double(-0.75,-0.75,1.5,1.5)); // sets paint color renderer.setSeriesPaint(0, Color.RED); // sets paint color for plot outlines (chart borders) // plot.setOutlinePaint(Color.BLUE); // plot.setOutlineStroke(new BasicStroke(2.0f)); // sets renderer for lines plot.setRenderer(renderer); // sets plot background // plot.setBackgroundPaint(Color.DARK_GRAY); // sets paint color for the grid lines // plot.setRangeGridlinesVisible(true); // plot.setRangeGridlinePaint(Color.BLACK); // plot.setDomainGridlinesVisible(true); // plot.setDomainGridlinePaint(Color.BLACK); }
protected void resetRenderer(final IScope scope, final String serieid) { final AbstractXYItemRenderer newr = (AbstractXYItemRenderer) this.getOrCreateRenderer(scope, serieid); // newr.setSeriesStroke(0, new BasicStroke(0)); newr.setBaseCreateEntities(true); final ChartDataSeries myserie = this.getChartdataset().getDataSeries(scope, serieid); if (newr instanceof XYLineAndShapeRenderer) { ((XYLineAndShapeRenderer) newr).setSeriesLinesVisible(0, myserie.getMysource().showLine); ((XYLineAndShapeRenderer) newr).setSeriesShapesFilled(0, myserie.getMysource().fillMarker); ((XYLineAndShapeRenderer) newr).setSeriesShapesVisible(0, myserie.getMysource().useMarker); } if (newr instanceof XYShapeRenderer) { if (!myserie.getMysource().fillMarker) { ((XYShapeRenderer) newr).setUseFillPaint(false); // ((XYShapeRenderer) newr).setDrawOutlines(true); } } if (myserie.getMycolor() != null) { newr.setSeriesPaint(0, myserie.getMycolor()); } newr.setSeriesStroke(0, new BasicStroke((float) myserie.getLineThickness())); if (newr instanceof myXYErrorRenderer) { ((myXYErrorRenderer) newr).setDrawYError(false); ((myXYErrorRenderer) newr).setDrawXError(false); if (myserie.isUseYErrValues()) ((myXYErrorRenderer) newr).setDrawYError(true); if (myserie.isUseXErrValues()) ((myXYErrorRenderer) newr).setDrawXError(true); if (myserie.getMysource().isUseSize()) ((myXYErrorRenderer) newr).setUseSize(scope, true); } if (myserie.getMysource().getUniqueMarkerName() != null) setSerieMarkerShape(scope, myserie.getName(), myserie.getMysource().getUniqueMarkerName()); }
/** * Some checks for the equals() method. */ public void testEquals() { XYShapeRenderer r1 = new XYShapeRenderer(); XYShapeRenderer r2 = new XYShapeRenderer(); assertTrue(r1.equals(r2)); assertTrue(r2.equals(r1)); r1.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white)); assertFalse(r1.equals(r2)); r2.setPaintScale(new LookupPaintScale(1.0, 2.0, Color.white)); assertTrue(r1.equals(r2)); r1.setDrawOutlines(true); assertFalse(r1.equals(r2)); r2.setDrawOutlines(true); assertTrue(r1.equals(r2)); r1.setUseOutlinePaint(false); assertFalse(r1.equals(r2)); r2.setUseOutlinePaint(false); assertTrue(r1.equals(r2)); r1.setUseFillPaint(true); assertFalse(r1.equals(r2)); r2.setUseFillPaint(true); assertTrue(r1.equals(r2)); r1.setGuideLinesVisible(true); assertFalse(r1.equals(r2)); r2.setGuideLinesVisible(true); assertTrue(r1.equals(r2)); r1.setGuideLinePaint(Color.red); assertFalse(r1.equals(r2)); r2.setGuideLinePaint(Color.red); assertTrue(r1.equals(r2)); }