Quick start
 
 Dynamic style
 
 Dynamic model
 
 Drill-down
 
 Real time
 
 Ajax
 
 Embedded
 
 
 
 
   Overview         Example         Source       

Using script objects XMLHttpRequest/XMLHTTP can give you a better control over your charts and enhance drill-down capabilities of your application. This example demonstrates how you can use request objects to process an onclick event and replace a chart with another interactive chart using innerHTML. To do so, you will need two files - a file that generates charts and returns chart's HTML upon a request and another that actually displays charts and originates the request.

In our file there are two client-side script functions:

  • makeRequest(url, onComplete) that takes a URL, submits it to the server and invokes onComplete function when the request is completed and,

  • updateHTML(httpRequest, elementId) that updates innerHTML of the element if the request was completed successfully

A typical callback for the chart then looks like:

function onChartAClicked(...) {
  makeRequest('ajaxChart.jsp?...', function(httpRequest) { updateHTML(httpRequest,"chartB")});
}

ajaxChart.jsp file is used to produce HTML based upon the selected element and employs the techniques demonstrated in the previous samples.

 

   Copyright © 1994-2010 GreenPoint, Inc. All rights reserved.