⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intervalbarchartdemo1.java

📁 Jfreechart 源码例子 是和jfreechart development Guide文档相配套的
💻 JAVA
字号:
package demo;

import [D;
import java.awt.Dimension;
import java.text.DecimalFormat;
import javax.swing.JFrame;
import javax.swing.JPanel;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.renderer.category.IntervalBarRenderer;
import org.jfree.data.category.DefaultIntervalCategoryDataset;
import org.jfree.data.category.IntervalCategoryDataset;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;

public class IntervalBarChartDemo1 extends ApplicationFrame
{
  public IntervalBarChartDemo1(String paramString)
  {
    super(paramString);
    JPanel localJPanel = createDemoPanel();
    localJPanel.setPreferredSize(new Dimension(500, 270));
    setContentPane(localJPanel);
  }

  private static IntervalCategoryDataset createDataset()
  {
    double[] arrayOfDouble1 = { 0.10000000000000001D, 0.20000000000000001D, 0.29999999999999999D };
    double[] arrayOfDouble2 = { 0.29999999999999999D, 0.40000000000000002D, 0.5D };
    double[] arrayOfDouble3 = { 0.5D, 0.59999999999999998D, 0.69999999999999996D };
    double[] arrayOfDouble4 = { 0.69999999999999996D, 0.80000000000000004D, 0.90000000000000002D };
    [D[] arrayOf[D1 = { arrayOfDouble1, arrayOfDouble2 };
    [D[] arrayOf[D2 = { arrayOfDouble3, arrayOfDouble4 };
    DefaultIntervalCategoryDataset localDefaultIntervalCategoryDataset = new DefaultIntervalCategoryDataset(arrayOf[D1, arrayOf[D2);
    return localDefaultIntervalCategoryDataset;
  }

  private static JFreeChart createChart(IntervalCategoryDataset paramIntervalCategoryDataset)
  {
    CategoryAxis localCategoryAxis = new CategoryAxis("Category");
    NumberAxis localNumberAxis = new NumberAxis("Percentage");
    localNumberAxis.setNumberFormatOverride(new DecimalFormat("0.00%"));
    IntervalBarRenderer localIntervalBarRenderer = new IntervalBarRenderer();
    CategoryPlot localCategoryPlot = new CategoryPlot(paramIntervalCategoryDataset, localCategoryAxis, localNumberAxis, localIntervalBarRenderer);
    JFreeChart localJFreeChart = new JFreeChart("IntervalBarChartDemo1", localCategoryPlot);
    localCategoryPlot.setDomainGridlinesVisible(true);
    ChartUtilities.applyCurrentTheme(localJFreeChart);
    return localJFreeChart;
  }

  public static JPanel createDemoPanel()
  {
    JFreeChart localJFreeChart = createChart(createDataset());
    return new ChartPanel(localJFreeChart);
  }

  public static void main(String[] paramArrayOfString)
  {
    IntervalBarChartDemo1 localIntervalBarChartDemo1 = new IntervalBarChartDemo1("JFreeChart: IntervalBarChartDemo1.java");
    localIntervalBarChartDemo1.pack();
    RefineryUtilities.centerFrameOnScreen(localIntervalBarChartDemo1);
    localIntervalBarChartDemo1.setVisible(true);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -