Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 2149 → Rev 2150

/trunk/api/js/dojo1.0/dojox/charting/tests/test_chart2d.html
New file
0,0 → 1,338
<html>
<head>
<title>Chart 2D</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
@import "../../../dojo/resources/dojo.css";
@import "../../../dijit/tests/css/dijitTests.css";
</style>
<!--
The next line should include Microsoft's Silverligth.js, if you plan to use the silverlight backend
<script type="text/javascript" src="Silverlight.js"></script>
-->
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
<script type="text/javascript" src="../../lang/functional.js"></script>
<script type="text/javascript" src="../../lang/utils.js"></script>
<script type="text/javascript" src="../Theme.js"></script>
<script type="text/javascript" src="../scaler.js"></script>
<script type="text/javascript" src="../Element.js"></script>
<script type="text/javascript" src="../axis2d/common.js"></script>
<script type="text/javascript" src="../axis2d/Base.js"></script>
<script type="text/javascript" src="../axis2d/Default.js"></script>
<script type="text/javascript" src="../plot2d/common.js"></script>
<script type="text/javascript" src="../plot2d/Base.js"></script>
<script type="text/javascript" src="../plot2d/Default.js"></script>
<script type="text/javascript" src="../plot2d/Lines.js"></script>
<script type="text/javascript" src="../plot2d/Areas.js"></script>
<script type="text/javascript" src="../plot2d/Markers.js"></script>
<script type="text/javascript" src="../plot2d/MarkersOnly.js"></script>
<script type="text/javascript" src="../plot2d/Scatter.js"></script>
<script type="text/javascript" src="../plot2d/Stacked.js"></script>
<script type="text/javascript" src="../plot2d/StackedLines.js"></script>
<script type="text/javascript" src="../plot2d/StackedAreas.js"></script>
<script type="text/javascript" src="../plot2d/Columns.js"></script>
<script type="text/javascript" src="../plot2d/StackedColumns.js"></script>
<script type="text/javascript" src="../plot2d/ClusteredColumns.js"></script>
<script type="text/javascript" src="../plot2d/Bars.js"></script>
<script type="text/javascript" src="../plot2d/StackedBars.js"></script>
<script type="text/javascript" src="../plot2d/ClusteredBars.js"></script>
<script type="text/javascript" src="../plot2d/Grid.js"></script>
<script type="text/javascript" src="../plot2d/Pie.js"></script>
<script type="text/javascript" src="../Chart2D.js"></script>
<script type="text/javascript">
 
dojo.require("dojox.charting.Chart2D");
dojo.require("dojox.charting.themes.PlotKit.blue");
dojo.require("dojox.charting.themes.PlotKit.cyan");
dojo.require("dojox.charting.themes.PlotKit.green");
dojo.require("dojox.charting.themes.PlotKit.orange");
dojo.require("dojox.charting.themes.PlotKit.purple");
dojo.require("dojox.charting.themes.PlotKit.red");
 
