当前位置: 首页>>代码示例>>Java>>正文


Java XYPlot.mapDatasetToRangeAxis方法代码示例

本文整理汇总了Java中org.jfree.chart.plot.XYPlot.mapDatasetToRangeAxis方法的典型用法代码示例。如果您正苦于以下问题:Java XYPlot.mapDatasetToRangeAxis方法的具体用法?Java XYPlot.mapDatasetToRangeAxis怎么用?Java XYPlot.mapDatasetToRangeAxis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.plot.XYPlot的用法示例。


在下文中一共展示了XYPlot.mapDatasetToRangeAxis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pushDataAndRendererIntoPlot

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
private void pushDataAndRendererIntoPlot(XYPlot plot, int rangeAxisIdx, XYItemRenderer renderer, XYDataset dataset)
		throws ChartPlottimeException {
	if (dataset != null && renderer != null) {
		int datasetIdx = plot.getDatasetCount();
		if (datasetIdx > 0 && plot.getDataset(datasetIdx - 1) == null) {
			datasetIdx -= 1;
		}
		// push dataset and renderer into plot
		try {
			plot.setDataset(datasetIdx, dataset); // if Eclipse states that
													// dataset might not be
													// initialized, you did
													// not consider all
													// possibilities in the
													// condition block above
		} catch (RuntimeException e) {
			// probably this is because the domain axis contains values less
			// then zero and the scaling is logarithmic.
			// The shitty JFreeChart implementation does not throw a proper
			// exception stating what happened,
			// but just a RuntimeException with a string, so this is our
			// best guess:
			if (isProbablyZeroValuesOnLogScaleException(e)) {
				throw new ChartPlottimeException("gui.plotter.error.log_axis_contains_zero", "domain axis");
			} else {
				throw e;
			}
		}
		plot.mapDatasetToRangeAxis(datasetIdx, rangeAxisIdx);
		plot.setRenderer(datasetIdx, renderer);
	} else {
		ChartPlottimeException chartPlottimeException = new ChartPlottimeException(new PlotConfigurationError(
				"generic_plotter_error"));
		throw chartPlottimeException;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:37,代码来源:JFreeChartPlotEngine.java

示例2: addCashFlowAxis

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
/**
 * Adds the cash flow axis to the plot.
 * @param plot the plot
 * @param dataset the cash flow dataset
 */
private static void addCashFlowAxis(XYPlot plot, TimeSeriesCollection dataset) {
    final NumberAxis cashAxis = new NumberAxis("Cash Flow Ratio");
    cashAxis.setAutoRangeIncludesZero(false);
    plot.setRangeAxis(1, cashAxis);
    plot.setDataset(1, dataset);
    plot.mapDatasetToRangeAxis(1, 1);
    final StandardXYItemRenderer cashFlowRenderer = new StandardXYItemRenderer();
    cashFlowRenderer.setSeriesPaint(0, Color.blue);
    plot.setRenderer(1, cashFlowRenderer);
}
 
开发者ID:ta4j,项目名称:ta4j,代码行数:16,代码来源:CashFlowToChart.java

示例3: main

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
public static void main(String[] args) {
    /**
     * Getting time series
     */
    TimeSeries series = CsvTradesLoader.loadBitstampSeries();
    
    /**
     * Creating the OHLC dataset
     */
    OHLCDataset ohlcDataset = createOHLCDataset(series);
    
    /**
     * Creating the additional dataset
     */
    TimeSeriesCollection xyDataset = createAdditionalDataset(series);
    
    /**
     * Creating the chart
     */
    JFreeChart chart = ChartFactory.createCandlestickChart(
            "Bitstamp BTC price",
            "Time",
            "USD",
            ohlcDataset,
            true);
    // Candlestick rendering
    CandlestickRenderer renderer = new CandlestickRenderer();
    renderer.setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST);
    XYPlot plot = chart.getXYPlot();
    plot.setRenderer(renderer);
    // Additional dataset
    int index = 1;
    plot.setDataset(index, xyDataset);
    plot.mapDatasetToRangeAxis(index, 0);
    XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(true, false);
    renderer2.setSeriesPaint(index, Color.blue);
    plot.setRenderer(index, renderer2);
    // Misc
    plot.setRangeGridlinePaint(Color.lightGray);
    plot.setBackgroundPaint(Color.white);
    NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis();
    numberAxis.setAutoRangeIncludesZero(false);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    
    /**
     * Displaying the chart
     */
    displayChart(chart);
}
 
开发者ID:ta4j,项目名称:ta4j,代码行数:50,代码来源:CandlestickChart.java


注:本文中的org.jfree.chart.plot.XYPlot.mapDatasetToRangeAxis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。