当前位置: 首页>>代码示例>>Java>>正文


Java PieDataset类代码示例

本文整理汇总了Java中org.jfree.data.general.PieDataset的典型用法代码示例。如果您正苦于以下问题:Java PieDataset类的具体用法?Java PieDataset怎么用?Java PieDataset使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PieDataset类属于org.jfree.data.general包,在下文中一共展示了PieDataset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRingChart

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Creates a ring chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link RingPlot} 
 * instance as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A pie chart.
 */
public static JFreeChart createRingChart(String title,
                                         PieDataset dataset,
                                         boolean legend,
                                         boolean tooltips,
                                         boolean urls) {

    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator(
                StandardPieToolTipGenerator.DEFAULT_SECTION_LABEL_FORMAT));
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, 
            legend);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:35,代码来源:ChartFactory.java

示例2: createPieChart3D

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Creates a 3D pie chart using the specified dataset.  The chart object 
 * returned by this method uses a {@link PiePlot3D} instance as the
 * plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A pie chart.
 */
public static JFreeChart createPieChart3D(String title,
                                          PieDataset dataset,
                                          boolean legend,
                                          boolean tooltips,
                                          boolean urls) {

    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, 
            legend);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:ChartFactory.java

示例3: start

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
@Override 
public void start(Stage stage) throws Exception {
    PieDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset); 
    ChartViewer viewer = new ChartViewer(chart);  
    stage.setScene(new Scene(viewer)); 
    stage.setTitle("JFreeChart: PieChartFXDemo1.java"); 
    stage.setWidth(700);
    stage.setHeight(390);
    stage.show(); 
}
 
开发者ID:jfree,项目名称:jfree-fxdemos,代码行数:12,代码来源:PieChartFXDemo1.java

示例4: createPieChart

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Creates a pie chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link PiePlot} instance as the
 * plot.

 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A pie chart.
 */
