public class MultiLineChart extends ApplicationFrame { public MultiLineChart(final String title) { super(title); final XYDataset dataset = createDataset(); final JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); } private XYDataset createDataset() { final XYSeries series1 = new XYSeries("Test"); series1.add(1.0, 60.0); series1.add(2.0, 80.0); series1.add(3.0, 35.0); series1.add(4.0, 100.0); series1.add(5.0, 95.0); series1.add(6.0, 85.0); series1.add(7.0, 70.0); series1.add(8.0, 30.0); series1.add(9.0, 45.0); series1.add(10.0, 50.0);
final XYSeries series2 = new XYSeries("Max marks to pass the test"); series2.add(1.0, 40.0); series2.add(2.0, 40.0); series2.add(3.0, 40.0); series2.add(4.0, 40.0); series2.add(5.0, 40.0); series2.add(6.0, 40.0); series2.add(7.0, 40.0); series2.add(8.0, 40.0); series2.add(9.0, 40.0); series2.add(10.0, 40.0);
final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series1); dataset.addSeries(series2);
return dataset; } private JFreeChart createChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createXYLineChart( "Marks obtained by students in tests", "Roll No of the students", "Marks", dataset, PlotOrientation.VERTICAL, true, true, false ); chart.setBackgroundPaint(Color.white); final XYPlot plot1 = chart.getXYPlot(); plot1.setBackgroundPaint(Color.lightGray); plot1.setDomainGridlinePaint(Color.white); plot1.setRangeGridlinePaint(Color.white);
final XYPlot plot2 = chart.getXYPlot(); plot2.setBackgroundPaint(Color.lightGray); plot2.setDomainGridlinePaint(Color.white); plot2.setRangeGridlinePaint(Color.white);
final XYPlot plot3 = chart.getXYPlot(); plot3.setBackgroundPaint(Color.lightGray); plot3.setDomainGridlinePaint(Color.white); plot3.setRangeGridlinePaint(Color.white);
return chart; } public static void main(final String[] args) { final MultiLineChart demo = new MultiLineChart("Multi Line Chart"); demo.pack(); RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); } }
Thanks
Related Pages:
Multiline graphs in java - Java Beginners Multilinegraphs in java How to draw a multiline graph in java, One will b constant straight line and the other is changing Hi Friend,
Try the following code:
import java.awt.*;
import org.jfree.ui.*;
import
Graphs in java - Java Beginners Graphs in java Hi...
I need to generate a graph by using the database values using java
I know about the JFreeChart class...
But by using that...I'm unable to display the values in the chart.
I'm just getting the points
graphs/charts - JSP-Servlet graphs/charts hi,
How to create a graph/chart in java by reading values from my sql database. Hi Friend,
Try the following code:
import java.sql.* ;
import java.io.* ;
import org.jfree.chart.ChartFactory
Good Looking Java Charts and Graphs
Good Looking Java Charts and Graphs Is there a java chart library that will generate charts and graphs with the quality of visifire or fusion charts?
The JFreeChart graph quality is not professional looking. Unless it can
Line Graphs in java - Java Beginners
Line Graphs in java Hi...
I need to generate a graph by using the database values using java
I know about the JFreeChart class...
But by using that...I'm unable to display the values in the chart.
I'm just getting
Drawing Graphs - Swing AWT
Drawing Graphs hi i am doing a small project in java swings . there is a database table having two columns A,B i want to plot a graph to that values in database the graph must be interactive graph
Graphs using JFreeChart - Java Beginners Graphs using JFreeChart Hi Friend,
I need to draw a graph of the powerconsumed by a consumer in specific dates with a const line showing the max power can be consumed.
Now My data is like this
15-12-2009 150
16-12-2009
Chart & Graphs Tutorials in Java
Chart & Graphs Tutorials in Java
 ... in Java. Our Chart and Graphs
