JavaScript Charts in JSP
Add interactive charts to your application using JSP charts plugin for FusionCharts.
Most of the JSP charting libraries available in the market use server-side code to generate static images of charts and gauges. But why stick to static images when you can have interactive charts? You can use this JSP Charts plugin along with our core library to build interactive graphs and charts for your applications. You can choose from any of the 90+ charts and 1000+ maps and add them to your application using JSP code.
-
A Simple Chart
A simple chart with all data embedded into the directive
-
A 3D Pie Chart
A 3D pie chart using the datasource attribute from scope
-
A Column, Line and Area Combi Chart
A column, line and area combination chart using the datasource attribute
-
Loading data from MySQL Database
Use JSP to get Data from MySQL Database and load data to the chart
-
Fetch data from a JSON URL
Fetch data remotely from a JSON file or URL
-
Fetch data from a XML URL
Fetch data remotely from a XML file or URL
-
Client Side Chart Export
Export the chart in JPG or PDF from client side after rendering
-
Render Angular and Cylinder Gauge
Render Angular and Cylinder Gauge from JSP
-
Render Pyramid and Funnel Charts
Render Pyramid and Funnel Charts
Features
- The server-side JSP wrapper generates the required JavaScript and HTML code as a string, which is then used to render charts on a browser page.
- Allows you to load data from MySQL database into charts.
- Multiple ways to add data - JSON and XML.
- Works seamlessly across PCs (including IE6/7/8), Macs, iPads, iPhones, and Android devices.
Support
Simply open up a github issue with your question/bug report/suggestion.
QuickStart
Step 1: Include FusionCharts libraries
In your HTML, include fusioncharts.js and themes/fusioncharts.theme.ocean.js after all other scripts:
<script type="text/javascript" src="/path/to/fusioncharts.js"></script>
<script type="text/javascript" src="/path/to/themes/fusioncharts.theme.ocean.js"></script>
Step 2: Include FusionCharts JSP wrapper in your page
In the page, import fusioncharts.FusionCharts
Step 3: Render the chart by providing required data in constructor parameter
In your code, find the section where you wish to add the chart and provide data to the FusionCharts constructor.
// Syntax for the constructor - new FusionCharts("type of chart", "unique chart id", "width of chart", "height of chart", "div id to render the chart", "type of data", "actual data")
FusionCharts column2DChart= new FusionCharts(
"column2d",// chartType
"chart1",// chartId
"600", // chartWidth
"400",// chartHeight
"chart",// chartContainer
"json",// dataFormat
"{\"chart\": {\"caption\": \"Harry\'s SuperMart\",\"subCaption\": \"Top 5 stores in last month by revenue\",\"numberPrefix\": \"$\",\"theme\": \"ocean\"},\"data\": [{\"label\": \"Bakersfield Central\",\"value\": \"880000\"}, {\"label\": \"Garden Groove harbour\",\"value\": \"730000\"}, {\"label\": \"Los Angeles Topanga\",\"value\": \"590000\"}, {\"label\": \"Compton-Rancho Dom\",\"value\": \"520000\"}, {\"label\": \"Daly City Serramonte\",\"value\": \"330000\"}]}"
);
Step 4: Render FusionCharts
In the previous code, we are populating the FusionCharts constructor with data and chart properties.
It's time to render it.
// Render the chart
column2DChart.render();
And your chart should display when you load the page.
Licensing
JSP-FusionCharts is open-source and distributed under the terms of the MIT/X11 License. You will still need to download and include FusionCharts in your page. This project provides no direct functionality. You can Download an evaluation. You will still need to purchase a FusionCharts license to use in a commercial environment (FusionCharts is free for non-commercial and personal use) .