Example usage for org.jfree.chart.renderer.xy CandlestickRenderer setDrawVolume

List of usage examples for org.jfree.chart.renderer.xy CandlestickRenderer setDrawVolume

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.xy CandlestickRenderer setDrawVolume.

Prototype

public void setDrawVolume(boolean flag) 

Source Link

Document

Sets a flag that controls whether or not volume bars are drawn in the background and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java

/**
 *
 * @param evaluation/*from w w w .j a va2 s  .  c om*/
 * @throws net.sf.fspdfs.engine.JRException
 */
protected JFreeChart createCandlestickChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createCandlestickChart(
            (String) evaluateExpression(getChart().getTitleExpression()),
            (String) evaluateExpression(((JRCandlestickPlot) getPlot()).getTimeAxisLabelExpression()),
            (String) evaluateExpression(((JRCandlestickPlot) getPlot()).getValueAxisLabelExpression()),
            (DefaultHighLowDataset) getDataset(), isShowLegend());

    configureChart(jfreeChart, getPlot());

    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRCandlestickPlot candlestickPlot = (JRCandlestickPlot) getPlot();
    CandlestickRenderer candlestickRenderer = (CandlestickRenderer) xyPlot.getRenderer();
    boolean isShowVolume = candlestickPlot.getShowVolume() == null ? true
            : candlestickPlot.getShowVolume().booleanValue();
    candlestickRenderer.setDrawVolume(isShowVolume);

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), candlestickPlot.getTimeAxisLabelFont(),
            candlestickPlot.getTimeAxisLabelColor(), candlestickPlot.getTimeAxisTickLabelFont(),
            candlestickPlot.getTimeAxisTickLabelColor(), candlestickPlot.getTimeAxisTickLabelMask(),
            candlestickPlot.getTimeAxisVerticalTickLabels(), candlestickPlot.getOwnTimeAxisLineColor(),
            getDomainAxisSettings(),
            (Comparable) evaluateExpression(candlestickPlot.getDomainAxisMinValueExpression()),
            (Comparable) evaluateExpression(candlestickPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(xyPlot.getRangeAxis(), candlestickPlot.getValueAxisLabelFont(),
            candlestickPlot.getValueAxisLabelColor(), candlestickPlot.getValueAxisTickLabelFont(),
            candlestickPlot.getValueAxisTickLabelColor(), candlestickPlot.getValueAxisTickLabelMask(),
            candlestickPlot.getValueAxisVerticalTickLabels(), candlestickPlot.getOwnValueAxisLineColor(),
            getRangeAxisSettings(),
            (Comparable) evaluateExpression(candlestickPlot.getRangeAxisMinValueExpression()),
            (Comparable) evaluateExpression(candlestickPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.java

/**
 *
 *//* www .j  av  a 2  s.c om*/
protected JFreeChart createCandlestickChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createCandlestickChart(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRCandlestickPlot) getPlot()).getTimeAxisLabelExpression()),
            evaluateTextExpression(((JRCandlestickPlot) getPlot()).getValueAxisLabelExpression()),
            (DefaultHighLowDataset) getDataset(), isShowLegend());

    configureChart(jfreeChart, getPlot());

    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRCandlestickPlot candlestickPlot = (JRCandlestickPlot) getPlot();
    CandlestickRenderer candlestickRenderer = (CandlestickRenderer) xyPlot.getRenderer();
    boolean isShowVolume = candlestickPlot.getShowVolume() == null ? true : candlestickPlot.getShowVolume();
    candlestickRenderer.setDrawVolume(isShowVolume);

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), candlestickPlot.getTimeAxisLabelFont(),
            candlestickPlot.getTimeAxisLabelColor(), candlestickPlot.getTimeAxisTickLabelFont(),
            candlestickPlot.getTimeAxisTickLabelColor(), candlestickPlot.getTimeAxisTickLabelMask(),
            candlestickPlot.getTimeAxisVerticalTickLabels(), candlestickPlot.getOwnTimeAxisLineColor(), false,
            (Comparable<?>) evaluateExpression(candlestickPlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(candlestickPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(xyPlot.getRangeAxis(), candlestickPlot.getValueAxisLabelFont(),
            candlestickPlot.getValueAxisLabelColor(), candlestickPlot.getValueAxisTickLabelFont(),
            candlestickPlot.getValueAxisTickLabelColor(), candlestickPlot.getValueAxisTickLabelMask(),
            candlestickPlot.getValueAxisVerticalTickLabels(), candlestickPlot.getOwnValueAxisLineColor(), true,
            (Comparable<?>) evaluateExpression(candlestickPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(candlestickPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java

/**
 *
 *//*from  w  w  w  .  j  a v a 2s. c  o m*/
protected JFreeChart createCandlestickChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createCandlestickChart(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRCandlestickPlot) getPlot()).getTimeAxisLabelExpression()),
            evaluateTextExpression(((JRCandlestickPlot) getPlot()).getValueAxisLabelExpression()),
            (DefaultHighLowDataset) getDataset(), isShowLegend());

    configureChart(jfreeChart, getPlot());

    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRCandlestickPlot candlestickPlot = (JRCandlestickPlot) getPlot();
    CandlestickRenderer candlestickRenderer = (CandlestickRenderer) xyPlot.getRenderer();
    boolean isShowVolume = candlestickPlot.getShowVolume() == null ? true : candlestickPlot.getShowVolume();
    candlestickRenderer.setDrawVolume(isShowVolume);

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), candlestickPlot.getTimeAxisLabelFont(),
            candlestickPlot.getTimeAxisLabelColor(), candlestickPlot.getTimeAxisTickLabelFont(),
            candlestickPlot.getTimeAxisTickLabelColor(), candlestickPlot.getTimeAxisTickLabelMask(),
            candlestickPlot.getTimeAxisVerticalTickLabels(), candlestickPlot.getOwnTimeAxisLineColor(),
            getDomainAxisSettings(),
            (Comparable<?>) evaluateExpression(candlestickPlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(candlestickPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(xyPlot.getRangeAxis(), candlestickPlot.getValueAxisLabelFont(),
            candlestickPlot.getValueAxisLabelColor(), candlestickPlot.getValueAxisTickLabelFont(),
            candlestickPlot.getValueAxisTickLabelColor(), candlestickPlot.getValueAxisTickLabelMask(),
            candlestickPlot.getValueAxisVerticalTickLabels(), candlestickPlot.getOwnValueAxisLineColor(),
            getRangeAxisSettings(),
            (Comparable<?>) evaluateExpression(candlestickPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(candlestickPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}