Table of Contents
package fusioncharts; /** * * @author fusioncharts */import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletResponseAware; import com.opensymphony.xwork2.ActionSupport; public class action extends ActionSupport implements ServletRequestAware, ServletResponseAware{ private static final long serialVersionUID = 1L; private HttpServletRequest request; private HttpServletResponse response; /** * * @return */ public String chartmaker(){ FusionCharts columnChart= new FusionCharts( "column2d",// chartType "chart1",// chartId "550","350",// chartWidth, chartHeight "chart",// chartContainer "json",// dataFormat "{\"chart\": {\"caption\": \"Harry\'s SuperMart - Top 5 Stores' Revenue\", \"subCaption\": \"Last Year\", \"numberPrefix\": \"$\", \"rotatevalues\": \"0\", \"plotToolText\": \"$label\", \"theme\": \"fint\"}, \"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\"}] }" ); return columnChart.render(); } @Override public void setServletRequest(HttpServletRequest request) { this.request = request; } /** * * @param response */ @Override public void setServletResponse(HttpServletResponse response) { this.response = response; } }
Sales : $$value
<%@page import="fusioncharts.action"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="fusioncharts.FusionCharts" %> <!DOCTYPE html> <html> <head> <title>FusionCharts || www.fusioncharts.com</title> <script src="fusioncharts.js"></script> <script src="fusioncharts.charts.js"></script> <script src="fusioncharts.theme.fint.js"></script> </head> <body> <div id="chart"></div> <% action a= new action(); out.println(a.chartmaker()); %> </body> </html>Note : Import the Fusioncharts wrapper in the JSP page and also include the FusionCharts JS library files in the page.
Have you ever spent hours buried in documentation, hunting for a specific piece of code?…
Do you feel like your data is a cryptic puzzle, locked away from revealing its…
In web development, mastering JavaScript charting libraries is crucial for keeping up with the fast-paced…
Ever spend an afternoon neck-deep in documentation, searching for that one elusive code snippet? Or…
In the dynamic world of data visualization, the need for precision and innovation has never…
Are you drowning in data but struggling to find the insights that drive real business…