本文整理匯總了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;
}
}