-1

I have scoured the internet for multiple hours trying desperately to figure out how to place a JFreeChart in a JSP page.

Nothing works. I am not sure why, I am not very good at JSP, so maybe its because I am missing something. I am using netbeans with glassfish.

How to display line graph using JFreeChart in jsp?

I feel that the above link has promise. I tried it, but to no avail. all I get is a little image box with an x in it.

http://jspmaster.blogspot.com/p/bar-charts.html

I also tried the above link. Its a different strategy. I get the same stupid little image box with an x in it.

At this point I just want to show an empty graph. I'll deal with specifics later, but I can't even do that.

Would there be any reason why this doesn't work? Am I missing something so simple?

Perhaps someone could recommend another technology I could use for displaying bar charts on a web page. I was thinking ASP.net would be a lot easier.

Thanks,

Jake

Community
  • 1
  • 1
Jake
  • 19
  • 1
  • 1
  • 7
  • This thing creates an image file. So start by creating an image file and writing to disk. See if that works. Then when that's working try to figure out how to properly output an image via a servlet. If you're trying to output the image buffer in a JSP rather than Servlet, it ain't gonna work, by the way. – developerwjk Feb 26 '14 at 23:54

2 Answers2

0

I would recommend Flot for web-based charting even over my own open source API XChart, which is geared more towards desktop applications. Here is a HelloWorld type example application with source code demonstrating Flot that I made at one point. If you're more interested in fetching a JPEG containing a chart, you can see how I do it with XChart (Bonus Example, bottom of page), and you could probably do something very similar with JFreeChart without even needing to save the jpeg to disk first.

herrtim
  • 2,697
  • 1
  • 26
  • 36
0

Thanks for the help, I ended up using highchart in JavaScript, and it is loads easier. Everything is dynamically created, and it is a breeze to place data in via JSP.

I have learned that JFreeChart is the devil, and you should not touch.

Jake
  • 19
  • 1
  • 1
  • 7