Java 类org.jfree.data.xy.DefaultHighLowDataset 实例源码

项目:open-java-trade-manager    文件:ChartJDialog.java   
private OHLCDataset getOHLCDataset(List<Candle> chartDatas) {

        final int size = chartDatas.size();

        Date[] date = new Date[size];
        double[] high = new double[size];
        double[] low = new double[size];
        double[] open = new double[size];
        double[] close = new double[size];
        double[] volume = new double[size];

        int i = 0;
        for(Candle chartData : chartDatas) {
            date[i] = new Date(chartData.getStartTimeStamp());
            high[i] = chartData.getHigh();
            low[i] = chartData.getLow();
            open[i] = chartData.getOpen();
            close[i] = chartData.getClose();
            volume[i] = chartData.getVolume();
            i++;
        }

        return new DefaultHighLowDataset("Price", date, high, low, open, close, volume);
    }
项目:ta4j    文件:CandlestickChart.java   
/**
 * Builds a JFreeChart OHLC dataset from a ta4j time series.
 * @param series a time series
 * @return an Open-High-Low-Close dataset
 */
private static OHLCDataset createOHLCDataset(TimeSeries series) {
    final int nbTicks = series.getTickCount();

    Date[] dates = new Date[nbTicks];
    double[] opens = new double[nbTicks];
    double[] highs = new double[nbTicks];
    double[] lows = new double[nbTicks];
    double[] closes = new double[nbTicks];
    double[] volumes = new double[nbTicks];

    for (int i = 0; i < nbTicks; i++) {
        Tick tick = series.getTick(i);
        dates[i] = new Date(tick.getEndTime().toEpochSecond() * 1000);
        opens[i] = tick.getOpenPrice().toDouble();
        highs[i] = tick.getMaxPrice().toDouble();
        lows[i] = tick.getMinPrice().toDouble();
        closes[i] = tick.getClosePrice().toDouble();
        volumes[i] = tick.getVolume().toDouble();
    }

    OHLCDataset dataset = new DefaultHighLowDataset("btc", dates, highs, lows, opens, closes, volumes);

    return dataset;
}
项目:jasperreports    文件:EyeCandySixtiesChartTheme.java   
@Override
protected JFreeChart createCandlestickChart() throws JRException
{
    JFreeChart jfreeChart = super.createCandlestickChart();
    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    CandlestickRenderer renderer = (CandlestickRenderer)xyPlot.getRenderer();
    DefaultHighLowDataset dataset = (DefaultHighLowDataset)xyPlot.getDataset();
    if (dataset != null)
    {
        for (int i = 0; i < dataset.getSeriesCount(); i++)
        {
            renderer.setSeriesFillPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(i));
            renderer.setSeriesPaint(i, Color.DARK_GRAY);
        }
    }
    return jfreeChart;
}
项目:jasperreports    文件:AegeanChartTheme.java   
@Override
protected JFreeChart createCandlestickChart() throws JRException
{
    JFreeChart jfreeChart = super.createCandlestickChart();
    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    CandlestickRenderer renderer = (CandlestickRenderer)xyPlot.getRenderer();
    DefaultHighLowDataset dataset = (DefaultHighLowDataset)xyPlot.getDataset();
    @SuppressWarnings("unchecked")
    List<Paint> seriesPaints = (List<Paint>)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS);

    for(int i = 0; i < dataset.getSeriesCount(); i++)
    {

        renderer.setSeriesFillPaint(i, seriesPaints.get(i));
        renderer.setSeriesPaint(i, Color.DARK_GRAY);
    }
    return jfreeChart;
}
项目:connect-java-tutorials    文件:TrendBarsChart.java   
/**
 * Sets data and converts it to JFreeChart format
 * @param data Trendbars data
 */
private void setData(String seriesKey, TrendbarJson[] data) {
    Date[] date = new Date[data.length];
    double[] high = new double[data.length];
    double[] low = new double[data.length];
    double[] open = new double[data.length];
    double[] close = new double[data.length];
    double[] volume = new double[data.length];
    for (int i = 0; i < data.length; i++) {
        TrendbarJson trendbar = data[i];
        date[i] = new Date(trendbar.getTimestamp());
        if(trendbar.getHigh() > maxRange) {
            maxRange = trendbar.getHigh();
        }
        high[i] = trendbar.getHigh();
        low[i] = trendbar.getLow();
        if(trendbar.getLow() < minRange) {
            minRange = trendbar.getLow();
        }
        open[i] = trendbar.getOpen();
        close[i] = trendbar.getClose();
        volume[i] = trendbar.getVolume()/100.00;
    }
    this.dataSet = new DefaultHighLowDataset(seriesKey, date, high, low, open, close, volume);
}
项目:ta4j-origins    文件:CandlestickChart.java   
/**
 * Builds a JFreeChart OHLC dataset from a ta4j time series.
 * @param series a time series
 * @return an Open-High-Low-Close dataset
 */
