| 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>Chart 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/tundra/tundra.css"> |
| 25 |
<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true, async: true, parseOnLoad: true"></script> |
| 26 |
|
| 27 |
<script type="text/javascript"> |
| 28 |
source = [ |
| 29 |
{x: 1, y: 2.6, size: 0.3, fill: "orange"}, |
| 30 |
{x: 2, y: 1.8, size: 0.4, fill: "orange"}, |
| 31 |
{x: 3, y: 2, size: 0.1 }, |
| 32 |
{x: 4, y: 1, size: 0.6}, |
| 33 |
{x: 5, y: 1.4, size: 0.5}, |
| 34 |
{x: 6, y: 0.7, size: 0.3}, |
| 35 |
{x: 7, y: 2, size: 0.6} |
| 36 |
]; |
| 37 |
var styleFunc, changeLimits; |
| 38 |
require([ |
| 39 |
"dojo/dom", |
| 40 |
"dijit/registry", |
| 41 |
"dojox/charting/widget/Chart", |
| 42 |
"dojox/charting/axis2d/Default", |
| 43 |
"dojox/charting/plot2d/Bars", |
| 44 |
"dojox/charting/plot2d/Columns", |
| 45 |
"dojox/charting/plot2d/Bubble", |
| 46 |
"dojox/charting/plot2d/Areas", |
| 47 |
"dojox/charting/plot2d/Scatter", |
| 48 |
"dojox/charting/plot2d/Pie", |
| 49 |
"dojox/charting/themes/PlotKit/orange", |
| 50 |
"dojox/charting/themes/PlotKit/blue", |
| 51 |
"dojox/charting/themes/PlotKit/green", "dojo/parser"], function(dom, registry){ |
| 52 |
changeLimits = function(){ |
| 53 |
registry.byId("chart1").chart.getPlot("default").dirty = true; |
| 54 |
registry.byId("chart1").chart.render(); |
| 55 |
registry.byId("chart2").chart.getPlot("default").dirty = true; |
| 56 |
registry.byId("chart2").chart.render(); |
| 57 |
registry.byId("chart3").chart.getPlot("default").dirty = true; |
| 58 |
registry.byId("chart3").chart.render(); |
| 59 |
registry.byId("chart4").chart.getPlot("default").dirty = true; |
| 60 |
registry.byId("chart4").chart.render(); |
| 61 |
registry.byId("chart5").chart.getPlot("default").dirty = true; |
| 62 |
registry.byId("chart5").chart.render(); |
| 63 |
registry.byId("chart6").chart.getPlot("default").dirty = true; |
| 64 |
registry.byId("chart6").chart.render(); |
| 65 |
}; |
| 66 |
styleFunc = function(item){ |
| 67 |
if(item.y < dom.byId("low").value){ |
| 68 |
return { fill : "red" }; |
| 69 |
}else if(item.y > dom.byId("high").value){ |
| 70 |
return { fill: "green" }; |
| 71 |
} |
| 72 |
return {}; |
| 73 |
}; |
| 74 |
}); |
| 75 |
</script> |
| 76 |
</head> |
| 77 |
<body class="tundra"> |
| 78 |
<h1>Test Chart Item Coloring</h1> |
| 79 |
<table border="0" cellspacing="30"> |
| 80 |
<tr> |
| 81 |
<td> |
| 82 |
<div data-dojo-type="dojox.charting.widget.Chart" id="chart1" style="width: 300px; height: 300px;" |
| 83 |
theme="dojox.charting.themes.PlotKit.blue"> |
| 84 |
<div class="axis" name="x" fixUpper="major" includeZero="true" font="italic normal normal 8pt Tahoma"></div> |
| 85 |
<div class="axis" name="y" vertical="true" font="italic normal normal 8pt Tahoma"></div> |
| 86 |
<div class="plot" name="default" type="Bars" styleFunc="styleFunc" fill="'yellow'"></div> |
| 87 |
<div class="series" name="Run A" array="source"></div> |
| 88 |
</div> |
| 89 |
</td> |
| 90 |
<td> |
| 91 |
<div data-dojo-type="dojox.charting.widget.Chart" id="chart2" theme="dojox.charting.themes.PlotKit.orange" |
| 92 |
fill="'lightgrey'" style="width: 300px; height: 300px;"> |
| 93 |
<div class="axis" name="x" font="italic normal bold 10pt Tahoma"></div> |
| 94 |
<div class="axis" name="y" vertical="true" fixUpper="major" includeZero="true" minorLabels="false" |
| 95 |
font="italic normal bold 10pt Tahoma"></div> |
| 96 |
<div class="plot" name="default" type="Columns" styleFunc="styleFunc" fill="'yellow'"></div> |
| 97 |
<div class="series" name="Run A" array="source"></div> |
| 98 |
</div> |
| 99 |
</td> |
| 100 |
</tr> |
| 101 |
<tr> |
| 102 |
<td> |
| 103 |
<div data-dojo-type="dojox.charting.widget.Chart" id="chart3" theme="dojox.charting.themes.PlotKit.green" |
| 104 |
style="width: 300px; height: 300px;"> |
| 105 |
<div class="plot" name="default" type="Pie" radius="100" fontColor="white" styleFunc="styleFunc" fill="'yellow'"></div> |
| 106 |
<div class="series" name="Run A" array="source"></div> |
| 107 |
</div> |
| 108 |
</td> |
| 109 |
<td> |
| 110 |
<div data-dojo-type="dojox.charting.widget.Chart" id="chart4" theme="dojox.charting.themes.PlotKit.orange" |
| 111 |
fill="'lightgrey'" style="width: 300px; height: 300px;"> |
| 112 |
<div class="axis" name="x" font="italic normal bold 10pt Tahoma"></div> |
| 113 |
<div class="axis" name="y" vertical="true" fixUpper="major" includeZero="true" |
| 114 |
font="italic normal bold 10pt Tahoma"></div> |
| 115 |
<div class="plot" name="default" type="Bubble" styleFunc="styleFunc" fill="'yellow'"></div> |
| 116 |
<div class="series" name="Run A" array="source"></div> |
| 117 |
</div> |
| 118 |
</td> |
| 119 |
</tr> |
| 120 |
<tr> |
| 121 |
<td> |
| 122 |
<div data-dojo-type="dojox.charting.widget.Chart" id="chart5" theme="dojox.charting.themes.PlotKit.orange" |
| 123 |
fill="'lightgrey'" style="width: 300px; height: 300px;"> |
| 124 |
<div class="axis" name="x" font="italic normal bold 10pt Tahoma"></div> |
| 125 |
<div class="axis" name="y" vertical="true" fixUpper="major" includeZero="true" |
| 126 |
font="italic normal bold 10pt Tahoma"></div> |
| 127 |
<div class="plot" name="default" type="Scatter" styleFunc="styleFunc" markerFill="'yellow'"></div> |
| 128 |
<div class="series" name="Run A" array="source"></div> |
| 129 |
</div> |
| 130 |
</td> |
| 131 |
<td> |
| 132 |
<div data-dojo-type="dojox.charting.widget.Chart" id="chart6" theme="dojox.charting.themes.PlotKit.orange" |
| 133 |
fill="'lightgrey'" style="width: 300px; height: 300px;"> |
| 134 |
<div class="axis" name="x" font="italic normal bold 10pt Tahoma"></div> |
| 135 |
<div class="axis" name="y" vertical="true" fixUpper="major" includeZero="true" |
| 136 |
font="italic normal bold 10pt Tahoma"></div> |
| 137 |
<div class="plot" name="default" type="Areas" styleFunc="styleFunc" markerFill="'yellow'" markers="true" fill="'blue'"></div> |
| 138 |
<div class="series" name="Run A" array="source"></div> |
| 139 |
</div> |
| 140 |
</td> |
| 141 |
</tr> |
| 142 |
</table> |
| 143 |
<label>Low Limit</label> |
| 144 |
<input id="low" type="text" onchange="changeLimits()" value="1"></input> |
| 145 |
<label>High Limit</label> |
| 146 |
<input id="high" type="text" onchange="changeLimits()" value="2"></input> |
| 147 |
<p>That's all Folks!</p> |
| 148 |
</body> |
| 149 |
</html> |