本文整理匯總了Java中org.jfree.chart.ChartFactory.createStackedAreaChart方法的典型用法代碼示例。如果您正苦於以下問題:Java ChartFactory.createStackedAreaChart方法的具體用法?Java ChartFactory.createStackedAreaChart怎麽用?Java ChartFactory.createStackedAreaChart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.chart.ChartFactory
的用法示例。
在下文中一共展示了ChartFactory.createStackedAreaChart方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createChart
import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
/**
* Create a stacked bar chart with sample data in the range -3 to +3.
*
* @return The chart.
*/
private static JFreeChart createChart() {
// create a dataset...
Number[][] data = new Integer[][]
{{new Integer(-3), new Integer(-2)},
{new Integer(-1), new Integer(1)},
{new Integer(2), new Integer(3)}};
CategoryDataset dataset = DatasetUtilities.createCategoryDataset("S",
"C", data);
// create the chart...
return ChartFactory.createStackedAreaChart(
"Stacked Area Chart", // chart title
"Domain", "Range",
dataset, // data
PlotOrientation.HORIZONTAL,
true, // include legend
true,
true
);
}
示例2: createTestsResultsChartHelper
import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
/**
*
*/
private static void createTestsResultsChartHelper(final String categoryLabel, final DefaultCategoryDataset dataset, final OutputStream out, final CategoryLabelPositions categoryLabelPosition) throws IOException {
final JFreeChart chart = ChartFactory.createStackedAreaChart(null,
categoryLabel, "Tests", dataset,
PlotOrientation.VERTICAL,
true, false, false);
chart.setBackgroundPaint(Color.white);
// change the auto tick unit selection to integer units only
final CategoryPlot plot = chart.getCategoryPlot();
final LogarithmicAxis logarithmicAxis = new LogarithmicAxis("Tests");
logarithmicAxis.setStrictValuesFlag(false);
logarithmicAxis.setAutoRangeIncludesZero(true);
logarithmicAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
plot.setRangeAxis(logarithmicAxis);
// final NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
// rotate X dates
final CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(categoryLabelPosition);
// set area colors
final StackedAreaRenderer area = (StackedAreaRenderer) plot.getRenderer();
area.setSeriesPaint(0, Color.RED); // first area
area.setSeriesPaint(1, Color.PINK); // second area
area.setSeriesPaint(2, Color.GREEN); // thirs area
//plot.setRenderer(area);
// write to reposnce
final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ChartUtilities.writeChartAsPNG(out, chart, IMG_WIDTH, IMG_HEIGHT, info);
}