• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JFreeChart

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,

I have created a Chart with JFreeChart. The Code is as below. but i want to display the data with Dollar symbols.

please help me by telling that how can i display data in Chart with Dollar Symbols......


Code ::::::::->>>>>>>


import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;

public class PieChartExample extends JPanel
{
// Holds the data
private DefaultPieDataset dataset = new DefaultPieDataset();



// Create a set of charts
private JFreeChart chart1;
// Create a set of panels that can show charts
private ChartPanel panel1;
public PieChartExample()
{
// Initialize the dataset
dataset.setValue( "San", new Double( 16.0 ) );
dataset.setValue( "San1", new Double( 67.0 ) );
dataset.setValue( "San2", new Double( 18.0 ) );
dataset.setValue( "San3", new Double( 40.0 ) );

// Create the charts
chart1 = ChartFactory.createPieChart3D(
" Performance Chart ", // The chart title
dataset, // The dataset for the chart
true, // Is a legend required?
true, // Use tooltips
false // Configure chart to generate URLs?
);


// Create this panel
this.setLayout( new GridLayout( 2, 2 ) );
this.panel1 = new ChartPanel( chart1 );
this.add( panel1 );
}

public static void main( String[] args )
{
JFrame frame = new JFrame( "San Nan" );
PieChartExample chart = new PieChartExample();
frame.getContentPane().add( chart, BorderLayout.CENTER );
frame.setSize( 640, 480 );
frame.setVisible( true );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}
}



Thanks & Regards

San Nan
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to Other Open Source Projects
 
reply
    Bookmark Topic Watch Topic
  • New Topic