private static OHLCDataset createOHLCDataset(TimeSeries series) {
    final int nbTicks = series.getTickCount();

    Date[] dates = new Date[nbTicks];
    double[] opens = new double[nbTicks];
    double[] highs = new double[nbTicks];
    double[] lows = new double[nbTicks];
    double[] closes = new double[nbTicks];
    double[] volumes = new double[nbTicks];

    for (int i = 0; i < nbTicks; i++) {
        Tick tick = series.getTick(i);
        dates[i] = new Date(tick.getEndTime().toEpochSecond() * 1000);
        opens[i] = tick.getOpenPrice().toDouble();
        highs[i] = tick.getMaxPrice().toDouble();
        lows[i] = tick.getMinPrice().toDouble();
        closes[i] = tick.getClosePrice().toDouble();
        volumes[i] = tick.getVolume().toDouble();
    }

    OHLCDataset dataset = new DefaultHighLowDataset("btc", dates, highs, lows, opens, closes, volumes);

    return dataset;
}
项目:ComputationalEconomy    文件:IndustriesPanel.java   
protected DefaultHighLowDataset getDefaultHighLowDataset(
        final Currency currency, final GoodType goodType) {
    final PricesModel pricesModel = ApplicationContext.getInstance()
            .getModelRegistry().getNationalEconomyModel(currency).pricesModel;

    final Map<GoodType, PriceModel> priceModelsForGoodType = pricesModel
            .getPriceModelsForGoodTypes();
    final PriceModel priceModel = priceModelsForGoodType.get(goodType);

    if (priceModel != null) {
        return new DefaultHighLowDataset("", priceModel.getDate(),
                priceModel.getHigh(), priceModel.getLow(),
                priceModel.getOpen(), priceModel.getClose(),
                priceModel.getVolume());
    }

    return null;
}
项目:ComputationalEconomy    文件:HouseholdsPanel.java   
protected DefaultHighLowDataset getDefaultHighLowDataset(
        final Currency currency) {
    final PricesModel pricesModel = ApplicationContext.getInstance()
            .getModelRegistry().getNationalEconomyModel(currency).pricesModel;

    final Map<GoodType, PriceModel> priceModelsForGoodType = pricesModel
            .getPriceModelsForGoodTypes();
    final PriceModel priceModel = priceModelsForGoodType
            .get(GoodType.LABOURHOUR);

    if (priceModel != null) {
        return new DefaultHighLowDataset("", priceModel.getDate(),
                priceModel.getHigh(), priceModel.getLow(),
                priceModel.getOpen(), priceModel.getClose(),
                priceModel.getVolume());
    }

    return null;
}
项目:ComputationalEconomy    文件:BanksPanel.java   
protected DefaultHighLowDataset getDefaultHighLowDataset(
        final Currency currency, final Currency commodityCurrency) {
    final PricesModel pricesModel = ApplicationContext.getInstance()
            .getModelRegistry().getNationalEconomyModel(currency).pricesModel;

    final Map<Currency, PriceModel> priceModelsForCurrencies = pricesModel
            .getPriceModelsForCurrencies();
    final PriceModel priceModel = priceModelsForCurrencies
            .get(commodityCurrency);

    if (priceModel != null) {
        return new DefaultHighLowDataset("", priceModel.getDate(),
                priceModel.getHigh(), priceModel.getLow(),
                priceModel.getOpen(), priceModel.getClose(),
                priceModel.getVolume());
    }

    return null;
}
项目:jasperreports    文件:GenericChartTheme.java   
/**
 *
 * @param evaluation
 * @throws net.sf.jasperreports.engine.JRException
 */
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().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(), 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;
}
项目:jasperreports    文件:JRFillHighLowDataset.java   
@Override
public Dataset getCustomDataset()
{
    int size = elements.size();
    if (size > 0)
    {
        Date[] dateArray = new Date[size];
        double[] highArray = new double[size];
        double[] lowArray = new double[size];
        double[] openArray = new double[size];
        double[] closeArray = new double[size];
        double[] volumeArray = new double[size];

        for (int i = 0; i < elements.size(); i++) {
            HighLowElement bean = elements.get(i);
            dateArray[i] = new Date(bean.getDate().getTime());
            highArray[i] = bean.getHigh().doubleValue();
            lowArray[i] = bean.getLow().doubleValue();
            openArray[i] = bean.getOpen().doubleValue();
            closeArray[i] = bean.getClose().doubleValue();
            volumeArray[i] = bean.getVolume().doubleValue();
        }

        return new DefaultHighLowDataset(series, dateArray, highArray, lowArray, openArray, closeArray, volumeArray);
    }

    return null;
}
项目:jasperreports    文件:DefaultChartTheme.java   
/**
 *
 */
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);

    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.getTimeAxisLineColor(), 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.getValueAxisLineColor(), true,
            (Comparable<?>)evaluateExpression(candlestickPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>)evaluateExpression(candlestickPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}
