如何在Jsp中绘制雷达图

发布于 2024-10-12 12:28:50 字数 2290 浏览 3 评论 0原文

我可以让读者在 swing 中聊天,但是我如何在 jsp 中绘制该聊天 我在这篇文章中说明了我的代码,那么如何在 jsp 中绘制雷达聊天 我正在使用六角形图表

import java.awt.*;
import org.jfree.ui.*;
import org.jfree.chart.*;
import org.jfree.chart.plot.*;
import org.jfree.chart.labels.*;
import org.jfree.chart.title.*;
import org.jfree.data.category.*;

  public class RadarChart extends ApplicationFrame {
    public DefaultCategoryDataset dataset;
    public SpiderWebPlot plot;

    public RadarChart(String title) {
        super(title);
        String series1 = "First";
        String series2 = "Second";
        String series3 = "Third";

        String category1 = "Task Completion";
        String category2 = "Accuracy";
        String category3 = "Sophistication";
        String category4 = "Listening";
        String category5 = "Pronunciation";

        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        dataset.addValue(5.0, series1, category1);
        dataset.addValue(5.0, series1, category2);
        dataset.addValue(5.0, series1, category3);
        dataset.addValue(5.0, series1, category4);
        dataset.addValue(5.0, series1, category5);

        dataset.addValue(2.0, series2, category1);
        dataset.addValue(4.0, series2, category2);
        dataset.addValue(5.0, series2, category3);
        dataset.addValue(3.0, series2, category4);
        dataset.addValue(5.0, series2, category5);


        SpiderWebPlot plot = new SpiderWebPlot(dataset);

        plot.setStartAngle(90);

        plot.setInteriorGap(0.20);

        plot.setToolTipGenerator(new StandardCategoryToolTipGenerator());

        JFreeChart chart = new JFreeChart("", TextTitle.DEFAULT_FONT, plot, false);

        ChartUtilities.applyCurrentTheme(chart);

        ChartPanel chartPanel = new ChartPanel(chart);
        this.plot = (SpiderWebPlot) chartPanel.getChart().getPlot();
        this.dataset = (DefaultCategoryDataset) plot.getDataset();
        chartPanel.setPreferredSize(new Dimension(500, 270));
        setContentPane(chartPanel);
        }


        public static void main(String[] args) {
                RadarChart demo = new RadarChart("Chart");
                demo.pack();
                RefineryUtilities.centerFrameOnScreen(demo);
                demo.setVisible(true);
        }
}

I can make reader chat in swing but how can i draw that chat in jsp
i am illustrate my code in this post so how to draw a radar chat in jsp
i am using hexagonal chart

import java.awt.*;
import org.jfree.ui.*;
import org.jfree.chart.*;
import org.jfree.chart.plot.*;
import org.jfree.chart.labels.*;
import org.jfree.chart.title.*;
import org.jfree.data.category.*;

  public class RadarChart extends ApplicationFrame {
    public DefaultCategoryDataset dataset;
    public SpiderWebPlot plot;

    public RadarChart(String title) {
        super(title);
        String series1 = "First";
        String series2 = "Second";
        String series3 = "Third";

        String category1 = "Task Completion";
        String category2 = "Accuracy";
        String category3 = "Sophistication";
        String category4 = "Listening";
        String category5 = "Pronunciation";

        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        dataset.addValue(5.0, series1, category1);
        dataset.addValue(5.0, series1, category2);
        dataset.addValue(5.0, series1, category3);
        dataset.addValue(5.0, series1, category4);
        dataset.addValue(5.0, series1, category5);

        dataset.addValue(2.0, series2, category1);
        dataset.addValue(4.0, series2, category2);
        dataset.addValue(5.0, series2, category3);
        dataset.addValue(3.0, series2, category4);
        dataset.addValue(5.0, series2, category5);


        SpiderWebPlot plot = new SpiderWebPlot(dataset);

        plot.setStartAngle(90);

        plot.setInteriorGap(0.20);

        plot.setToolTipGenerator(new StandardCategoryToolTipGenerator());

        JFreeChart chart = new JFreeChart("", TextTitle.DEFAULT_FONT, plot, false);

        ChartUtilities.applyCurrentTheme(chart);

        ChartPanel chartPanel = new ChartPanel(chart);
        this.plot = (SpiderWebPlot) chartPanel.getChart().getPlot();
        this.dataset = (DefaultCategoryDataset) plot.getDataset();
        chartPanel.setPreferredSize(new Dimension(500, 270));
        setContentPane(chartPanel);
        }


        public static void main(String[] args) {
                RadarChart demo = new RadarChart("Chart");
                demo.pack();
                RefineryUtilities.centerFrameOnScreen(demo);
                demo.setVisible(true);
        }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浪漫人生路 2024-10-19 12:28:50

JFreeChart 可以绘制雷达图。

JFreeChart can do radar plots.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文