Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


kagina
histogram
1 Answer(s)      4 years and 10 months ago
Posted in : Java Beginners



Advertisement
View Answers

October 20, 2009 at 10:49 AM


Hi Friend,

Try the following code:

import java.io.*;
import java.util.Random;
import org.jfree.chart.*;
import org.jfree.data.statistics.*;
import org.jfree.chart.plot.PlotOrientation;

public class HistogramExample {
public static void main(String[] args) {
double[] value = new double[100];
Random generator = new Random();
for (int i=1; i < 100; i++) {
value[i] = generator.nextDouble();
int number = 10;
HistogramDataset dataset = new HistogramDataset();
dataset.setType(HistogramType.RELATIVE_FREQUENCY);
dataset.addSeries("Histogram",value,number);
String plotTitle = "Histogram";
String xaxis = "number";
String yaxis = "value";
PlotOrientation orientation = PlotOrientation.VERTICAL;
boolean show = false;
boolean toolTips = false;
boolean urls = false;
JFreeChart chart = ChartFactory.createHistogram( plotTitle, xaxis, yaxis, dataset, orientation, show, toolTips, urls);
int width = 500;
int height = 300;
try {
ChartUtilities.saveChartAsPNG(new File("histogram.PNG"), chart, width, height);
} catch (IOException e) {}
}
}
}

Thanks


Related Tutorials/Questions & Answers:
HISTOGRAM
HISTOGRAM   read 10 singe digit value and disply HORIZONTAL HISTOGRAM
HISTOGRAM
HISTOGRAM   read 10 singe digit value and disply HORIZONTAL HISTOGRAM
Advertisements
histogram
histogram  read 10 single digit value and display horizontal histogram
histogram
histogram  read 10 single digit value and display horizontal histogram
histogram
histogram  read 10 single digit value and display horizontal histogram
histogram
histogram  read 10 single digit value and display vertical histogram
Related to Histogram
Related to Histogram  hi this is srinivasrao. In my project i have to display using chart for that i want to use histogram. k chart displayed but the values given by me is not related display chart so please give the code if u
histogram - Java Beginners
histogram  implement a histogram using a random generator  ...(HistogramType.RELATIVE_FREQUENCY); dataset.addSeries("Histogram",value,number); String plotTitle = "Histogram"; String xaxis = "number
Create Histogram using Jfreechart
Create Histogram using Jfreechart In this section, you will learn how to create histogram using jfreechart. To create a Histogram, we have used... of the Histogram. ChartFactory.createHistogram() have created the Histogram. Using
swings - Swing AWT
swings  i want to retrieve image using histogram of that image and display the histogram in the screen that is my problem
swing - Swing AWT
swing  hi..please help me to retrieve image using histogram of that image   Hi Friend, Please clarify your problem.Do you want to create a histogram by retrieving the data from the database and save the histogram
Histoqram - Java Beginners
Histoqram  I want to do show histogram, when the user clicks the button, a new window appears that displays a histogram to show the occurrence... java.awt.*; public class Histogram extends JPanel { // Count the occurrence
java - Swing AWT
java  hi can u say how to create a database for images in oracle and store and retrive images using histogram of that image plz help me its too urgent
Database Sql question? - WebSevices
Database Sql question?  Given relation r (a, b,c), show how to use the exstended SQL features to generate a histogram of c versus a, dividing a into 20 equal-sized partions (that is where each partition contains 5 percent
i need some help in understanding the following codes.thanks..
[][] histogram = new double[row][64]; for(i=0 ; i<row ; i++){ histogram[i] = new double[64]; for(j=0 ; j<64 ; j++){ histogram[i][j] = 0.0d; } } for(i=0 ; i<size ; i++){ k
Please help with this Q ASAP
Please help with this Q ASAP  The University wants to make a basic... a histogram. Each star represents a student who achieved a module mark in the range... category. Extras: 2. After the histogram, a variety of statistics should
Please HELPP
in a mark exceeding 100. At this point the program should display a histogram. Each star... the histogram, a variety of statistics should be displayed (e.g. average mark awarded, number of students passing, highest mark, and lowest mark) 3. The histogram
Please help with this Q
in a mark exceeding 100. At this point the program should display a histogram... should work with any number of student marks entered. After the histogram
Eclipse Metrics
a histogram for each metric (this does not work on Mac OSX due to some issues with the SWT implementation). The appropriate metric's histogram will be displayed
Types of Graphs and Charts
the side of bar graph compose the axis. This is also called as a histogram; Bar
 

 

 

DMCA.com