项目:groovychart    文件:DefaultHighLowDatasetBuilder.java   
private void doSet() {
    if(seriesTitle != null && date != null &&
       high != null && low != null &&
       open != null && close != null &&
       volume != null) {
        hlDataset = new DefaultHighLowDataset(seriesTitle, date, high, low, open, close, volume);
        seriesTitle = null;
        date = null;
        high = low = open = close = volume = null;
    }

}
项目:astor    文件:DefaultHighLowDatasetTests.java   
/**
 * Verify that this class implements {@link PublicCloneable}.
 */
public void testPublicCloneable() {
    DefaultHighLowDataset d1 = new DefaultHighLowDataset("Series 1",
            new Date[0], new double[0], new double[0], new double[0],
            new double[0], new double[0]);
    assertTrue(d1 instanceof PublicCloneable);
}
项目:dynamicreports-jasper    文件:AbstractJasperChartTest.java   
protected void highLowChartDataTest(JFreeChart chart, int series, Object[][] values) {
    DefaultHighLowDataset dataset = (DefaultHighLowDataset) chart.getXYPlot().getDataset();
    int index = 0;
    for (Object[] value : values) {
        Assert.assertEquals("chart data series", value[0], dataset.getSeriesKey(series));
        Assert.assertEquals("chart data date", value[1], dataset.getXDate(series, index));
        Assert.assertEquals("chart data high value", value[2], dataset.getHigh(series, index));
        Assert.assertEquals("chart data low value", value[3], dataset.getLow(series, index));
        Assert.assertEquals("chart data open value", value[4], dataset.getOpenValue(series, index));
        Assert.assertEquals("chart data close value", value[5], dataset.getClose(series, index));
        Assert.assertEquals("chart data volume value", value[6], dataset.getVolume(series, index));
        index++;
    }
}
项目:open-java-trade-manager    文件:ChartJDialog.java   
/**
 * Calculate and update high low value labels, according to current displayed
 * time range. This is a time consuming method, and shall be called by
 * user thread.
 */
private void _updateHighLowJLabels() {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            ChartJDialog.this.jLabel2.setText("");
            ChartJDialog.this.jLabel4.setText("");
        }
    });

    final ValueAxis valueAxis = this.getPlot().getDomainAxis();
    final Range range = valueAxis.getRange();
    final long lowerBound = (long)range.getLowerBound();
    final long upperBound = (long)range.getUpperBound();
    final DefaultHighLowDataset defaultHighLowDataset = (DefaultHighLowDataset)this.priceOHLCDataset;

    // Perform binary search, to located day in price time series, which
    // is equal or lesser than upperBound.
    int low = 0;
    int high = defaultHighLowDataset.getItemCount(0) - 1;
    long best_dist = Long.MAX_VALUE;
    int best_mid = -1;
    while (low <= high) {
        int mid = (low + high) >>> 1;
        long v = defaultHighLowDataset.getXDate(0, mid).getTime();

        if (v > upperBound) {
            high = mid - 1;
        }
        else if (v < upperBound) {
            low = mid + 1;
            long dist = upperBound - v;
            if (dist < best_dist) {
                best_dist = dist;
                best_mid = mid;
            }
        }
        else {
            best_dist = 0;
            best_mid = mid;
            break;
        }
    }

    if (best_mid < 0) {
        return;
    }

    double high_last_price = Double.NEGATIVE_INFINITY;
    double low_last_price = Double.MAX_VALUE;
    for (int i = best_mid; i >= 0; i--) {
        final long time = defaultHighLowDataset.getXDate(0, i).getTime();
        if (time < lowerBound) {
            break;
        }
        if (high_last_price < defaultHighLowDataset.getHighValue(0, i)) {
            high_last_price = defaultHighLowDataset.getHighValue(0, i);
        }
        if (low_last_price > defaultHighLowDataset.getLowValue(0, i)) {
            low_last_price = defaultHighLowDataset.getLowValue(0, i);
        }
    }

    final double h = high_last_price;
    final double l = low_last_price;
    if (high_last_price >= low_last_price) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                ChartJDialog.this.jLabel2.setText(stockPriceDecimalFormat(h));
                ChartJDialog.this.jLabel4.setText(stockPriceDecimalFormat(l));
            }
        });
    }
}
项目:jasperreports    文件:GenericChartTheme.java   
/**
 *
 * @param evaluation
 * @throws JRException
 */
