Skip to content

Instantly share code, notes, and snippets.

@trazyn
Last active December 7, 2018 12:20
Show Gist options
  • Save trazyn/8080847 to your computer and use it in GitHub Desktop.
Save trazyn/8080847 to your computer and use it in GitHub Desktop.
// Require the basic 2d chart resource: Chart2D
dojo.require( "dojox.charting.Chart2D" );
 
// Retrieve the Legend, Tooltip, and Magnify classes
dojo.require( "dojox.charting.widget.Legend" );
dojo.require( "dojox.charting.action2d.Tooltip" );
dojo.require( "dojox.charting.action2d.Magnify" );
 
dojo.require( "dojox.charting.themes.Claro" );
 
// When the DOM is ready and resources are loaded...
dojo.ready( function() {
 
var chart = new dojox.charting.Chart2D( "testNode" )
, labels = [];
//labels.push( { value: 1, text: "Asia" } );
//labels.push( { value: 2, text: "Europe" } );
//labels.push( { value: 3, text: "Africa" } );
labels.push( { value: 1, text: null } );
labels.push( { value: 2, text: "Jan" } );
labels.push( { value: 3, text: "Feb" } );
labels.push( { value: 4, text: "Mar" } );
labels.push( { value: 5, text: "Apr" } );
labels.push( { value: 6, text: "May" } );
labels.push( { value: 7, text: "Jun" } );
labels.push( { value: 8, text: "Jul" } );
labels.push( { value: 9, text: null } );
chart
.addPlot( "default", { type: "Lines", markers: true } )
.addAxis( "x", { labels: labels } )
.addAxis( "y", {
vertical: true,
fixLower: "major",
fixUpper: "major",
title: "Test",
min: 0
} )
.setTheme( dojox.charting.themes.Claro )
.addSeries( "Series A", [1, 2, 0.5, 1.5, 1, 2.8, 0.4] )
.addSeries( "Series B", [2.6, 1.8, 2, 1, 1.4, 0.7, 2] )
.addSeries( "Series C", [6.3, 1.8, 3, 0.5, 4.4, 2.7, 2] )
new dojox.charting.action2d.Tooltip( chart, "default" );
new dojox.charting.action2d.Magnify( chart, "default" );
/** Show the chart */
chart.render();
/** Show the bottom */
new dojox.charting.widget.Legend( { chart: chart }, "legend" );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment