麻烦哪位有jfreechart画圆柱状图的源代码发上来,谢谢了!

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【zxdu721】截止到2008-07-14 12:32:02的历史汇总数据(不包括此帖):
    发帖的总数量:6                        发帖的总分数:50                       每贴平均分数:8                        
    回帖的总数量:21                       得分贴总数量:10                       回帖的得分率:47%                      
    结贴的总数量:5                        结贴的总分数:30                       
    无满意结贴数:3                        无满意结贴分:50                       
    未结的帖子数:1                        未结的总分数:20                       
    结贴的百分比:83.33 %               结分的百分比:60.00 %                  
    无满意结贴率:60.00 %               无满意结分率:166.67%                  
    楼主加油
      

  2.   

    LZ应该多看看JFreeChart例子,给你个例子看看吧// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2008-5-21 16:33:34
    // Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
    // Decompiler options: packimports(3) fieldsfirst package demo;import java.awt.*;
    import javax.swing.JPanel;
    import org.jfree.chart.*;
    import org.jfree.chart.labels.StandardCategoryToolTipGenerator;
    import org.jfree.chart.plot.CategoryPlot;
    import org.jfree.chart.plot.PlotOrientation;
    import org.jfree.data.category.CategoryDataset;
    import org.jfree.data.category.DefaultCategoryDataset;
    import org.jfree.ui.*;// Referenced classes of package demo:
    //            CylinderRendererpublic class CylinderChartDemo1 extends ApplicationFrame
    {
        static class CustomCylinderRenderer extends CylinderRenderer
        {        private Paint colors[];        public Paint getItemPaint(int i, int j)
            {
                return colors[j % colors.length];
            }        public CustomCylinderRenderer(Paint apaint[])
            {
                colors = apaint;
            }
        }
        public CylinderChartDemo1(String s)
        {
            super(s);
            JPanel jpanel = createDemoPanel();
            jpanel.setPreferredSize(new Dimension(500, 270));
            setContentPane(jpanel);
        }    private static CategoryDataset createDataset()
        {
            DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();
            defaultcategorydataset.addValue(4D, "S1", "Monday");
            defaultcategorydataset.addValue(5D, "S1", "Tuesday");
            defaultcategorydataset.addValue(-7D, "S1", "Wednesday");
            defaultcategorydataset.addValue(6D, "S1", "Thursday");
            defaultcategorydataset.addValue(4D, "S1", "Friday");
            return defaultcategorydataset;
        }    private static JFreeChart createChart(CategoryDataset categorydataset)
        {
            JFreeChart jfreechart = ChartFactory.createBarChart3D("Cylinder Chart Demo 1", "Category", "Value", categorydataset, PlotOrientation.VERTICAL, false, true, false);
            CategoryPlot categoryplot = (CategoryPlot)jfreechart.getPlot();
            Paint apaint[] = createPaint();
            CustomCylinderRenderer customcylinderrenderer = new CustomCylinderRenderer(apaint);
            customcylinderrenderer.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL));
            customcylinderrenderer.setBaseOutlinePaint(Color.gray);
            customcylinderrenderer.setBaseOutlineStroke(new BasicStroke(0.3F));
            customcylinderrenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
            categoryplot.setRenderer(customcylinderrenderer);
            return jfreechart;
        }    private static Paint[] createPaint()
        {
            Paint apaint[] = new Paint[5];
            apaint[0] = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.white);
            apaint[1] = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, Color.white);
            apaint[2] = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.white);
            apaint[3] = new GradientPaint(0.0F, 0.0F, Color.orange, 0.0F, 0.0F, Color.white);
            apaint[4] = new GradientPaint(0.0F, 0.0F, Color.magenta, 0.0F, 0.0F, Color.white);
            return apaint;
        }    public static JPanel createDemoPanel()
        {
            JFreeChart jfreechart = createChart(createDataset());
            return new ChartPanel(jfreechart);
        }    public static void main(String args[])
        {
            CylinderChartDemo1 cylinderchartdemo1 = new CylinderChartDemo1("Cylinder Chart Demo 1");
            cylinderchartdemo1.pack();
            RefineryUtilities.centerFrameOnScreen(cylinderchartdemo1);
            cylinderchartdemo1.setVisible(true);
        }
    }