1

指定された位置にグラフを表示する必要がある jsp ページがあります。

 DefaultPieDataset dataset = new DefaultPieDataset();

        dataset.setValue("STD", 10);
        dataset.setValue("Local", 15);
        dataset.setValue("ISD", 47);
        dataset.setValue("Inet", 20);

        JFreeChart chart = ChartFactory.createPieChart3D(
                "Calls by Type", // Title
                dataset, // Data
                true, // Yes, display the legend
                true, // No, don't display tooltips
                true // No, no URLs
                );
        PiePlot3D plot4 = (PiePlot3D) chart.getPlot();
        plot4.setForegroundAlpha(0.6f);
        plot4.setBackgroundPaint(Color.cyan);
        PiePlot piePlot = (PiePlot) chart.getPlot();
        StandardPieSectionLabelGenerator labelGenerator = new StandardPieSectionLabelGenerator("{0} {1} {2}");
        piePlot.setLabelGenerator(labelGenerator);
        piePlot.setLegendLabelGenerator(labelGenerator);
        response.setContentType("html");

        ChartUtilities.writeChartAsPNG(response.getOutputStream(), chart, 400, 300);
4

0 に答える 0