tutorials will help learn everything you need to learn about chart and graphs
programming in Java. We have provided many examples
graphs in jsp - Java3D graphs in jsp i want to present my data from database in graphs how can i present in jsp and servlet.please guide me.thanz in advance
Drawing Graphs - Java3D
Drawing Graphs how to draw graphs using certain parameters Hi Friend,
To draw a graph using JfreeChart library, please visit the following link:
http://www.roseindia.net/chartgraphs/index.shtml
Here you
graphs/charts - JSP-Servlet graphs/charts hi frens,
How to create a bar graph by reading values from mysql database. Please help me out... Hi Friend,
We have used jfreechart library to create a bar graph. And the chart displays
Introduction to Graphs and Charts
Introduction to Graphs and Charts
Why Charts and Graphs?
Graphs... difficult and tedious process.
All forms of Graphs and Charts embodies some Visual
Types of Graphs and Charts
Types of Graphs and Charts
There are many types of graphs and charts....
Line graphs: A line graph is a way of representing two pieces of
information
ispace - a scalable dependency visualization system for Java
ispace - a scalable dependency visualization system for Java...-based tool for visualizing,
analyzing, and experimentally reorganizing Java dependency graphs. The tool
provides a set of simple but flexible means
jgraph
;
Jgraph is open source software for drawing graphs and structured drawings. Jgraph is written in Java Programming language. Jgraph was started by Gaudenz Alder in 2000 and first released in 2001.
JGraph can be used to create graphs
importing excel file and drawing multiple graphs from one excel file
importing excel file and drawing multiple graphs from one excel file thanks a lot sir for replying with code for importing excel file and then plotting grph:) it really helped me:):) If you can please help me with one more thing
TextArea Frame in Java
TextArea Frame in Java
 ..., we are going to
create TextArea object. TextArea object is a multiline....
Description of this program:
This java program displays the text area using java AWT
Graph
Graph What is the code to generate the following graphs?
1.Simple Bar diagram
2.Sub-divided Bar diagram
3.Pie chart
Please Help!!!!
Please visit the following link:
Java charts and graphs
data structures - Java Beginners
data structures I have got a project of the subject 'data structures and C++' and the topic is 'types of graphs'. please guide me on this topic and help me finding material of this topic
Java Comments - Java Tutorials
.style1 {
text-decoration: underline;
}
Comments in Java
Comments in Java holds the description or hint about the code or explanations... ignore these comments and do
not compile it.
Types of comment
Java supports
Compiling a Pattern with Multiple Flags
with multiple flags like multiline, case insensitivity of the characters... denotes for the multiline characters in the given string. This
field determines the compilation of the string with the multiline character
which breaks
Open Source Charting and Reporting Tools in Java
Open Source Charting and Reporting Tools in Java... of them are given
below :
JfreeChart: This is a free java library for creating different types of charts and graphs including:
pie charts (2D
how to run org.jfree programss - Java Beginners
how to run org.jfree programss Hi frends,
I was trying to run java programs to draw graphs from the link as my frend deepak has given... the above link java programs........
Thanks Hi Friend,
To run
Doubt Regarding Charts
Doubt Regarding Charts Hi,
Can you please help me out by answering "hoe to include charts in core java code and struts code"
thanks in advance... charts and graphs
Including applet in JSF (XHTML)
Including applet in JSF (XHTML) Hi
I want to generate graphs in facelets project. We are using JSF 2.0. We have Perspective for Java to generate graphs. in this project. So, Perspective for Java is providing an applet which i
Comments in Jsp
by the jsp engine into java comments in the source code of the servlet...;This is multiline comment inside scriptlet tags");
System.out.println
("This is multiline comment inside scriptlet tags");
System.out.println
combobox updation - Java Beginners
combobox updation hi,
i am using java swing to develop a gui-there are 4 components in the gui: menus,3 comboboxes,buttons and graphs... for more information.
http://www.roseindia.net/java/example/java/swing
Java I/O Object Streams
data types and graphs of Java
objects into an output stream. This class can...Java I/O Object Streams
In this section we will discuss the Java IO Object Streams.
To work with the I/O of objects Java provided the support of Object
Java ObjectOutputStream
the primitive data types
and the graphs of Java objects to the output stream. It writes...Java ObjectOutputStream
In this tutorial we will discuss about the Java class.... In this
example at first I have created a Java class which writes the objects
Java AWT Package Example Java AWT Package Example
In this section you will learn about the AWT package of the Java...
A class library is provided by the Java programming language
which is known
Generate RDF file in Java
of "Jena". Jena is a java API to create and
manipulate RDF graphs...
Generate RDF file in Java
In this example we are going to generate our first RDF
Java store objects in File Java store objects in File
In this section, you will learn how to use the ObjectOutputStream and
ObjectInputStream to write and read serialized object... for graphs of objects when used with a FileOutputStream and
FileInputStream
java java in java does not pointers concept but what is nullpointers in java?
nullpointer is a runtime Exception
java
what is the size of array in java ? what is the size of array in java ?
what is the mean of finalize in java
Java I/O Data Streams
types and
graphs of Java objects into an output stream.
Methods...Java I/O Data Streams
In this tutorial we will discuss the Java I/O Data... as the
String values Java provided the support of Data stream. DataInput