Example usage for org.jfree.chart.plot SpiderWebPlot setNoDataMessage

List of usage examples for org.jfree.chart.plot SpiderWebPlot setNoDataMessage

Introduction

In this page you can find the example usage for org.jfree.chart.plot SpiderWebPlot setNoDataMessage.

Prototype

public void setNoDataMessage(String message) 

Source Link

Document

Sets the message that is displayed when the dataset is empty or null, and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.emftrace.quarc.ui.views.RatioView.java

/**
 * create a SpiderChart /*from   ww  w .  j  a  va 2  s  .  c o m*/
 * @param dataset the dataset for the chart
 * @param weighted include weights?
 * @return the created SpiderChart
 */
private JFreeChart createSpiderChart(DefaultCategoryDataset dataset, boolean weighted) {

    SpiderWebPlot plot = new SpiderWebPlot(dataset);
    plot.setMaxValue(200.0f);

    plot.setStartAngle(54);
    plot.setInteriorGap(0.40);
    plot.setToolTipGenerator(new CategoryToolTipGenerator() {

        @Override
        public String generateToolTip(CategoryDataset dataset, int section, int index) {
            Float ratingValue = (Float) dataset.getValue(section, index);
            if (ratingValue == null)
                ratingValue = 0.0f;
            else
                ratingValue -= 100.0f;
            return String.valueOf("(" + dataset.getRowKey(section) + "," + dataset.getColumnKey(index) + ") = "
                    + String.format("%.2f", ratingValue));
        }

    });
    plot.setNoDataMessage("No data to display");
    String titleStr = "ratings of selected elements";
    if (weighted)
        titleStr = "weighted " + titleStr;
    JFreeChart chart = new JFreeChart(titleStr, TextTitle.DEFAULT_FONT, plot, false);
    LegendTitle legend = new LegendTitle(plot);
    legend.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legend);
    ChartUtilities.applyCurrentTheme(chart);
    return chart;

}