NetCharts® Server: Interactive Chart with JSP Tag Library Example
This example shows how to utilize the NetCharts Server JSP Tag Library to add an interactive chart to a web page without the need for coding. The example uses the NetCharts Server JSP Tag Library to add a chart with popup labels onto the page.
See the Source Code.
Note: This is a static image only - no interactivity.

Source Code
<%@ taglib uri="http://www.visualmining.com/taglibs/ncstaglib-1.0" prefix="ncs" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %><!---
InteractiveChart.jsp
Visual Mining, Inc.This example inserts a drillable PNG image of a piechart into the page
The chart comes from a chart template named bannerads.cdx, which is located in
a project called "ToolkitExamples" residing on a NetCharts Server running on
localhost, port 8001.The bannerads.cdx chart template contains two variables, THETITLE and
CLICKDATA used to represent dynamic data in the chart. The chart
displays pop-up labels over the pie slices. Each slice is also a drill
target.The HTML code resulting from executing this tag will contain a IMG tag
for the chart image, a MAP tag for the image map, and some javascript
to implement the mouse roll-over labels.
--->
<html>
<head>
<title>NetCharts Server Custom JSP Tag Example - ncs:chart</title>
</head>
<body><!---
Simulate getting real dynamic data for the chart.
Each reload of the page will present different data.
--->
<%
int click1 = new Double(Math.random()* 100.0).intValue();
int click2 = new Double(Math.random()* 100.0).intValue();
int click3 = new Double(Math.random()* 100.0).intValue();
String clicks = click1 + "," + click2 + "," + click3;
String title = "Banner Ad Click-Throughs\n" +
DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date());
%><ncs:chart project="Examples/ToolkitExamples" chart="bannerads.cdx" server="localhost" port="8001">
<ncs:variable name="THETITLE" value="<%=title%>"/>
<ncs:variable name="CLICKDATA" value="<%=clicks%>"/>
</ncs:chart>
</body>
</html>
![]()