public static JFreeChart createPieChart(String title,
                                        PieDataset dataset,
                                        boolean legend,
                                        boolean tooltips,
                                        boolean urls) {

    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieItemLabelGenerator());
    plot.setInsets(new Insets(0, 5, 5, 5));
    if (tooltips) {
        plot.setToolTipGenerator(
            new StandardPieItemLabelGenerator(
                StandardPieItemLabelGenerator.DEFAULT_SECTION_LABEL_FORMAT
            )
        );
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:ChartFactory.java

示例5: createPieChart3D

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Creates a 3D pie chart using the specified dataset.
 * <P>
 * The chart object returned by this method uses a {@link PiePlot3D} instance as the
 * plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A pie chart.
 */
public static JFreeChart createPieChart3D(String title,
                                          PieDataset dataset,
                                          boolean legend,
                                          boolean tooltips,
                                          boolean urls) {

    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new Insets(0, 5, 5, 5));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieItemLabelGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:ChartFactory.java

示例6: setDataset

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Sets the dataset and sends a {@link DatasetChangeEvent} to 'this'.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public void setDataset(PieDataset dataset) {
    // if there is an existing dataset, remove the plot from the list of change listeners...
    PieDataset existing = this.dataset;
    if (existing != null) {
        existing.removeChangeListener(this);
    }

    // set the new dataset, and register the chart as a change listener...
    this.dataset = dataset;
    if (dataset != null) {
        setDatasetGroup(dataset.getGroup());
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:PiePlot.java

示例7: generateURL

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Generates a URL.
 *
 * @param data  the dataset.
 * @param key  the item key.
 * @param pieIndex  the pie index (ignored).
 *
 * @return a string containing the generated URL.
 */
public String generateURL(PieDataset data, Comparable key, int pieIndex) {

    String url = this.prefix;
    if (url.indexOf("?") > -1) {
        url += "&" + this.categoryParameterName + "=" + key.toString();
    }
    else {
        url += "?" + this.categoryParameterName + "=" + key.toString();
    }
    if (this.indexParameterName != null) {
        url += "&" + this.indexParameterName + "=" + String.valueOf(pieIndex);
    }
    return url;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:StandardPieURLGenerator.java

示例8: createItemArray

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Creates the array of items that can be passed to the {@link MessageFormat} class
 * for creating labels.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param key  the key.
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(PieDataset dataset, Comparable key) {
    Object[] result = new Object[3];
    result[0] = key.toString();
    Number value = dataset.getValue(key);
    result[1] = this.numberFormat.format(value);  
    double percent = 0.0;
    if (value != null) {
        double v = value.doubleValue();
        if (v > 0.0) {
            percent = v / DatasetUtilities.calculatePieDatasetTotal(dataset); 
        }
    }       
    result[2] = this.percentFormat.format(percent);
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:StandardPieItemLabelGenerator.java

示例9: readPieDatasetFromXML

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Reads a {@link PieDataset} from a stream.
 *
 * @param in  the input stream.
 *
 * @return A dataset.
 *
 * @throws IOException if there is an I/O error.
 */
public static PieDataset readPieDatasetFromXML(final InputStream in) throws IOException {

    PieDataset result = null;

    final SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
        final SAXParser parser = factory.newSAXParser();
        final PieDatasetHandler handler = new PieDatasetHandler();
        parser.parse(in, handler);
        result = handler.getDataset();
    }
    catch (SAXException e) {
        System.out.println(e.getMessage());
    }
    catch (ParserConfigurationException e2) {
        System.out.println(e2.getMessage());
    }

    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:DatasetReader.java

示例10: createChart

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Creates a chart.
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {
    
    JFreeChart chart = ChartFactory.createPieChart(
        "Pie Chart Demo 1",  // chart title
        dataset,             // data
        true,               // include legend
        true,
        false
    );

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setSectionOutlinesVisible(false);
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);
    return chart;
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:27,代码来源:SWTPieChartDemo1.java

示例11: createPieChart

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Creates a pie chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link PiePlot} instance 
 * as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A pie chart.
 */
public static JFreeChart createPieChart(String title,
                                        PieDataset dataset,
                                        boolean legend,
                                        boolean tooltips,
                                        boolean urls) {

    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator(
                StandardPieToolTipGenerator.DEFAULT_SECTION_LABEL_FORMAT));
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, 
            legend);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:35,代码来源:ChartFactory.java

示例12: setDataset

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Sets the dataset and sends a {@link DatasetChangeEvent} to 'this'.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * 
 * @see #getDataset()
 */
public void setDataset(PieDataset dataset) {
    // if there is an existing dataset, remove the plot from the list of 
    // change listeners...
    PieDataset existing = this.dataset;
    if (existing != null) {
        existing.removeChangeListener(this);
    }

    // set the new dataset, and register the chart as a change listener...
    this.dataset = dataset;
    if (dataset != null) {
        setDatasetGroup(dataset.getGroup());
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:27,代码来源:PiePlot.java

示例13: createItemArray

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Creates the array of items that can be passed to the 
 * {@link MessageFormat} class for creating labels.  The returned array
 * contains four values:
 * <ul>
 * <li>result[0] = the section key converted to a <code>String</code>;</li>
 * <li>result[1] = the formatted data value;</li>
 * <li>result[2] = the formatted percentage (of the total);</li>
 * <li>result[3] = the formatted total value.</li>
 * </ul>
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param key  the key (<code>null</code> not permitted).
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(PieDataset dataset, Comparable key) {
    Object[] result = new Object[4];
    double total = DatasetUtilities.calculatePieDatasetTotal(dataset);
    result[0] = key.toString();
    Number value = dataset.getValue(key);
    if (value != null) {
        result[1] = this.numberFormat.format(value);  
    }
    else {
        result[1] = "null";
    }
    double percent = 0.0;
    if (value != null) {
        double v = value.doubleValue();
        if (v > 0.0) {
            percent = v / total; 
        }
    }       
    result[2] = this.percentFormat.format(percent);
    result[3] = this.numberFormat.format(total);
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:AbstractPieItemLabelGenerator.java

示例14: readPieDatasetFromXML

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Reads a {@link PieDataset} from a stream.
 *
 * @param in  the input stream.
 *
 * @return A dataset.
 *
 * @throws IOException if there is an I/O error.
 */
public static PieDataset readPieDatasetFromXML(InputStream in) 
    throws IOException {

    PieDataset result = null;
    SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
        SAXParser parser = factory.newSAXParser();
        PieDatasetHandler handler = new PieDatasetHandler();
        parser.parse(in, handler);
        result = handler.getDataset();
    }
    catch (SAXException e) {
        System.out.println(e.getMessage());
    }
    catch (ParserConfigurationException e2) {
        System.out.println(e2.getMessage());
    }
    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:DatasetReader.java

示例15: createPieChart

import org.jfree.data.general.PieDataset; //导入依赖的package包/类
/**
 * Creates a pie chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link PiePlot} instance
 * as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A pie chart.
 */
public static JFreeChart createPieChart(String title, PieDataset dataset,
        boolean legend, boolean tooltips, boolean urls) {

    PiePlot plot = new PiePlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:32,代码来源:ChartFactory.java


注:本文中的org.jfree.data.general.PieDataset类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。