UNPKG

dojox

Version:

Dojo eXtensions, a rollup of many useful sub-projects and varying states of maturity – from very stable and robust, to alpha and experimental. See individual projects contain README files for details.

74 lines (70 loc) 2.82 kB
<!--[if IE 7]> <!DOCTYPE> <html lang="en"> <head> <![endif]--> <!--[if IE 8]> <!DOCTYPE> <html lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/> <![endif]--> <![if gte IE 9]> <!DOCTYPE HTML> <html lang="en"> <head> <![endif]> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Chart 2D</title> <style type="text/css"> @import "../../../dojo/resources/dojo.css"; @import "../../../dijit/tests/css/dijitTests.css"; </style> <!-- required for Tooltip: a default dijit theme: --> <link rel="stylesheet" href="../../../dijit/themes/tundra/tundra.css"> <style> .dojoxLegendNode {border: 1px solid #ccc; margin: 5px 10px 5px 10px; padding: 3px} .dojoxLegendText {vertical-align: text-top; padding-right: 10px} </style> <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true, async: true, parseOnLoad: true"></script> <script type="text/javascript"> var seriesB = [2.6, 1.8, 2, 1, 1.4, 0.7, 2]; var onClick; require([ "dijit/registry", "dijit/form/Button", "dojox/charting/widget/Chart", "dojox/charting/axis2d/Default", "dojox/charting/plot2d/Default", "dojox/charting/widget/Legend", "dojo/parser"], function(registry){ onClick = function(){ var chart = registry.byId("chart1").chart; chart.addSeries("Run B", [6.2, 1.4, 1, 2, 4.1, 6.3, 5]); chart.render(); registry.byId("legend1").refresh(); } }); </script> </head> <body class="tundra"> <h1>Legend</h1> <div data-dojo-type="dojox.charting.widget.Chart" id="chart1" 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="Default" markers="true" markerFill="'red'"></div> <div class="series" name="Run A" data="1, 2, 0.5, 1.5, 1, 2.8, 0.4"></div> </div> <div data-dojo-type="dojox.charting.widget.Legend" chartRef="chart1" id="legend1"></div> <div data-dojo-type="dojox.charting.widget.Chart" id="chart2" 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="Default" markers="true" lines="false" markerFill="'red'"></div> <div class="series" name="Run A" data="1, 2, 0.5, 1.5, 1, 2.8, 0.4"></div> </div> <div data-dojo-type="dojox.charting.widget.Legend" chartRef="chart2"></div> <button data-dojo-type="dijit.form.Button" onclick="onClick()">Click me</button> </body> </html>