I am developing a web application using Spring. I need to plot graphs and display them to the user. The values are stored in a database. How do I achieve this?
You have to decide where do you want to create the charts. You have two options:
Creating the chart on the server and send them to the client as image or pdf.
Sending raw data to the client and let them render the charts via html, flash or javascript
Each way has its own advantages and limitations - you have to decide for your specific use case.
If you render the charts on server side you are limited regarding interactivity but you clients don't need much performance to render the charts. Here you have to think about caching to protect your server performance.
On the client side you have to deal with diffent browsers and must think about the client render performance.
If 2. is ok for you, I would recommend using javascript - so your users don't need to install any plugins like flash and you have a lot of possibilites to create nice charts.
There are some nice frameworks to create charts using javascript, for example:
HighCharts
gRaphaƫl
JS Charts
...
I have used Google Charts with Spring MVC before. Normally whenever I have needed to display chart, I have always displayed tabular data along side the chart as well. So, I just take jQuery, parse the html table for data and pass it to google Chart API. You may want to look at the Google Chart pages for examples. It is quite nice.
As #aiolos said, you can generate your chart image in the client or in the Server. I haven't work with JavaScript enabled charts, but when I have to generate charts the server-side way i'll go with Cewolf. It's a Java Library based of JFreeChart that has some useful tags to embed charts in JSP pages.
I tested it in Spring Applications and works like a charm.
Related
I'm building a reporting application that's using DynamicJasper for exporting data to xls. The reports are pretty dynamic in the sense that the user is able to customize the queries (one or more) that fetch the data. The resulted data can be rendered as a table or as a chart.
Currently the tables and the charts (pngs) are rendered one after the other, in order, in a 'one column' layout. I would need to add support for a 'two column' layout. For example, to be able to have the tables/charts rendered side by side.
I have to mention that I'm using the DynamicReportBuilder.addConcatenatedReport API. No jasper-reports templates are being used.
Are there any solutions to achieve this?
No, it is not supported.
It could maybe achieved with sub-reports, but coding is needed. not easy
I'm having the following scenario: I'm displaying charts in the client side using the Javascript chart library Raphael. On clicking download I need to generate the same chart into pdf and display it to the user. I'm using JFreeChart to create charts on the server side. The problem is that since I'm using two different chart libraries, both look different. What is the solution for this?
The chart should be free for commercial use.
4 options here :
Use Google Chart. http://code.google.com/apis/chart/
JQuery Chart. http://www.1stwebdesigner.com/css/top-jquery-chart-libraries-interactive-charts/
Create Applet, use your JFreeChart and put it on the applet. Then provide the data from javascript to the applet. (If you really insist to make a very similar UI)
On the servlet convert your chart to image, and store it in session. Later on, in your JSP, get the image from the session. check this link for the details. But this one won't exactly the same as option no 3.
I have a flex-application deployed on tomcat with blazeds. User constantly selects ranges excel-document. Now, a user enters a cell addresses in text fields (for example, C1: C20). But it is very inconvenient! How to display excel-data as a table in my application? I think, I can parse excel-document using Apach POI and transmit these data to the Flex-application. But there are other ways?
Generally, Adobe Flex doesn't provide direct way to bring the Microsoft Excel data into a Flex component and if you try to implement Excel system with DataGrid component, you will found a great pain.
I googled around and found a component that might solve your problem, flexuscalculus or Flex spreadsheet.
Hope they can help you. :)
i think you should use a java library for example http://jexcelapi.sourceforge.net/ to parse the excel file in the server side and then return a collection of objects to the flex client in order to render the data into a datagrid for example...
I'm looking for suggestions on the easiest way to create charts and have them printed out as PDFs. This has to be done in Java.
I was looking at something like: http://jcckit.sourceforge.net/index.html
But I don't see how to turn those charts into PDFs.
Any ideas?
Ireport is what you are looking for
If you want to control this process from Java, then you could use JFreeChart and Docmosis together to produce PDF reports that contain charts you generate on the fly. Otherwise you could look at something like Yellowfin to perform higher level reporting controlled and administered via a browser.
I am looking for a Java or Python library that can render graphs in the Dot language as image file. The problem is that I need a library that I can use on Google App Engine. Basically I am looking for a library that can convert the text description of a directed graph into an image of the graph.
For example:
Covert this edge list:
[A,B]
[B,C]
[A,C]
[C,D]
Into this image:
I used Graphviz for this example, but I know it is not possible for me to use it with Google App Engine.
Canviz is what you are looking for: it is a JavaScript library for drawing Graphviz graphs to a web browser canvas. It works with most browsers.
Using Canviz has advantages for your web application over generating and sending bitmapped images and imagemaps to the browser:
The server only needs to have Graphviz generate xdot text; this is faster than generating bitmapped images.
Only the xdot text needs to be transferred to the browser; this is smaller than binary image data, and, if the browser supports it (which most do), the text can be gzip- or bzip2-compressed.
The web browser performs the drawing, not the server; this reduces server load.
The user can resize the graph without needing to involve the server; this is faster than having the server draw and send the graph in a different size.
To see it in action, look here.
Google Charts API now supports GraphViz experimentally. (Note that the entire Image Charts project is officially deprecated.)
You could take a look at the flash based perfuse project if just need to display a graph and not having it embedded as an image is acceptable.
They have some example applications of the library such as this Dependency Graph.
I do not think there is such pure python library, the best you can do is use NetworkX, it can draw using matplotlib or pygraphviz. Maybe you can modify networkx's matplotlib code to draw on server side, here is the code
Another problem is google app engine doesn't have any drawing API, but you may simply use SVG to generate such graphs or may be google charts API have something already there.