Friday, March 22, 2013

Bar Chart in java


import org.jfree.data.xy.*;
import org.jfree.data.*;
import org.jfree.chart.renderer.category.*;
import org.jfree.chart.plot.*;
import java.awt.*;

public class BarExample1{
public static void main(String arg[]){
  DefaultCategoryDataset dataset = new DefaultCategoryDataset();
  dataset.setValue(2"Marks""Rahul");
  dataset.setValue(7"Marks""Vinod");
  dataset.setValue(4"Marks""Deepak");
  dataset.setValue(9"Marks""Prashant");
  dataset.setValue(6"Marks""Chandan");
  JFreeChart chart = ChartFactory.createBarChart
  (
"BarChart using JFreeChart","Student""Marks", dataset,
   PlotOrientation.VERTICAL, false,true, 
false);
  chart.setBackgroundPaint(Color.yellow);
  chart.getTitle().setPaint(Color.blue)
  CategoryPlot p = chart.getCategoryPlot()
  p.setRangeGridlinePaint(Color.red)
  ChartFrame frame1=new ChartFrame("Bar Chart",chart);
  frame1.setVisible(true);
  frame1.setSize(400,350);
  }
}

6 comments:

  1. A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article. I am learning a lot from you.
    python Training in Pune
    python Training in Chennai
    python Training in Bangalore

    ReplyDelete
  2. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Best Devops Training in pune
    Devops Training in Bangalore
    Power bi training in Chennai

    ReplyDelete
  3. After seeing your article I want to say that the presentation is very good and also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.

    Data Science training in chennai
    Data Science training in OMR
    Data Science training in chennai
    Data Science Training in Chennai
    Data Science training in Chennai
    Data science training in bangalore

    ReplyDelete
  4. Awesome! Education is the extreme motivation that open the new doors of data and material. So we always need to study around the things and the new part of educations with that we are not mindful.
    DevOps Training | Certification in Chennai | DevOps Training | Certification in anna nagar | DevOps Training | Certification in omr | DevOps Training | Certification in porur | DevOps Training | Certification in tambaram | DevOps Training | Certification in velachery

    ReplyDelete
  5. Thanks for sharing a very useful article. Am sure it helped to clear the doubts I had. Keep posting more. Also dont forget to check out our pages too.

    data science training in chennai

    ccna training in chennai

    iot training in chennai

    cyber security training in chennai

    ethical hacking training in chennai



    ReplyDelete