tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Charts > JFreeChart > Horizontal 3D Bar Chart

Horizontal 3D Bar Chart 

JFreeChart is a free and pure java chart library for creating professional quality charts. This requires the libraries jfreechart-1.0.13.jar and jcommon-1.0.8.jar to be in classpath. The following example shows creating a simple horizontal 3D bar chart.

File Name  :  
com/bethecoder/tutorials/jfree_charts/tests/Horizontal3DBarChart.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.jfree_charts.tests;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;

public class Horizontal3DBarChart {

  public static void main(String arg[]) {

    // Prepare the data set
    DefaultCategoryDataset barDataset = new DefaultCategoryDataset();
    barDataset.setValue(26"Drinks""Coca-Cola");
    barDataset.setValue(20"Drinks""Pepsi");
    barDataset.setValue(12"Drinks""Gold Spot");
    barDataset.setValue(14"Drinks""Slice");
    barDataset.setValue(18"Drinks""Appy Fizz");
    barDataset.setValue(10"Drinks""Limca");

    //Create the chart
    JFreeChart chart = ChartFactory.createBarChart3D(
        "Soft Drink 3D Bar Chart""Drink""Share", barDataset,
        PlotOrientation.HORIZONTAL, false, true, false);
    
    //Render the frame
    ChartFrame chartFrame = new ChartFrame("Horizontal 3D Bar Chart", chart);
    chartFrame.setVisible(true);
    chartFrame.setSize(560350);
  }
  
}
   

It gives the following output,
h3dbar.jpg


                    Print

   



Books Recommendation

 
 
bl  br