histogram

histogram

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
ModuleNotFoundError: No module named 'histogram'
ModuleNotFoundError: No module named 'histogram'  Hi, My Python... 'histogram' How to remove the ModuleNotFoundError: No module named 'histogram' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'histogram'
ModuleNotFoundError: No module named 'histogram'  Hi, My Python... 'histogram' How to remove the ModuleNotFoundError: No module named 'histogram' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'histogram_plus'
ModuleNotFoundError: No module named 'histogram_plus'  Hi, My... named 'histogram_plus' How to remove the ModuleNotFoundError: No module named 'histogram_plus' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ps-histogram'
ModuleNotFoundError: No module named 'ps-histogram'  Hi, My Python... 'ps-histogram' How to remove the ModuleNotFoundError: No module named 'ps-histogram' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'rank-histogram'
ModuleNotFoundError: No module named 'rank-histogram'  Hi, My... named 'rank-histogram' How to remove the ModuleNotFoundError: No module named 'rank-histogram' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'text_histogram'
ModuleNotFoundError: No module named 'text_histogram'  Hi, My... named 'text_histogram' How to remove the ModuleNotFoundError: No module named 'text_histogram' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'boost-histogram'
ModuleNotFoundError: No module named 'boost-histogram'  Hi, My... named 'boost-histogram' How to remove the ModuleNotFoundError: No module named 'boost-histogram' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'fast-histogram'
ModuleNotFoundError: No module named 'fast-histogram'  Hi, My... named 'fast-histogram' How to remove the ModuleNotFoundError: No module named 'fast-histogram' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'histogram_plus'
ModuleNotFoundError: No module named 'histogram_plus'  Hi, My... named 'histogram_plus' How to remove the ModuleNotFoundError: No module named 'histogram_plus' error? Thanks   Hi, In your python
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
ModuleNotFoundError: No module named 'image-array-and-histogram-rrsc'
ModuleNotFoundError: No module named 'image-array-and-histogram-rrsc' ...: No module named 'image-array-and-histogram-rrsc' How to remove the ModuleNotFoundError: No module named 'image-array-and-histogram-rrsc' error
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
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
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
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
Eclipse Metrics
HTML, you can elect to create a histogram for each metric (this does not work... metric's histogram will be displayed on each page. Click here to know more about
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
JFreeChart Tutorial
from the database..   Create Histogram using JFreeChart - In this section, you will learn how to create histogram using
Types of Graphs and Charts
as a histogram; Bar Graph is useful when there is a numerical comparison.  
R Programming Training Course
: Box Plot Histogram Pareto Charts Pie Graph Line Chart
R Tutorial
topics are covered:ADS_TO_REPLACE_4 Box Plot Histogram Pareto
Data Science learning path for beginners
Scatter Plot Tree & Tree Map Histogram Pile Chart 7. Big Data

Ads