NetCharts® Server: Getting a Dynamic Chart Example
This example shows how to utilize the NetCharts Server Java Toolkit to add an interactive chart to a web page. The example uses the netcharts.server.api.NSWebToolkit class 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
<%@ page import="netcharts.server.api.NSWebToolKit" %>
<%@ page import="java.util.Hashtable" %><html>
<head>
<title>NetCharts Server Java Toolkit Example - getChartAsImageAndMap</title>
</head>
<body>
<p>Create an instance of the <i>NSWebToolKit</i> class.</p>
<%
NSWebToolKit toolKit = new NSWebToolKit("localhost", 8001, "Examples/Suppliers");
// If the JSP page is running with NetCharts Server, use this constructor instead.
// NSToolKit toolKit = new NSToolKit("Examples/Suppliers");// Create the Hashtable to hold the chart request variables.
// (NOTE: If the Hashtable == null, type=PNG is the default)
Hashtable variables = new Hashtable();
variables.put("type","PNG");
%><p>The function <i>getRolloverJavaScript</i> is used to retrieve the JavaScript used to
retrieve the JavaScript used for client-side interactivity.</p>
<%=toolKit.getRolloverJavaScript()%><p>The function <i>getChartAsImageAndMap</i> is used to create the image tag and
imagemap and add it to the page.</p>
<%=toolKit.getChartAsImageAndMap("basicbar.cdx", variables, request, false)%><p>Additional calls to the function <i>getChartAsImageAndMap</i> will add more dynamic
charts to the page.</p></body>
</html>
![]()



