Chris Mitchell of IBM had a few days of free time prior to the Dojo 1.0 release, and so he added Canvas support for dojox.gfx. While Canvas does not offer all of the DOM goodness of SVG, it does have one key features: it works today on the iPhone. While we expect the iPhone’s version of Safari to be updated to support SVG for vector graphics and charting very soon, it allows us to draw and chart natively on the iPhone now:

To include a chart in your Dojo app, first require the following modules:

<script type="text/javascript">
	seriesB = [2.6, 1.8, 2, 1, 1.4, 0.7, 2];

And then in your HTML body, include a widget with the right parameters:

<div dojoType="dojox.charting.widget.Chart2D" 
    style="width: 300px; height: 300px;">
  <div class="axis" name="x" 
    font="italic normal normal 8pt Tahoma"></div>
  <div class="axis" name="y" vertical="true" 
    fixUpper="major" includeZero="true" 
    font="italic normal normal 8pt Tahoma"></div>
  <div class="plot" name="default" type="Areas"></div>
  <div class="plot" name="grid" type="Grid"></div>
  <div class="series" name="Series A" 
     data="1, 2, 0.5, 1.5, 1, 2.8, 0.4"></div>
  <div class="series" name="Series B" array="seriesB"></div>
  <div class="series" name="Series C" 
    store="tableStore" valueFn="Number(x)"></div>

dojox.gfx now includes support for SVG, VML, Canvas, and Silverlight through one simple, SVG-inspired 2-D and 3-D drawing API!