makeObjects = function(){
var chart1 = new dojox.charting.Chart2D("test1");
chart1.addSeries("Series A", [1, 2, 1, 2, 1, 2, 1]);
chart1.addSeries("Series B", [2, 1, 2, 1, 2, 1, 2]);
chart1.render();
 
var chart2 = new dojox.charting.Chart2D("test2");
chart2.addSeries("Series A", [1, 2, 1, 2, 1, 2, 1], {stroke: "red"});
chart2.addSeries("Series B", [2, 1, 2, 1, 2, 1, 2], {stroke: "blue"});
chart2.render();
 
var chart3 = new dojox.charting.Chart2D("test3");
chart3.addPlot("default", {type: "Areas"});
chart3.setTheme(dojox.charting.themes.PlotKit.orange);
chart3.addSeries("Series A", [1, 2, 0.5, 1.5, 1, 2.8, 0.4]);
chart3.addSeries("Series B", [2.6, 1.8, 2, 1, 1.4, 0.7, 2]);
chart3.addSeries("Series C", [6.3, 1.8, 3, 0.5, 4.4, 2.7, 2]);
chart3.render();
 
var chart4 = new dojox.charting.Chart2D("test4");
chart4.addPlot("default", {type: "Areas"});
chart4.addSeries("Series A", [1, 2, 1, 2, 1, 2, 1], {stroke: {color: "red", width: 2}, fill: "lightpink"});
chart4.addSeries("Series B", [2, 1, 2, 1, 2, 1, 2], {stroke: {color: "blue", width: 2}, fill: "lightblue"});
chart4.render();
 
var chart5 = new dojox.charting.Chart2D("test5");
chart5.setTheme(dojox.charting.themes.PlotKit.blue);
chart5.addAxis("x");
chart5.addAxis("y", {vertical: true});
chart5.addSeries("Series A", [1, 2, 1, 2, 1, 2, 1]);
chart5.addSeries("Series B", [2, 1, 2, 1, 2, 1, 2]);
chart5.render();
 
var chart6 = new dojox.charting.Chart2D("test6");
chart6.setTheme(dojox.charting.themes.PlotKit.cyan);
chart6.addAxis("x", {fixLower: "minor", fixUpper: "minor"});
chart6.addAxis("y", {vertical: true, fixLower: "minor", fixUpper: "minor"});
chart6.addSeries("Series A", [1, 2, 1, 2, 1, 2, 1]);
chart6.addSeries("Series B", [2, 1, 2, 1, 2, 1, 2]);
chart6.render();
 
var chart7 = new dojox.charting.Chart2D("test7");
chart7.setTheme(dojox.charting.themes.PlotKit.green);
chart7.addAxis("x", {fixLower: "major", fixUpper: "major"});
chart7.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major"});
chart7.addSeries("Series A", [1, 2, 1, 2, 1, 2, 1]);
chart7.addSeries("Series B", [2, 1, 2, 1, 2, 1, 2]);
chart7.render();
 
var chart8 = new dojox.charting.Chart2D("test8");
chart8.setTheme(dojox.charting.themes.PlotKit.purple);
chart8.addPlot("default", {type: "Markers"});
chart8.addSeries("Series A", [1, 2, 1, 2, 1, 2, 1], {min: 0, max: 3});
chart8.addSeries("Series B", [2, 1, 2, 1, 2, 1, 2]);
chart8.render();
 
var chart9 = new dojox.charting.Chart2D("test9");
chart9.addPlot("default", {type: "MarkersOnly"});
chart9.addSeries("Series A", [1, 2, 1, 2, 1, 2, 1], {min: 0, max: 3, stroke: {color: "red", width: 2}, marker: "m-3,0 c0,-4 6,-4 6,0 m-6,0 c0,4 6,4 6,0"});
chart9.addSeries("Series B", [2, 1, 2, 1, 2, 1, 2], {stroke: {color: "blue", width: 2}, marker: "m-3,-3 l0,6 6,0 0,-6 z"});
chart9.render();
 
var chart10 = new dojox.charting.Chart2D("test10");
chart10.addPlot("default", {type: "Markers", shadows: {dx: 2, dy: 2, dw: 2}});
chart10.addSeries("Series A", [1, 2, 1, 2, 1, 2, 1], {min: 0, max: 3, stroke: {color: "red", width: 2, join: "round"}, marker: "m-3,0 c0,-4 6,-4 6,0 m-6,0 c0,4 6,4 6,0"});
chart10.addSeries("Series B", [2, 1, 2, 1, 2, 1, 2], {stroke: {color: "blue", width: 2, join: "round"}, marker: "m-3,-3 l0,6 6,0 0,-6 z"});
chart10.render();
 
var chart11 = new dojox.charting.Chart2D("test11");
chart11.addPlot("default", {type: "StackedLines", markers: true, shadows: {dx: 2, dy: 2, dw: 2}});
chart11.addSeries("Series A", [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6], {stroke: {color: "red", width: 2}, fill: "lightpink", marker: "m-3,-3 l0,6 6,0 0,-6 z"});
chart11.addSeries("Series B", [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6], {stroke: {color: "blue", width: 2}, fill: "lightblue", marker: "m-3,0 c0,-4 6,-4 6,0 m-6,0 c0,4 6,4 6,0"});
chart11.addSeries("Series C", [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6], {stroke: {color: "green", width: 2}, fill: "lightgreen", marker: "m0,-3 l3,3 -3,3 -3,-3 z"});
chart11.render();
 
var chart12 = new dojox.charting.Chart2D("test12");
chart12.addAxis("x", {fixLower: "major", fixUpper: "major"});
chart12.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major"});
chart12.addPlot("default", {type: "StackedAreas"});
chart12.addSeries("Series A", [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6], {stroke: {color: "red", width: 2}, fill: "lightpink"});
chart12.addSeries("Series B", [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6], {stroke: {color: "blue", width: 2}, fill: "lightblue"});
chart12.addSeries("Series C", [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6], {stroke: {color: "green", width: 2}, fill: "lightgreen"});
chart12.render();
 
var chart13 = new dojox.charting.Chart2D("test13");
chart13.addPlot("default", {type: "Columns"});
chart13.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"});
chart13.addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "blue"}, fill: "lightblue"});
chart13.render();
 
