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.

171 lines (161 loc) 7.1 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]> <link rel="stylesheet" href="../../../dijit/themes/tundra/tundra.css"> <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, isDebug: true"></script> <script type="text/javascript"> require(["dojo/ready","dojox/charting/Chart", "dojox/charting/widget/Legend", "dojox/charting/axis2d/Default", "dojox/charting/plot2d/StackedAreas", "dojox/charting/plot2d/StackedLines", "dojox/charting/plot2d/StackedColumns", "dojox/charting/plot2d/StackedBars"], function(ready, Chart, Legend, Default, StackedAreas, StackedLines, StackedColumns, StackedBars){ ready(function(){ // StackedAreas, array of objects var chart1 = new Chart("StackedAreas_objects"); chart1.addAxis("x", {fixLower: "major", fixUpper: "major"}); chart1.addAxis("y", {vertical: true, fixLower: "minor", fixUpper: "minor", natural: true, includeZero: true}); chart1.addPlot("default", {type: StackedAreas, gap: 5}); chart1.addSeries("Series A", [{y:1}, {y:2}, {y:3}, {y:4}, {y:5}], {stroke: {color: "black"}, fill: "red"}); chart1.addSeries("Series B", [{y:5}, {y:4}, {y:3}, {y:2}, {y:1}], {stroke: {color: "black"}, fill: "blue"}); chart1.render(); new Legend({chart: chart1, horizontal: true}, "StackedAreas_objects_l"); // StackedLines, array of objects var chart2 = new Chart("StackedLines_objects"); chart2.addAxis("x", {fixLower: "major", fixUpper: "major"}); chart2.addAxis("y", {vertical: true, fixLower: "minor", fixUpper: "minor", natural: true, includeZero: true}); chart2.addPlot("default", {type: StackedLines, gap: 5}); chart2.addSeries("Series A", [{y:1}, {y:2}, {y:3}, {y:4}, {y:5}], {stroke: {color: "red"}}); chart2.addSeries("Series B", [{y:5}, {y:4}, {y:3}, {y:2}, {y:1}], {stroke: {color: "blue"}}); chart2.render(); new Legend({chart: chart2, horizontal: true}, "StackedLines_objects_l"); // StackedColumns, array of objects var chart3 = new Chart("StackedColumns_objects"); chart3.addAxis("x", {fixLower: "major", fixUpper: "major"}); chart3.addAxis("y", {vertical: true, fixLower: "minor", fixUpper: "minor", natural: true, includeZero: true}); chart3.addPlot("default", {type: StackedColumns, gap: 5}); chart3.addSeries("Series A", [{y:1}, {y:2}, {y:3}, {y:4}, {y:5}], {fill: "red"}); chart3.addSeries("Series B", [{y:5}, {y:4}, {y:3}, {y:2}, {y:1}], {fill: "blue"}); chart3.render(); new Legend({chart: chart3, horizontal: true}, "StackedColumns_objects_l"); // StackedBars, array of objects var chart7 = new Chart("StackedBars_objects"); chart7.addAxis("y", {fixLower: "major", fixUpper: "major", includeZero: true}); chart7.addAxis("x", {vertical: true, fixLower: "minor", fixUpper: "minor", natural: true}); chart7.addPlot("default", {type: StackedBars, gap: 5}); chart7.addSeries("Series A", [{y:1}, {y:2}, {y:3}, {y:4}, {y:5}], {fill: "red"}); chart7.addSeries("Series B", [{y:5}, {y:4}, {y:3}, {y:2}, {y:1}], {fill: "blue"}); chart7.render(); new Legend({chart: chart7, horizontal: true}, "StackedBars_objects_l"); // StackedAreas, array of numbers var chart4 = new Chart("StackedAreas_numbers"); chart4.addAxis("x", {fixLower: "major", fixUpper: "major"}); chart4.addAxis("y", {vertical: true, fixLower: "minor", fixUpper: "minor", natural: true, includeZero: true}); chart4.addPlot("default", {type: StackedAreas, gap: 5}); chart4.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "black"}, fill: "red"}); chart4.addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "black"}, fill: "blue"}); chart4.render(); new Legend({chart: chart4, horizontal: true}, "StackedAreas_numbers_l"); // StackedLines, array of numbers var chart5 = new Chart("StackedLines_numbers"); chart5.addAxis("x", {fixLower: "major", fixUpper: "major"}); chart5.addAxis("y", {vertical: true, fixLower: "minor", fixUpper: "minor", natural: true, includeZero: true}); chart5.addPlot("default", {type: StackedLines, gap: 5}); chart5.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}}); chart5.addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "blue"}}); chart5.render(); new Legend({chart: chart5, horizontal: true}, "StackedLines_numbers_l"); // StackedColumns, array of numbers var chart6 = new Chart("StackedColumns_numbers"); chart6.addAxis("x", {fixLower: "major", fixUpper: "major"}); chart6.addAxis("y", {vertical: true, fixLower: "minor", fixUpper: "minor", natural: true, includeZero: true}); chart6.addPlot("default", {type: StackedColumns, gap: 5}); chart6.addSeries("Series A", [1, 2, 3, 4, 5], {fill: "red"}); chart6.addSeries("Series B", [5, 4, 3, 2, 1], {fill: "blue"}); chart6.render(); new Legend({chart: chart6, horizontal: true}, "StackedColumns_numbers_l"); // StackedBars, array of numbers var chart8 = new Chart("StackedBars_numbers"); chart8.addAxis("y", {fixLower: "major", fixUpper: "major", includeZero: true}); chart8.addAxis("x", {vertical: true, fixLower: "minor", fixUpper: "minor", natural: true}); chart8.addPlot("default", {type: StackedBars, gap: 5}); chart8.addSeries("Series A", [1, 2, 3, 4, 5], {fill: "red"}); chart8.addSeries("Series B", [5, 4, 3, 2, 1], {fill: "blue"}); chart8.render(); new Legend({chart: chart8, horizontal: true}, "StackedBars_numbers_l"); }); }); </script> </head> <body class="tundra"> <table> <tr> <td>StackedAreas, array of objects</td> <td>StackedAreas, array of numbers</td> </tr> <tr> <td> <div id="StackedAreas_objects" style="width: 400px; height: 200px;"></div> <div id="StackedAreas_objects_l"></div> </td> <td> <div id="StackedAreas_numbers" style="width: 400px; height: 200px;"></div> <div id="StackedAreas_numbers_l"></div> </td> </tr> <tr> <td>StackedLines, array of objects</td> <td>StackedLines, array of numbers</td> </tr> <tr> <td> <div id="StackedLines_objects" style="width: 400px; height: 200px;"></div> <div id="StackedLines_objects_l"></div> </td> <td> <div id="StackedLines_numbers" style="width: 400px; height: 200px;"></div> <div id="StackedLines_numbers_l"></div> </td> </tr> <tr> <td>StackedColumns, array of objects</td> <td>StackedColumns, array of numbers</td> </tr> <tr> <td> <div id="StackedColumns_objects" style="width: 400px; height: 200px;"></div> <div id="StackedColumns_objects_l"></div> </td> <td> <div id="StackedColumns_numbers" style="width: 400px; height: 200px;"></div> <div id="StackedColumns_numbers_l"></div> </td> </tr> <tr> <td>StackedBars, array of objects</td> <td>StackedBars, array of numbers</td> </tr> <tr> <td> <div id="StackedBars_objects" style="width: 400px; height: 200px;"></div> <div id="StackedBars_objects_l"></div> </td> <td> <div id="StackedBars_numbers" style="width: 400px; height: 200px;"></div> <div id="StackedBars_numbers_l"></div> </td> </tr> </table> </body> </html>