Click to See Complete Forum and Search --> : charting in jsp.
Casey
November 13th, 2003, 03:28 PM
Hello, Im trying to use either cewolf or jspchart to add charting functionality to my jsp page. I cant get either to work using their tutorials. All I need is to be able to createa simple chart , does anyone have experience with these charting tools? or does anyone hae sample code to generate a graph for a JSP.
I think I could customize to what I need if some one had an example I could use
Thanks
Casey
dmeikle
November 14th, 2003, 12:57 AM
could you please post a link to the software? I'm interested in charting, and if I figure it out, I'll definitely fill you in.
cheers,
David Meikle
Casey
November 14th, 2003, 09:05 AM
Heres the link to CeWolf:
http://cewolf.sourceforge.net/
And heres the link to JSPChart:
http://www.javaside.com/u_jspchart.html
Please let me know if you can get it to work. I have tomcat and that seem like all ou need, but I cant get them to work.
Thanks for replying
Casey
dmeikle
November 17th, 2003, 04:10 AM
hmmm....I got it to work as soon as I uploaded it and tried the sample jsp files provided. You can view my attempt here:
http://cew.quantumunit.com/test/jspChart.jsp
quite a nice looking chart, actually.
So I am assuming this is an issue of configuration on your java webserver.
I copied the complete 'javaside' folder into my WEB-INF/classes directory. It gave me some weird creation error while uploading (ftp) so I elected NOT to upload the zip file with it, but I already have the acme.com gif encoder jar file.
from there, I uploaded the jsp files provided into a 'test' folder and let 'er rip. So like I said, perhaps you've placed the folders in the wrong directory? Or tried to upload and remove parent folders? My first desire was to lose the 'javaside' folder and bring the classes up a little higher in their path...but then I figured perhaps he's compiled them using a package that requires that path so I left the folder structure untouched. Just placed the whole thing in my 'classes' folder inside of WEB-INF 'as is'. worked first time.
I'm using Resin as a webserver.
dmeikle
November 17th, 2003, 04:45 AM
found another one, that had a class file and a single htm file to call it, which you could also change to a jsp file for dynamic drawing. this one is an applet...granted it's not as pretty as the last...
http://www.triviuminc.com/samples/drawchart.htm
Casey
November 17th, 2003, 08:05 AM
OK I think you are right. I was putting the files into the wrong folders. I just did what you said and it worked great. The CeWolf Also creates great charts. Im going to try to get that to work too. Thanks for your help.
Casey
mikedershowitz
November 17th, 2003, 08:35 AM
Not to throw you guys off the track, but didn't the J2EE api have a charting set of classes as well?
dmeikle
November 17th, 2003, 09:02 AM
i know java has a set of charting APIs....but this was closer to spoon feeding me....hahahaaaa
dmeikle
November 20th, 2003, 12:52 AM
Casey,
If you're interested, I'm almost finished writing a small jar file that will generate jpeg charts for you. It's my first try at using awt (I usually do backend network/database programming, but it's pretty straightforward/easy code once you look at it.
It uses a base class I called
Base2DImage - creates an instance of the canvas
then Grid2DImage extends Bas2Dimage -places a grid on the canvas if required
Graph2DImage extends Grid2DImage -provides an abstract template for the actual charting classes (public void draw();)
the actual Implementing classes:
LineChart2DImage
LineFiled2DImage
PieChart2DImage
OffsetBarChart2DImage
BarChart2DImage
they all work by receiving
(int width,int height,String[] xList,String[] yList,ArrayList values, ArrayList colors)
if you don't want x & y text on the side of the chart, there's another constructor that excludes those params...Grid2DImage will check that and automatically draw/not draw it in.
PieChart class receives an array of colors, but an int[] values instead.
right now, during testing, it writes to the void draw(String outputPath) but with the source code, you can alter that to be any output method you like.
If you want it, let me know.
David Meikle
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.