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



Home Answers Viewqa Java-Beginners Jfreechart setting Legends

Have Programming Question? Ask it here!
 
 
 


santosh
Jfreechart setting Legends
1 Answer(s)      4 years and a month ago
Posted in : Java Beginners


Hi...
i am using JfreeChart in my web app. for creating charts.I am trying to make the legends as vertical in Stacked bar chart. Does anybody know How to set the legends in any graph as vertical...????


please reply me if you know it...thanks in advance.....


Advertisement
View Answers

June 10, 2010 at 4:36 PM


Hi Friend,

Try the following code:

<%@page import="org.jfree.ui.*"%>
<%@page import="org.jfree.chart.*"%>
<%@page import="org.jfree.data.category.*"%>
<%@page import="org.jfree.chart.plot.PlotOrientation"%>
<%
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(10, "Girls","Chess");
dataset.addValue(15, "Boys", "Chess");
dataset.addValue(17, "Girls","Cricket");
dataset.addValue(23, "Boys","Cricket");
dataset.addValue(25, "Girls","FootBall");
dataset.addValue(20, "Boys","FootBall");
dataset.addValue(40, "Girls","Badminton");
dataset.addValue(30, "Boys","Badminton");
dataset.addValue(35, "Girls","Hockey");
dataset.addValue(32, "Boys","Hockey");

final JFreeChart chart = ChartFactory.createStackedBarChart(
"Stacked Bar Chart Demo 1",
"Category",
"Value",
dataset,
PlotOrientation.VERTICAL,
true,
true,
false
);
try
{
ChartUtilities.saveChartAsJPEG(new File("C:/chart.jpg"), chart, 400, 300);
}
catch (IOException e)
{
System.out.println("Problem in creating chart.");
}
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
ApplicationFrame f=new ApplicationFrame("Chart");
f.setContentPane(chartPanel);
f.pack();
f.setVisible(true);

%>

Thanks


