| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
<![if gte IE 9]> |
| 13 |
<!DOCTYPE HTML> |
| 14 |
<html lang="en"> |
| 15 |
<head> |
| 16 |
<![endif]> |
| 17 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 18 |
<title>Event 2D</title> |
| 19 |
<style type="text/css"> |
| 20 |
@import "../../../dojo/resources/dojo.css"; |
| 21 |
@import "../../../dijit/tests/css/dijitTests.css"; |
| 22 |
</style> |
| 23 |
|
| 24 |
<link rel="stylesheet" href="../../../dijit/themes/claro/claro.css"> |
| 25 |
<style> |
| 26 |
.dojoxLegendNode {border: 1px solid #ccc; margin: 5px 10px 5px 10px; padding: 3px} |
| 27 |
.dojoxLegendText {vertical-align: text-top; padding-right: 10px} |
| 28 |
</style> |
| 29 |
<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script> |
| 30 |
<script type="text/javascript"> |
| 31 |
|
| 32 |
dojo.require("dojox.charting.Chart"); |
| 33 |
dojo.require("dojox.charting.axis2d.Default"); |
| 34 |
dojo.require("dojox.charting.plot2d.Default"); |
| 35 |
dojo.require("dojox.charting.plot2d.StackedLines"); |
| 36 |
dojo.require("dojox.charting.plot2d.Columns"); |
| 37 |
dojo.require("dojox.charting.plot2d.ClusteredColumns"); |
| 38 |
dojo.require("dojox.charting.plot2d.StackedColumns"); |
| 39 |
dojo.require("dojox.charting.plot2d.Bars"); |
| 40 |
dojo.require("dojox.charting.plot2d.ClusteredBars"); |
| 41 |
dojo.require("dojox.charting.plot2d.StackedBars"); |
| 42 |
dojo.require("dojox.charting.plot2d.Bubble"); |
| 43 |
dojo.require("dojox.charting.plot2d.Grid"); |
| 44 |
dojo.require("dojox.charting.plot2d.Pie"); |
| 45 |
|
| 46 |
dojo.require("dojox.charting.themes.PlotKit.green"); |
| 47 |
|
| 48 |
dojo.require("dojox.charting.action2d.Highlight"); |
| 49 |
dojo.require("dojox.charting.action2d.Magnify"); |
| 50 |
dojo.require("dojox.charting.action2d.MoveSlice"); |
| 51 |
dojo.require("dojox.charting.action2d.Shake"); |
| 52 |
dojo.require("dojox.charting.action2d.Tooltip"); |
| 53 |
|
| 54 |
dojo.require("dojox.charting.widget.Legend"); |
| 55 |
|
| 56 |
dojo.require("dojo.colors"); |
| 57 |
dojo.require("dojo.fx.easing"); |
| 58 |
|
| 59 |
var dc = dojox.charting; |
| 60 |
|
| 61 |
var dur = 450; |
| 62 |
|
| 63 |
makeObjects = function(){ |
| 64 |
var chart1 = new dc.Chart("test1"); |
| 65 |
chart1.setTheme(dc.themes.PlotKit.green); |
| 66 |
chart1.addPlot("default", {type: "Default", lines: true, markers: true, tension:2}); |
| 67 |
chart1.addAxis("x", {min: 0, max: 6, majorTick: {stroke: "black", length: 3}, minorTick: {stroke: "gray", length: 3}}); |
| 68 |
chart1.addAxis("y", {vertical: true, min: 0, max: 10, majorTick: {stroke: "black", length: 3}, minorTick: {stroke: "gray", length: 3}}); |
| 69 |
chart1.addSeries("Series A", [{x: 0.5, y: 5}, {x: 1.5, y: 1.5}, {x: 2, y: 9}, {x: 5, y: 0.3}]); |
| 70 |
chart1.addSeries("Series B", [{x: 0.3, y: 8}, {x: 4, y: 6, tooltip: "Custom tooltip"}, {x: 5.5, y: 2}]); |
| 71 |
var anim1a = new dc.action2d.Magnify(chart1, "default"); |
| 72 |
var anim1b = new dc.action2d.Tooltip(chart1, "default"); |
| 73 |
chart1.render(); |
| 74 |
var legend1 = new dojox.charting.widget.Legend({chart: chart1, horizontal: false}, "legend1"); |
| 75 |
|
| 76 |
var chart2 = new dc.Chart("test2"); |
| 77 |
chart2.setTheme(dc.themes.PlotKit.green); |
| 78 |
chart2.addPlot("default", {type: "StackedLines", markers: true, tension:3, shadows: {dx: 2, dy: 2, dw: 2}}); |
| 79 |
chart2.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"}); |
| 80 |
chart2.addSeries("Series B", [1, 1.6, 1.3, 1.4, 1.1, 1.5, 1.1], {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"}); |
| 81 |
chart2.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"}); |
| 82 |
var anim2a = new dc.action2d.Magnify(chart2, "default", { |
| 83 |
scale: 3 |
| 84 |
}); |
| 85 |
var anim2b = new dc.action2d.Highlight(chart2, "default"); |
| 86 |
chart2.render(); |
| 87 |
var legend2 = new dojox.charting.widget.Legend({chart: chart2}, "legend2"); |
| 88 |
|
| 89 |
var chart3 = new dc.Chart("test3"); |
| 90 |
chart3.setTheme(dc.themes.PlotKit.green); |
| 91 |
chart3.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major"}); |
| 92 |
chart3.addPlot("default", {type: "Columns", gap: 2}); |
| 93 |
chart3.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "black"}, fill: "red"}); |
| 94 |
chart3.addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "black"}, fill: "blue"}); |
| 95 |
var anim3a = new dc.action2d.Highlight(chart3, "default"); |
| 96 |
var anim3b = new dc.action2d.Tooltip(chart3, "default"); |
| 97 |
chart3.render(); |
| 98 |
var legend3 = new dojox.charting.widget.Legend({chart: chart3, horizontal: false}, "legend3"); |
| 99 |
|
| 100 |
var chart4 = new dc.Chart("test4"); |
| 101 |
chart4.setTheme(dc.themes.PlotKit.green); |
| 102 |
chart4.addAxis("x", {fixLower: "major", fixUpper: "major", includeZero: true}); |
| 103 |
chart4.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major", natural: true}); |
| 104 |
chart4.addPlot("default", {type: "Bars"}); |
| 105 |
chart4.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "black"}, fill: "red"}); |
| 106 |
chart4.addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "black"}, fill: "blue"}); |
| 107 |
var anim4a = new dc.action2d.Highlight(chart4, "default", { |
| 108 |
highlight: "gold" |
| 109 |
}); |
| 110 |
var anim4b = new dc.action2d.Tooltip(chart4, "default"); |
| 111 |
chart4.render(); |
| 112 |
var legend4 = new dojox.charting.widget.Legend({chart: chart4}, "legend4"); |
| 113 |
|
| 114 |
var chart5 = new dc.Chart("test5"); |
| 115 |
chart5.setTheme(dc.themes.PlotKit.green); |
| 116 |
chart5.addAxis("x", {fixLower: "major", fixUpper: "major", includeZero: true}); |
| 117 |
chart5.addAxis("y", {vertical: true, fixLower: "minor", fixUpper: "minor", natural: true}); |
| 118 |
chart5.addPlot("default", {type: "ClusteredBars", gap: 5}); |
| 119 |
chart5.addSeries("Series A", [{y: 1, tooltip: "one/custom yellow", fill: "yellow"}, {y: 2}, {y: 3, tooltip: "three"}, {y: 4}, {y: 5, tooltip: "five"}], {stroke: {color: "black"}, fill: "red"}); |
| 120 |
chart5.addSeries("Series B", [{y: 5}, {y: 4, tooltip: "four"}, {y: 3, fill: "black", stroke: {width: 2, color: "#f80"}, tooltip: "custom black"}, {y: 2, tooltip: "two"}, {y: 1}], {stroke: {color: "black"}, fill: "blue"}); |
| 121 |
var anim5a = new dc.action2d.Highlight(chart5, "default", { |
| 122 |
duration: dur, |
| 123 |
easing: dojo.fx.easing.bounceOut |
| 124 |
}); |
| 125 |
var anim5b = new dc.action2d.Tooltip(chart5, "default"); |
| 126 |
chart5.render(); |
| 127 |
var legend5 = new dojox.charting.widget.Legend({chart: chart5, horizontal: false}, "legend5"); |
| 128 |
|
| 129 |
var chart6 = new dc.Chart("test6"); |
| 130 |
chart6.setTheme(dc.themes.PlotKit.green); |
| 131 |
chart6.addAxis("x"); |
| 132 |
chart6.addAxis("y", {vertical: true}); |
| 133 |
chart6.addPlot("default", {type: "ClusteredColumns", gap: 10}); |
| 134 |
chart6.addPlot("grid", {type: "Grid"}); |
| 135 |
chart6.addSeries("Series A", [2, 1, 0.5, -1, -2], {stroke: {color: "black"}, fill: "red"}); |
| 136 |
chart6.addSeries("Series B", [-2, -1, -0.5, 1, 2], {stroke: {color: "black"}, fill: "blue"}); |
| 137 |
chart6.addSeries("Series C", [1, 0.5, -1, -2, -3], {stroke: {color: "black"}, fill: "green"}); |
| 138 |
var anim6a = new dc.action2d.Highlight(chart6, "default", { |
| 139 |
duration: dur, |
| 140 |
easing: dojo.fx.easing.sineOut |
| 141 |
}); |
| 142 |
var anim6b = new dc.action2d.Shake(chart6, "default"); |
| 143 |
var anim6c = new dc.action2d.Tooltip(chart6, "default"); |
| 144 |
chart6.render(); |
| 145 |
var legend6 = new dojox.charting.widget.Legend({chart: chart6}, "legend6"); |
| 146 |
|
| 147 |
var chart7 = new dc.Chart("test7"); |
| 148 |
chart7.setTheme(dc.themes.PlotKit.green); |
| 149 |
chart7.addPlot("default", {type: "StackedColumns"}); |
| 150 |
chart7.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "black"}, fill: "red"}); |
| 151 |
chart7.addSeries("Series B", [2, 1, 2, 1, 2], {stroke: {color: "black"}, fill: "blue"}); |
| 152 |
var anim7a = new dc.action2d.Highlight(chart7, "default", { |
| 153 |
duration: dur, |
| 154 |
easing: dojo.fx.easing.bounceOut |
| 155 |
}); |
| 156 |
var anim7b = new dc.action2d.Shake(chart7, "default"); |
| 157 |
var anim7c = new dc.action2d.Tooltip(chart7, "default"); |
| 158 |
chart7.render(); |
| 159 |
var legend7 = new dojox.charting.widget.Legend({chart: chart7, horizontal: false}, "legend7"); |
| 160 |
|
| 161 |
var chart8 = new dc.Chart("test8"); |
| 162 |
chart8.setTheme(dc.themes.PlotKit.green); |
| 163 |
chart8.addPlot("default", {type: "StackedBars"}); |
| 164 |
chart8.addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "black"}, fill: "red"}); |
| 165 |
chart8.addSeries("Series B", [2, 1, 2, 1, 2], {stroke: {color: "black"}, fill: "blue"}); |
| 166 |
var anim8a = new dc.action2d.Highlight(chart8, "default"); |
| 167 |
var anim8b = new dc.action2d.Shake(chart8, "default"); |
| 168 |
var anim8c = new dc.action2d.Tooltip(chart8, "default"); |
| 169 |
chart8.render(); |
| 170 |
var legend8 = new dojox.charting.widget.Legend({chart: chart8}, "legend8"); |
| 171 |
|
| 172 |
var chart9 = new dc.Chart("test9"); |
| 173 |
chart9.setTheme(dc.themes.PlotKit.green); |
| 174 |
chart9.addPlot("default", {type: "Bubble", shadows: {dx: 2, dy: 2, dw: 2}}); |
| 175 |
chart9.addAxis("x", {min: 0, max: 6, majorTick: {stroke: "black", length: 3}, minorTick: {stroke: "gray", length: 3}}); |
| 176 |
chart9.addAxis("y", {vertical: true, min: 0, max: 10, majorTick: {stroke: "black", length: 3}, minorTick: {stroke: "gray", length: 3}}); |
| 177 |
chart9.addSeries("Series A", [{x: 0.5, y: 5, size: 1.4}, {x: 1.5, y: 1.5, size:4.5}, {x: 2, y: 9, size:1.5}, {x: 5, y: 0.3, size:0.8}], |
| 178 |
{stroke: {color: "black"}, fill: "red"}); |
| 179 |
chart9.addSeries("Series B", [{x: 0.3, y: 8, size: 2.5}, {x: 4, y: 6, size:1.1}, {x: 5.5, y: 2, size: 3.2}], |
| 180 |
{stroke: {color: "black"}, fill: "blue"}); |
| 181 |
var anim9a = new dc.action2d.Magnify(chart9, "default", { |
| 182 |
scale: 1.1 |
| 183 |
}); |
| 184 |
var anim9b = new dc.action2d.Highlight(chart9, "default"); |
| 185 |
var anim9c = new dc.action2d.Tooltip(chart9, "default"); |
| 186 |
chart9.render(); |
| 187 |
var legend9 = new dojox.charting.widget.Legend({chart: chart9, horizontal: false}, "legend9"); |
| 188 |
|
| 189 |
var chart10 = new dc.Chart("test10"); |
| 190 |
chart10.setTheme(dc.themes.PlotKit.green); |
| 191 |
chart10.addPlot("default", { |
| 192 |
type: "Pie", |
| 193 |
font: "normal normal 11pt Tahoma", |
| 194 |
fontColor: "black", |
| 195 |
labelOffset: -30, |
| 196 |
radius: 80, |
| 197 |
startAngle: 45 |
| 198 |
}); |
| 199 |
chart10.addSeries("Series A", [ |
| 200 |
{y: 4, text: "Red", color: "red", stroke: "black", tooltip: "Red is 50%"}, |
| 201 |
{y: 2, text: "Green", color: "green", stroke: "black", tooltip: "Green is 25%"}, |
| 202 |
{y: 1, text: "Blue", color: "blue", stroke: "black", tooltip: "I am feeling Blue!"}, |
| 203 |
{y: 1, text: "Other", color: "white", stroke: "black", tooltip: "Mighty <strong>strong</strong><br>With two lines!"} |
| 204 |
]); |
| 205 |
var anim10a = new dc.action2d.MoveSlice(chart10, "default"); |
| 206 |
var anim10b = new dc.action2d.Highlight(chart10, "default"); |
| 207 |
var anim10c = new dc.action2d.Tooltip(chart10, "default"); |
| 208 |
chart10.render(); |
| 209 |
var legend10 = new dojox.charting.widget.Legend({chart: chart10}, "legend10"); |
| 210 |
}; |
| 211 |
|
| 212 |
dojo.addOnLoad(makeObjects); |
| 213 |
|
| 214 |
</script> |
| 215 |
</head> |
| 216 |
<body class="claro"> |
| 217 |
<h1>Event 2D</h1> |
| 218 |
|
| 219 |
<p>Hover over markers, bars, columns, slices, and so on.</p> |
| 220 |
<p>1: Markers, lines, 2D data, custom axis. Actions: Magnify, Tooltip.</p> |
| 221 |
<div id="test1" style="width: 400px; height: 200px;"></div> |
| 222 |
<div id="legend1"></div> |
| 223 |
<p>2: Stacked lines, markers, shadows, no axes, custom strokes, fills, and markers. Actions: Magnify, Highlight.</p> |
| 224 |
<div id="test2" style="width: 400px; height: 200px;"></div> |
| 225 |
<div id="legend2"></div> |
| 226 |
<p>3: Columns with gaps beetwen them, vertical axis aligned on major ticks, custom strokes, fills. Actions: Highlight, Tooltip.</p> |
| 227 |
<div id="test3" style="width: 400px; height: 200px;"></div> |
| 228 |
<div id="legend3"></div> |
| 229 |
<p>4: Bars, axes aligned on major ticks, no minor ticks, custom strokes and fills. Actions: Highlight, Tooltip.</p> |
| 230 |
<div id="test4" style="width: 400px; height: 200px;"></div> |
| 231 |
<div id="legend4"></div> |
| 232 |
<p>5: Clustered bars, custom axes, custom strokes, fills, custom tooltips, and gap. Actions: Highlight, Tooltip.</p> |
| 233 |
<div id="test5" style="width: 400px; height: 200px;"></div> |
| 234 |
<div id="legend5"></div> |
| 235 |
<p>6: Clustered columns with positive and negative values, axes, and grid. Actions: Highlight, Shake, Tooltip.</p> |
| 236 |
<div id="test6" style="width: 400px; height: 200px;"></div> |
| 237 |
<div id="legend6"></div> |
| 238 |
<p>7: Stacked columns, no axes, custom strokes and fills. Actions: Highlight, Shake, Tooltip.</p> |
| 239 |
<div id="test7" style="width: 400px; height: 200px;"></div> |
| 240 |
<div id="legend7"></div> |
| 241 |
<p>8: Stacked bars, no axes, custom strokes and fills. Actions: Highlight, Shake, Tooltip.</p> |
| 242 |
<div id="test8" style="width: 400px; height: 200px;"></div> |
| 243 |
<div id="legend8"></div> |
| 244 |
<p>9: Bubble chart, axes. Actions: Magnify, Highlight, Tooltip.</p> |
| 245 |
<div id="test9" style="width: 400px; height: 300px;"></div> |
| 246 |
<div id="legend9"></div> |
| 247 |
<p>10: Rotated pie with internal custom labels, custom colors, and custom tooltips. Actions: MoveSlice, Highlight, Tooltip.</p> |
| 248 |
<div id="test10" style="width: 300px; height: 300px;"></div> |
| 249 |
<div id="legend10"></div> |
| 250 |
<p>That's all Folks!</p> |
| 251 |
</body> |
| 252 |
</html> |