Dynamic Pie Charts

Hi all,

I have found (in the jdc) that it seems to be difficult to create a dynamic (data coming from db) Pie chart using JSP page. I did a beans that create basic Bar charts. Is there any way to do the same for a pie charts ? (without commercial solutions).

I'll prefer a Beans instead of a applet, but at least this solutions can be take.

Thanks a lot

STF

[403 byte] By [LearningSTF] at [2007-9-26 1:28:51]
# 1

HiLearningSTF,

Here I am giving you sample code below:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

<title>Pie Bean</title>

</head>

<body>

<h2>Pie Chart Bean Example</h2>

<%@ page import="com.sas.graphics.chart.*" %>

<%@ include file="Sampledata.inc" %>

&ltjsp:useBean id="pie" class="com.sas.servlet.beans.graphics.html.Pie"

scope="session">

</jsp:useBean>

<%

// Set the model

pie.setModelInterface(dataModel);

pie.setTitle("Product Sales");

pie.setPieLabelType( com.sas.graphics.chart.PieLabelTypes.SECTOR_WEIGHT );

DiscreteColorLegendStyle discreteLegendStyle = pie.getSectorLegendStyle();

discreteLegendStyle.setColorScheme(com.sas.graphics.chart.ColorSchemeTypes.INDUSTRY );

discreteLegendStyle.setVisible( false );

PolarLegendStyle polarLegendStyle = pie.getWeightLegendStyle();

polarLegendStyle.setStartAngle( 180.0D );

// Output the Pie

pie.setHeight(300);

pie.setWidth(400);

pie.setRequest(request);

pie.write(out);

%>

</body>

</html>

I hope this will help you out.

Regards,

TirumalaRao.

Developer TechnicalSupport,

sunMicroSystem,India.

rao_indts at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

The difference is that it is quite easy to create bar charts using tables in HTML if you are writing the system dynamically, but a pie chart has to be created as an image.

Take a look at some of the AWT demonstrations you downloaded with the JDK- I believe there are some relevant parts in those.

Breakfast at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

HI rao_indts ,

Thanks for your reply, your solutions is very interessant.

This enligth me, because now I know that this could be done thanks to a beans.

But where did you find the used beans ?

Is it one of yours (developped by yourself) or is it a package that you found somewhere (where ?) ?

Thanks

STF

(web development student)

LearningSTF at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Hi TirumalaRao, do you know how to write word document dynamically?
sribk at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Hi Srikanth Kate, The only things I have found on generate a dynamic word doc is in this thread http://forums.java.sun.com/thread.jsp?forum=48&thread=84577I don't know you had a eyes on so...Regards STF
LearningSTF at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Hi LearningSTF,Thanks for the reply. Still if you have any problem regarding this code please post the query.I hope this will help you out.Regards,TirumalaRao.Developer TechnicalSupport,Sun MicroSystem,India.
rao_indts at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

Hi,

Thanks for your reply too, your help is precious.

But, in fact, I already did the query and the statistical statment and both works fine.

I'm working on a subject which is create a intranet web site which should be able to show statistical data (by charts) coming from the Remedy (oracle) database

The only problem that i still have is to "build or find this beans that create pie charts".

I'm investigating in findding some ressources, hope i will succeed in my search.

Thanks

STF

(web development student)

LearningSTF at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
Please send the total code for me to creating charts dynamically.Thank You.
sngolla at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9

> Please send the total code for me to creating charts

> dynamically.

>

> Thank You.

Please send me too! I need your help verty urgent!

I can't programming any kind of Chart , but I need to

create a dynamic Bar and Pie Chart now, and I can't

understand what rao_indts means completely.

so,please kindly to teach me how to create.

I will be very appreciate!

Best Regards.

selina_c at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 10
Dear rao_indts:Would you please tell me what the "Sampledata.inc" should be wrote inside? and where the bean "Pie" come from? URGENT! thank you!Regards
selina_c at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 11

In your example for dynamic pie charts in a jsp you give

the following class "com.sas.servlet.beans.graphics.html.Pie"

does this come with the jdk?

Thanks Jeff Hechter

<%@ include file="Sampledata.inc" %>

&ltjsp:useBean id="pie" class="com.sas.servlet.beans.graphics.html.Pie"

scope="session">

jhechter at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 12
you can use RChart with JSP as:BEAN http://www.java4less.com/faqs_chart.htm#F12APPLET http://www.java4less.com/faqs_chart.htm#F10SERVLET http://www.java4less.com/faqs_chart.htm#F11
rreport at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 13
Maybe you should try Cewolf which is a chart tag library to generate all kinds of charts in a JSP. See http://cewolf.sourceforge.net.Regards,Guido
laures at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 14
plz help me ,,,how to draw a class diagram using jsp?
lakshmi_1981 at 2007-6-29 1:15:11 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 15
hi STF i saw your query, you had done dynamicaly created bar chart , i need dynamic bar chart using jsp/servlet format .so can you send me a sample code .thanks Rasa
Rasa at 2007-6-30 21:56:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...