Related Tutorials/Questions & Answers:
Jfreechart setting Legends - Java Beginners
Jfreechart setting Legends  Hi... i am using JfreeChart in my web app. for creating charts.I am trying to make the legends as vertical in Stacked bar chart. Does anybody know How to set the legends in any graph as vertical
jfreechart
jfreechart  hi how install jfreechart? and how free download jcommon? plz insert link for this? thanks   Hi Friend, Please visit the following link: Download JFreechart Download jfreechart-1.0.13.zip from the given
Advertisements
JFreechart & JCommon
JFreechart & JCommon   hi........... thanks a lot. The code is running successfully and able to get the output. Thanks once again
Error in JfreeChart
Error in JfreeChart  I am getting an error when i am using jfreechart for graph generation, that is: D:\my\linechart.java:5: package org.jfree.chart... and download the jfreechart api: http://www.brothersoft.com/jfreechart
Error in JfreeChart
Error in JfreeChart  I am getting an error when i am using jfreechart for graph generation, that is: D:\my\linechart.java:5: package org.jfree.chart does not exist import org.jfree.chart.*; what is the reason and possible
JFreeChart- Display coordinate value .
JFreeChart- Display coordinate value .  How to Mark Coordinte value on top of the bar
JFreeChart - An Introduction
JFreeChart - An Introduction       JFreeChart is a free open source java chart library. David Gilbert founded the JFreeChart project in February 2000. Now a days
how to install jfreechart in netbeans.
how to install jfreechart in netbeans.  I have successfully installed jfreechart in eclipse IDE.but I am unable to install the same in netbeansIDE 6.7.1 .There is some error regarding the ant folder.Please tell the step by step
Jfreechart zoomin and zoomout - Framework
Jfreechart zoomin and zoomout  how to zoomin and zoom out chart using button plus and minus or slide bar in jFree chart
setting keys
setting keys  Hi Sir\Mam,At present we are doing Payroll Project .I would like to set some special keys for my forms and i want the coding to do the same .Pls Provide me source code for setting keys as soon as possible
Jfreechart - Java Beginners
Jfreechart  Hi Team, Am very new to Jfreechart concept. And I was tried to configure Jfreechart in my system but I cant. Can any one pls guide me how to install and configure JFreechart from the basic with the necessary files
JFreeChart dosn't work
JFreeChart dosn't work  Hello everybody I'm trying to make a line chart from JFreechart, but I just can't get it to work. The graph get its data...(temp, "", dateinput); } JFreeChart chart
utiliser jfreechart dans portlet struts
utiliser jfreechart dans portlet struts  Bonjour. J'ai un pfe,et mon application m'impose d'utiliser jfreechart,je trouve juste la documentation de jfreechart avec struts2 seulement,mai je l'ai besoin ds un portlet liferay. vu ke
Jfreechart chart display problem
Jfreechart chart display problem  Using JSP and Jfreechart displays...(request.getParameter("q")); String query="select dateof,dayinprice,company from stockprice..."); dataset.executeQuery(query); JFreeChart chart = ChartFactory.createLineChart
Using JFreeChart to display recent changes in a time series
Using JFreeChart to display recent changes in a time series  Using JFreeChart to display recent changes in a time series
Class files for Jfreechart - JSP-Servlet
Class files for Jfreechart  Respected Sir/Madam, I am Ragavendran.R.. I have downloaded Jfreechart 1.0.13 in my system for performing..... Regards, Ragavendran.R..  Hi Friend, Jar file Jfreechart 1.0.13
setting web page size
setting web page size  How to set the webpage size in Java
Setting file extension
Setting file extension  Hi, I have used FileChooser to save a file. When I was trying to save it, the extension of the file is showing 'File'. How can I save that file to .xls ? Thanks
Graphs using JFreeChart - Java Beginners
(); dataset.addSeries(s1); dataset.setDomainIsPointsInTime(true); JFreeChart
Setting Cookie
Setting Cookie  setcookie function is used for setting up a cookie. In the following example, if you use $_COOKIE command, you will view one cookie value, and if you see print_r ($_COOKIE), you will view all cookie value. We have
setting RGB for a circle
setting RGB for a circle  how can i change the color of the circle(not through filling it) and i want to use RGB (not regular colors such as black or red..) i should include RGB numbers (for example 240, 150, 19) but i am
Setting environment variables
Setting environment variables  Hi, I have a java web application running on jboss AS. 1)How do I set the environment variable in jboss? 2)How do I get the environment variable from jboss
Setting File Attributes
Setting File Attributes  I would be glad if anyone could help me set file attributes in java I would like to know how to set the hidden file attribute or the read only file attribute. Thank you
Setting File Attributes
Setting File Attributes  I would be glad if anyone could help me set file attributes in java I would like to know how to set the hidden file attribute or the read only file attribute. Thank you
problem in setting path - Ant
problem in setting path  hi friends i am getting a problem in setting but i followed the procedure same as like in http://www.roseindia.net... Do some changes setting the path : 1)ANT_HOME=D:\installations\apache
Setting File Attributes
Setting File Attributes  I would be glad if anyone could help me set file attributes in java I would like to know how to set the hidden file attribute or the read only file attribute. Thank you   Hi Friend, If you want
Setting of java1.4.2 path
Setting of java1.4.2 path  Hello I have uploaded java1.4.2 into my laptop and i have done path settings for System variabales as Path (C:\j2sdk1.4.2\bin) and classpath(C:\j2sdk1.4.2\lib) .But when i write simple
Setting File Attributes
Setting File Attributes  I would be glad if anyone could help me set file attributes in java I would like to know how to set the hidden file attribute or the read only file attribute. Thank you   Let me know
Setting the default Java character encoding?
Setting the default Java character encoding?  Setting the default Java character encoding
path setting - JSP-Servlet
setting this path i need to give the full path from drive name, instead of this if i
path setting - JSP-Servlet
. While setting this path i need to give the full path from drive name, instead
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 the class  HistogramDataset. Then method addSeries()  allows to add the series
How to display jfreechart at specified place in jsp
How to display jfreechart at specified place in jsp  I have a jsp page where i need to display the chart at specified position...("Inet", 20); JFreeChart chart = ChartFactory.createPieChart3D
Setting up the environment
Setting up the environment       To run the example of DbUnit in Eclipse, we need jar files of  DbUnit, JUnit and Jakarta Commons IO. DbUnit is available from
Setting Variable Scope
Setting Variable Scope In this section we will learn about the different scope of the JSP variables. While developing the program you can store the variables in different scope. If you store the values in the application scope
jfreechart display from access database data.
jfreechart display from access database data.  I have made a database... the bar graph using jfreechart API .This whole retrieval and display of chart...", "sun.jdbc.odbc.JdbcOdbcDriver","root","root"); dataset.executeQuery(query); JFreeChart chart
Setting source port on a Java Socket?
Setting source port on a Java Socket?  Is it possible to explicitly set the the source port on a Java Socket
JFreechart Stacked Bar Chart
JFreechart Stacked Bar Chart JFreechart provides a way to create various... JFreeChart chart = createChart(dataset); final ChartPanel chartPanel = new..."); result.addValue(32, "Boys", "Hockey"); return result; } private JFreeChart
JFreechart multi line chart help in JSP
JFreechart multi line chart help in JSP  Hi, I am am looking for and help in getting multi line chart with Jfree chart, i had manage to write..."); dataset.executeQuery(query); //(final XYDataset dataset){ final JFreeChart chart
Enable Proxy Setting
In this section, you will learn to enable proxy setting for Maven using setting.xml file
Setting up development Environment for spring
Setting up development Environment for spring  Hi, Am learning spring from this site.. I found how to install the spring at http://www.roseindia.net... to setting up development environment for that.. It directly skipped
Setting the Monitor brightness using Java
Setting the Monitor brightness using Java  I am Facing problem in writing a code to change the Monitor Brightness using Java. This problem is solved using ASP.net how to change in java please give me some suggestions
variable setting for servlet - JSP-Servlet
variable setting for servlet  how to set environment variable and class path variable for servlet and to compile servlet files i am using tomcat 6.0  Hi Friend, Please visit the following links: http
jfreechart displaying chart from access database
jfreechart displaying chart from access database  I have these 2... "Short description"; }// </editor-fold> } and a jfreechart file..."); JFreeChart chart = ChartFactory.createBarChart("MARKS INFORMATION
setting php session variable by ajax
setting php session variable by ajax  Hello folks, i developing a php website where the content of the section load dynamically from database by AJAX. I need to set session variable on click on the content of that section. i
setting classpath of tomcat - Java Beginners
setting classpath of tomcat  hello i am giri. I Installed the Tomcat6 in my system and the problem is, How to set the classpath, Please give the solution.  Hi Friend, Go to Start->Settings->Control Panel->
problem in setting the values from database
problem in setting the values from database  hello friends, can... Stmt after setting the values " + pst.toString()); rs...)); } JOptionPane.showMessageDialog(null,"Prepared Stmt after setting the values
Stacked Bar Chart using JFreeChart
Stacked Bar Chart using JFreeChart       This Example shows you how to create a Stacked bar chart using JFreeChart. In the code given below we have extended class
How to display Jfreechart from servlet in jsp web page at specified location
How to display Jfreechart from servlet in jsp web page at specified location  Hello Sir, I am developing a demo project in which i need to display the chart in web page. I generated the chart using Jfreechart
Advertisements
 

 

 

DMCA.com