protected JFreeChart createHighLowChart() throws JRException
{
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart =
        ChartFactory.createHighLowChart(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRHighLowPlot)getPlot()).getTimeAxisLabelExpression()),
            evaluateTextExpression(((JRHighLowPlot)getPlot()).getValueAxisLabelExpression()),
            (DefaultHighLowDataset)getDataset(),
            isShowLegend()
            );

    configureChart(jfreeChart, getPlot());
    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRHighLowPlot highLowPlot = (JRHighLowPlot)getPlot();
    HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer();
    boolean isShowOpenTicks = highLowPlot.getShowOpenTicks() == null ? false : highLowPlot.getShowOpenTicks().booleanValue();
    boolean isShowCloseTicks = highLowPlot.getShowCloseTicks() == null ? false : highLowPlot.getShowCloseTicks().booleanValue();

    hlRenderer.setDrawOpenTicks(isShowOpenTicks);
    hlRenderer.setDrawCloseTicks(isShowCloseTicks);

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

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

    return jfreeChart;
}
项目:jasperreports    文件:SimpleChartTheme.java   
/**
 *
 * @param evaluation
 * @throws net.sf.jasperreports.engine.JRException
 */
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().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;
}
项目:jasperreports    文件:SimpleChartTheme.java   
/**
 *
 * @param evaluation
 * @throws JRException
 */
protected JFreeChart createHighLowChart() throws JRException
{
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart =
        ChartFactory.createHighLowChart(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRHighLowPlot)getPlot()).getTimeAxisLabelExpression()),
            evaluateTextExpression(((JRHighLowPlot)getPlot()).getValueAxisLabelExpression()),
            (DefaultHighLowDataset)getDataset(),
            isShowLegend()
            );

    configureChart(jfreeChart, getPlot());
    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRHighLowPlot highLowPlot = (JRHighLowPlot)getPlot();
    HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer();
    boolean isShowOpenTicks = highLowPlot.getShowOpenTicks() == null ? false : highLowPlot.getShowOpenTicks().booleanValue();
    boolean isShowCloseTicks = highLowPlot.getShowCloseTicks() == null ? false : highLowPlot.getShowCloseTicks().booleanValue();

    hlRenderer.setDrawOpenTicks(isShowOpenTicks);
    hlRenderer.setDrawCloseTicks(isShowCloseTicks);

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

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

    return jfreeChart;
}
项目:jasperreports    文件:DefaultChartTheme.java   
/**
 *
 */
protected JFreeChart createHighLowChart() throws JRException
{
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart =
        ChartFactory.createHighLowChart(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRHighLowPlot)getPlot()).getTimeAxisLabelExpression()),
            evaluateTextExpression(((JRHighLowPlot)getPlot()).getValueAxisLabelExpression()),
            (DefaultHighLowDataset)getDataset(),
            isShowLegend()
            );

    configureChart(jfreeChart);

    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRHighLowPlot highLowPlot = (JRHighLowPlot)getPlot();
    HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer();
    boolean isShowOpenTicks = highLowPlot.getShowOpenTicks() == null ? false : highLowPlot.getShowOpenTicks().booleanValue();
    boolean isShowCloseTicks = highLowPlot.getShowCloseTicks() == null ? false : highLowPlot.getShowCloseTicks().booleanValue();

    hlRenderer.setDrawOpenTicks(isShowOpenTicks);
    hlRenderer.setDrawCloseTicks(isShowCloseTicks);

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

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

    return jfreeChart;
}
项目:groovychart    文件:DefaultHighLowDatasetBuilder.java   
/**
 * Getter for property hlDataset.
 * @return Value of property xyDataset.
 */
public DefaultHighLowDataset getHlDataset() {
    return this.hlDataset;
}
项目:groovychart    文件:DefaultHighLowDatasetBuilder.java   
/**
 * Setter for property xyDataset.
 * @param hlDataset New value of property hlDataset.
 */
public void setHlDataset(DefaultHighLowDataset hlDataset) {
    this.hlDataset = hlDataset;
}