var chart14 = new dojox.charting.Chart2D("test14");
chart14.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major"});
chart14.addPlot("default", {type: "Columns", gap: 2});
chart14.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"});
chart14.addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "blue"}, fill: "lightblue"});
chart14.render();
 
var chart15 = new dojox.charting.Chart2D("test15");
chart15.addPlot("default", {type: "StackedColumns"});
chart15.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"});
chart15.addSeries("Series B", [2, 1, 2, 1, 2], {stroke: {color: "blue"}, fill: "lightblue"});
chart15.render();
 
var chart16 = new dojox.charting.Chart2D("test16");
chart16.addAxis("x", {fixLower: "major", fixUpper: "major", includeZero: true});
chart16.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major", natural: true});
chart16.addPlot("default", {type: "Bars"});
chart16.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"});
chart16.addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "blue"}, fill: "lightblue"});
chart16.render();
 
var chart17 = new dojox.charting.Chart2D("test17");
chart17.addPlot("default", {type: "StackedBars"});
chart17.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"});
chart17.addSeries("Series B", [2, 1, 2, 1, 2], {stroke: {color: "blue"}, fill: "lightblue"});
chart17.render();
 
var chart18 = new dojox.charting.Chart2D("test18");
chart18.addAxis("x", {fixLower: "minor", fixUpper: "minor", natural: true});
chart18.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major", includeZero: true});
chart18.addPlot("default", {type: "ClusteredColumns", gap: 2});
chart18.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"});
chart18.addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "blue"}, fill: "lightblue"});
chart18.render();
 
var chart19 = new dojox.charting.Chart2D("test19");
chart19.addAxis("x", {fixLower: "major", fixUpper: "major", includeZero: true});
chart19.addAxis("y", {vertical: true, fixLower: "minor", fixUpper: "minor", natural: true});
chart19.addPlot("default", {type: "ClusteredBars", gap: 2});
chart19.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"});
chart19.addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "blue"}, fill: "lightblue"});
chart19.render();
 
var chart20 = new dojox.charting.Chart2D("test20");
chart20.addAxis("x", {fixLower: "minor", fixUpper: "minor", natural: true});
chart20.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major", minorTicks: false, includeZero: true});
chart20.addPlot("front_grid", {type: "Grid", hMajorLines: true, vMajorLines: false});
chart20.addPlot("default", {type: "Columns", gap: 2});
chart20.addPlot("back_grid", {type: "Grid", hMajorLines: false, vMajorLines: true});
chart20.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"});
chart20.addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "blue"}, fill: "lightblue"});
chart20.render();
 
var chart21 = new dojox.charting.Chart2D("test21");
chart21.addAxis("x", {fixLower: "minor", fixUpper: "minor", natural: true});
chart21.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major",
includeZero: true, min: 0, max: 8, minorLabels: false,
majorTicks: true, minorTicks: true, microTicks: false,
majorTickStep: 2, minorTickStep: 1, microTickStep: 0.5});
chart21.addPlot("front_grid", {type: "Grid", hMajorLines: true, vMajorLines: false});
chart21.addPlot("default", {type: "Columns", gap: 2});
chart21.addPlot("back_grid", {type: "Grid", hMajorLines: false, vMajorLines: true});
chart21.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"});
chart21.addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "blue"}, fill: "lightblue"});
chart21.render();
 
var chart22 = new dojox.charting.Chart2D("test22");
chart22.addAxis("x");
chart22.addAxis("y", {vertical: true});
chart22.addPlot("default", {type: "Columns", gap: 2});
chart22.addPlot("grid", {type: "Grid"});
chart22.addSeries("Series A", [2, 1, 0.5, -1, -2], {stroke: {color: "red"}, fill: "lightpink"});
chart22.addSeries("Series B", [-2, -1, -0.5, 1, 2], {stroke: {color: "blue"}, fill: "lightblue"});
chart22.render();
 
