I've been looking through examples online about charting libraries to work with in a Java Web Application but they all keep trying to implement some form of php to get the data before the chart is produced.
Ideally I would like to use google charts and then take data from my database through jsp/ servlet of some sort but I can't find any examples online without php.
I've tried Jfreechart but again can't find much documentation.
question I'm trying to ask is, How would I be able to draw charts that get data from MySQL and display them on my web page. All this is in Netbeans currently.
Thanks in advance,
Rather than using jsp/servlets, have you considered using Java Server Faces? You can find an explanation of the differences here .
If you were to use Java Server Faces, you would then be able to use PrimeFaces Charts to create something like this:
You can see a full set of examples at the PrimeFaces website, and there is a tutorial on creating Generating a JavaServer Faces 2 Application here that covers creating an appplication lined to a MySQL database.
Using this method, you would place the chart data inside a bean and then reference it (the bean) from your webpage.
If you want to use JFreeChart, you can use ChartUtilities#saveChartAsXXXX
to save an image of the chart on the server and then include a link to the the generated image inside your webpage.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.