/** * Returns the range of values the renderer requires to display all the * items from the specified dataset. * * @param dataset the dataset (<code>null</code> permitted). * * @return The range (<code>null</code> if the dataset is <code>null</code> * or empty). */ public Range findRangeBounds(XYDataset dataset) { return findRangeBounds(dataset, true); }
/** * Sets the paint used to fill candles when the price moves down from open * to close and sends a {@link RendererChangeEvent} to all registered * listeners. * * @param paint The paint (<code>null</code> permitted). */ public void setDownPaint(Paint paint) { this.downPaint = paint; fireChangeEvent(); }
CandlestickRenderer r = (CandlestickRenderer) chart.getXYPlot().getRenderer(); r.setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST);
Paint p = getItemPaint(series, item); Paint outlinePaint = null; if (this.useOutlinePaint) { outlinePaint = getItemOutlinePaint(series, item); Stroke s = getItemStroke(series, item); g2.setPaint(getVolumePaint()); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance( addEntity(entities, hotspot, dataset, series, item, 0.0, 0.0);
final DateAxis domainAxis = new DateAxis("Date"); NumberAxis rangeAxis = new NumberAxis("Price"); CandlestickRenderer renderer = new CandlestickRenderer(); XYDataset dataset = getDataSet(stockSymbol); XYPlot mainPlot = new XYPlot(dataset, domainAxis, rangeAxis, renderer); renderer.setSeriesPaint(0, Color.BLACK); renderer.setDrawVolume(false); rangeAxis.setAutoRangeIncludesZero(false);
true); CandlestickRenderer renderer = new CandlestickRenderer(); renderer.setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST); XYPlot plot = chart.getXYPlot(); plot.setRenderer(renderer);
/** * Creates and returns a default instance of a candlesticks chart. * * @param title the chart title ({@code null} permitted). * @param timeAxisLabel a label for the time axis ({@code null} * permitted). * @param valueAxisLabel a label for the value axis ({@code null} * permitted). * @param dataset the dataset for the chart ({@code null} permitted). * @param legend a flag specifying whether or not a legend is required. * * @return A candlestick chart. */ public static JFreeChart createCandlestickChart(String title, String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset, boolean legend) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); NumberAxis valueAxis = new NumberAxis(valueAxisLabel); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null); plot.setRenderer(new CandlestickRenderer()); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
CandlestickRenderer candlestickRenderer = (CandlestickRenderer) xyPlot.getRenderer(); boolean isShowVolume = candlestickPlot.getShowVolume() == null ? true : candlestickPlot.getShowVolume().booleanValue(); candlestickRenderer.setDrawVolume(isShowVolume);
Paint p = getItemPaint(series, item); Paint outlinePaint = null; if (this.useOutlinePaint) { outlinePaint = getItemOutlinePaint(series, item); Stroke s = getItemStroke(series, item); g2.setPaint(getVolumePaint()); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance( addEntity(entities, hotspot, dataset, series, item, 0.0, 0.0);
/** * Creates and returns a default instance of a candlesticks chart. * * @param title the chart title (<code>null</code> permitted). * @param timeAxisLabel a label for the time axis (<code>null</code> * permitted). * @param valueAxisLabel a label for the value axis (<code>null</code> * permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag specifying whether or not a legend is required. * * @return A candlestick chart. */ public static JFreeChart createCandlestickChart(String title, String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset, boolean legend) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); NumberAxis valueAxis = new NumberAxis(valueAxisLabel); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null); plot.setRenderer(new CandlestickRenderer()); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
/** * Sets the paint used to fill candles when the price moves down from open * to close and sends a {@link RendererChangeEvent} to all registered * listeners. * * @param paint The paint ({@code null} permitted). */ public void setDownPaint(Paint paint) { this.downPaint = paint; fireChangeEvent(); }
/** * Returns the range of values the renderer requires to display all the * items from the specified dataset. * * @param dataset the dataset ({@code null} permitted). * * @return The range ({@code null} if the dataset is {@code null} * or empty). */ @Override public Range findRangeBounds(XYDataset dataset) { return findRangeBounds(dataset, true); }
chart.getXYPlot().setOrientation(PlotOrientation.VERTICAL); CandlestickRenderer r = (CandlestickRenderer) chart.getXYPlot().getRenderer(); r.setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST);
/** * Sets the paint used to fill candles when the price moves up from open * to close and sends a {@link RendererChangeEvent} to all registered * listeners. * * @param paint the paint ({@code null} permitted). * * @see #getUpPaint() */ public void setUpPaint(Paint paint) { this.upPaint = paint; fireChangeEvent(); }
/** * Sets the paint used to fill candles when the price moves up from open * to close and sends a {@link RendererChangeEvent} to all registered * listeners. * * @param paint the paint (<code>null</code> permitted). * * @see #getUpPaint() */ public void setUpPaint(Paint paint) { this.upPaint = paint; fireChangeEvent(); }
/** * Sets a flag that controls whether or not volume bars are drawn in the * background and sends a {@link RendererChangeEvent} to all registered * listeners. * * @param flag the flag. * * @see #getDrawVolume() */ public void setDrawVolume(boolean flag) { if (this.drawVolume != flag) { this.drawVolume = flag; fireChangeEvent(); } }
/** * Sets a flag that controls whether or not volume bars are drawn in the * background and sends a {@link RendererChangeEvent} to all registered * listeners. * * @param flag the flag. * * @see #getDrawVolume() */ public void setDrawVolume(boolean flag) { if (this.drawVolume != flag) { this.drawVolume = flag; fireChangeEvent(); } }
/** * Sets the flag that controls whether or not the renderer's outline * paint is used to draw the candlestick outline, and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param use the new flag value. * * @since 1.0.5 * * @see #getUseOutlinePaint() */ public void setUseOutlinePaint(boolean use) { if (this.useOutlinePaint != use) { this.useOutlinePaint = use; fireChangeEvent(); } }
/** * Sets the maximum candle width (in milliseconds) and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param millis The maximum width. * * @see #getMaxCandleWidthInMilliseconds() * @see #setCandleWidth(double) * @see #setAutoWidthMethod(int) * @see #setAutoWidthGap(double) * @see #setAutoWidthFactor(double) */ public void setMaxCandleWidthInMilliseconds(double millis) { this.maxCandleWidthInMilliseconds = millis; fireChangeEvent(); }
/** * Sets the factor by which the available space automatically calculated * for the candles will be multiplied to determine the actual width to use. * * @param autoWidthFactor The width factor (generally between 0.0 and 1.0). * * @see #getAutoWidthFactor() * @see #setCandleWidth(double) * @see #setAutoWidthMethod(int) * @see #setAutoWidthGap(double) * @see #setMaxCandleWidthInMilliseconds(double) */ public void setAutoWidthFactor(double autoWidthFactor) { if (this.autoWidthFactor != autoWidthFactor) { this.autoWidthFactor = autoWidthFactor; fireChangeEvent(); } }