var chart23 = new dojox.charting.Chart2D("test23");
chart23.addAxis("x");
chart23.addAxis("y", {vertical: true});
chart23.addPlot("default", {type: "ClusteredColumns", gap: 2});
chart23.addPlot("grid", {type: "Grid"});
chart23.addSeries("Series A", [2, 1, 0.5, -1, -2], {stroke: {color: "red"}, fill: "lightpink"});
chart23.addSeries("Series B", [-2, -1, -0.5, 1, 2], {stroke: {color: "blue"}, fill: "lightblue"});
chart23.addSeries("Series C", [1, 0.5, -1, -2, -3], {stroke: {color: "green"}, fill: "lightgreen"});
chart23.render();
 
var chart24 = new dojox.charting.Chart2D("test24");
chart24.addAxis("x");
chart24.addAxis("y", {vertical: true});
chart24.addPlot("default", {type: "Bars", gap: 2});
chart24.addPlot("grid", {type: "Grid"});
chart24.addSeries("Series A", [2, 1, 0.5, -1, -2], {stroke: {color: "red"}, fill: "lightpink"});
chart24.addSeries("Series B", [-2, -1, -0.5, 1, 2], {stroke: {color: "blue"}, fill: "lightblue"});
chart24.render();
 
var chart25 = new dojox.charting.Chart2D("test25");
chart25.addAxis("x");
chart25.addAxis("y", {vertical: true});
chart25.addPlot("default", {type: "ClusteredBars", gap: 2});
chart25.addPlot("grid", {type: "Grid"});
chart25.addSeries("Series A", [2, 1, 0.5, -1, -2], {stroke: {color: "red"}, fill: "lightpink"});
chart25.addSeries("Series B", [-2, -1, -0.5, 1, 2], {stroke: {color: "blue"}, fill: "lightblue"});
chart25.addSeries("Series C", [1, 0.5, -1, -2, -3], {stroke: {color: "green"}, fill: "lightgreen"});
chart25.render();
 
var chart26 = new dojox.charting.Chart2D("test26");
chart26.setTheme(dojox.charting.themes.PlotKit.red);
chart26.addAxis("x", {min: 0, max: 6, majorTick: {stroke: "black", length: 3}, minorTick: {stroke: "gray", length: 3}});
chart26.addAxis("y", {vertical: true, min: 0, max: 10, majorTick: {stroke: "black", length: 3}, minorTick: {stroke: "gray", length: 3}});
chart26.addSeries("Series A", [{x: 0.5, y: 5}, {x: 1.5, y: 1.5}, {x: 2, y: 9}, {x: 5, y: 0.3}]);
chart26.addSeries("Series B", [{x: 0.3, y: 8}, {x: 4, y: 6}, {x: 5.5, y: 2}]);
chart26.render();
 
var chart27 = new dojox.charting.Chart2D("test27");
chart27.setTheme(dojox.charting.themes.PlotKit.purple);
chart27.addPlot("default", {type: "Scatter"});
chart27.addAxis("x", {min: 0, max: 6, majorTick: {stroke: "black", length: 3}, minorTick: {stroke: "gray", length: 3}});
chart27.addAxis("y", {vertical: true, min: 0, max: 10, majorTick: {stroke: "black", length: 3}, minorTick: {stroke: "gray", length: 3}});
chart27.addSeries("Series A", [{x: 0.5, y: 5}, {x: 1.5, y: 1.5}, {x: 2, y: 9}, {x: 5, y: 0.3}]);
chart27.addSeries("Series B", [{x: 0.3, y: 8}, {x: 4, y: 6}, {x: 5.5, y: 2}]);
chart27.render();
 
var chart28 = new dojox.charting.Chart2D("test28");
chart28.setTheme(dojox.charting.themes.PlotKit.blue);
chart28.addPlot("default", {type: "Default", lines: true, markers: true});
chart28.addAxis("x", {min: 0, max: 6, majorTick: {stroke: "black", length: 3}, minorTick: {stroke: "gray", length: 3}});
chart28.addAxis("y", {vertical: true, min: 0, max: 10, majorTick: {stroke: "black", length: 3}, minorTick: {stroke: "gray", length: 3}});
chart28.addSeries("Series A", [{x: 0.5, y: 5}, {x: 1.5, y: 1.5}, {x: 2, y: 9}, {x: 5, y: 0.3}]);
chart28.addSeries("Series B", [{x: 0.3, y: 8}, {x: 4, y: 6}, {x: 5.5, y: 2}]);
chart28.render();
};
 
