本文整理汇总了Java中org.jfree.chart.plot.XYPlot.getDatasetCount方法的典型用法代码示例。如果您正苦于以下问题:Java XYPlot.getDatasetCount方法的具体用法?Java XYPlot.getDatasetCount怎么用?Java XYPlot.getDatasetCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.XYPlot
的用法示例。
在下文中一共展示了XYPlot.getDatasetCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}