Adding Charts to D2 Part 3

In the first two parts, we discussed:

Part 1: Starting with Google charts

Part 2:  Clicking part of the chart calls a query form that tells D2 to list the documents

 

Here, in Part 3, I release the code and discuss a couple implementation options.

The code is on github at:

https://github.com/paulsundquist/d2-widget-core

 

Please branch it, improve it, add comments, and use it in your own projects.

Included in the github are images that you may choose to use for the widgets you create.

There are areas in which the code can be cleaned up, but having it in a single JSP page makes it easy to use.

The configuration might be better as objects in the repository, or eventually D2-Config components, and that may come in the future, but using a properties file is efficient and helps demonstrate the configurability.

In order to run this in eclipse, you can run this in a separate tomcat instance, then point to it from the D2 widget configuration like this:

http://localhost:8080/d2-widget-core/charts/ChartsWithConfig.jsp?DOCBASE=--,USER=...,TICKET=...,CONFIG=...

In future sections about google charts I may address:

  • adding a refresh button
  • adding a drop down value to show
  • better formatting options
  • improving performance
  • Charts with more than 1 value
  • Separating the code from the JSP
  • Cleaning up the configuration

Let me know in the comments if you have any additional thoughts or features.

Advertisements

One thought on “Adding Charts to D2 Part 3”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s