dojo.addOnLoad(makeObjects);
 
</script>
</head>
<body>
<h1>Chart 2D</h1>
<!--<p><button onclick="makeObjects();">Go</button></p>-->
<p>1: Defaults: lines, no axes.</p>
<div id="test1" style="width: 400px; height: 400px;"></div>
<p>2: Defaults: lines, no axes, and custom strokes.</p>
<div id="test2" style="width: 400px; height: 400px;"></div>
<p>3: Areas, orange theme, no axes.</p>
<div id="test3" style="width: 400px; height: 400px;"></div>
<p>4: Areas, no axes, custom strokes and fills.</p>
<div id="test4" style="width: 400px; height: 400px;"></div>
<p>5: Lines, axes, blue theme.</p>
<div id="test5" style="width: 400px; height: 400px;"></div>
<p>6: Lines, axes (aligned on minor ticks), cyan theme.</p>
<div id="test6" style="width: 400px; height: 400px;"></div>
<p>7: Lines, axes (aligned on major ticks), green theme.</p>
<div id="test7" style="width: 400px; height: 400px;"></div>
<p>8: Lines and markers, no axes, purple theme, custom min/max.</p>
<div id="test8" style="width: 200px; height: 200px;"></div>
<p>9: Markers only, no axes, custom theme, custom markers, custom min/max.</p>
<div id="test9" style="width: 200px; height: 200px;"></div>
<p>10: Lines and markers, shadows, no axes, custom theme, custom markers, custom min/max.</p>
<div id="test10" style="width: 200px; height: 200px;"></div>
<p>11: Stacked lines, markers, shadows, no axes, custom strokes, fills, and markers.</p>
<div id="test11" style="width: 200px; height: 200px;"></div>
<p>12: Stacked areas, axes (aligned on major ticks), custom strokes and fills.</p>
<div id="test12" style="width: 200px; height: 200px;"></div>
<p>13: Columns, no axes, custom strokes and fills.</p>
<div id="test13" style="width: 200px; height: 200px;"></div>
<p>14: Columns with gaps beetwen them, vertical axis aligned on major ticks, custom strokes, fills.</p>
<div id="test14" style="width: 200px; height: 200px;"></div>
<p>15: Stacked columns, no axes, custom strokes and fills.</p>
<div id="test15" style="width: 200px; height: 200px;"></div>
<p>16: Bars, axes aligned on major ticks, no minor ticks, custom strokes and fills.</p>
<div id="test16" style="width: 200px; height: 200px;"></div>
<p>17: Stacked bars, no axes, custom strokes and fills.</p>
<div id="test17" style="width: 200px; height: 200px;"></div>
<p>18: Clustered columns, custom axes, custom strokes, fills, and gap.</p>
<div id="test18" style="width: 200px; height: 200px;"></div>
<p>19: Clustered bars, custom axes, custom strokes, fills, and gap.</p>
<div id="test19" style="width: 200px; height: 200px;"></div>
<p>20: Columns with gaps beetwen them, grids, custom strokes, fills, axes.</p>
<div id="test20" style="width: 200px; height: 200px;"></div>
<p>21: Columns with gaps beetwen them, grids, custom strokes, fills, axes, with min=0, max=8, and manually specified ticks on the vertical axis.</p>
<div id="test21" style="width: 200px; height: 200px;"></div>
<p>22: Columns with positive and negative values, axes, and grid.</p>
<div id="test22" style="width: 200px; height: 200px;"></div>
<p>23: Clustered columns with positive and negative values, axes, and grid.</p>
<div id="test23" style="width: 200px; height: 200px;"></div>
<p>24: Bars with positive and negative values, axes, and grid.</p>
<div id="test24" style="width: 200px; height: 200px;"></div>
<p>25: Clustered bars with positive and negative values, axes, and grid.</p>
<div id="test25" style="width: 200px; height: 200px;"></div>
<p>26: Default lines with 2D data, custom axis, red theme.</p>
<div id="test26" style="width: 200px; height: 200px;"></div>
<p>27: Scatter chart, custom axis, purple theme.</p>
<div id="test27" style="width: 200px; height: 200px;"></div>
<p>28: Markers, lines, 2D data, custom axis, blue theme.</p>
<div id="test28" style="width: 200px; height: 200px;"></div>
<p>That's all Folks!</p>
</body>
</html>