In the first two parts, we discussed:
Here, in Part 3, I release the code and discuss a couple implementation options.
The code is on github at:
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:
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.