Combining the dojox/charting modules with the ArcGIS API for JavaScript provides many ways to display data. One way to deliver feature data through charts is through the map's infoWindow
. The infoWindow uses an HTML template for its content, and that can provide the hooks we need to attach our graphs.
One issue when adding graphs to the infoWindow is determining when to draw the graph. Thankfully, there's an event for that. The map's infoWindow
fires a selection-changed
event whenever the selected feature graphic is changed, either by clicking on another graphic, or by clicking on the next and previous buttons. We can assign an event listener to that event, look at the selected graphic and, if it has the data we need, we can draw the graphs.