I am trying to create a dynamic graph using the StackedLine style. No graph was created using the code below. Switching to Areas or Scatter styles yield the correct graph. I am using dojo102.
<html>
<head>
<title>Chart 2D</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
@import "dojo102/dojo/resources/dojo.css";
@import "dojo102/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="dojo102/dojo/dojo.js" djConfig="isDebug: true"></script>
<script type="text/javascript" src="dojo102/dojox/lang/functional.js"></script>
<script type="text/javascript" src="dojo102/dojox/charting/Theme.js"></script>
<script type="text/javascript" src="dojo102/dojox/charting/scaler.js"></script>
<script type="text/javascript" src="dojo102/dojox/charting/Chart2D.js"></script>
<script type="text/javascript">
dojo.require("dojox.charting.Chart2D");
dojo.require("dojox.charting.themes.PlotKit.orange");
var chart, limit = 10, magnitude = 30;
var seriesA=[];
var makeObjects = function(){
chart = new dojox.charting.Chart2D("test");
chart.setTheme(dojox.charting.themes.PlotKit.orange);
chart.addAxis("x", {fixLower: "minor", natural: true, min: 1, max: limit});
chart.addAxis("y", {vertical: true, min: 0, max: 30, majorTickStep: 5, minorTickStep: 1});
chart.addPlot("default", {type: "StackedLines"});
//chart.addPlot("default", {type: "Scatter"});
//chart.addPlot("default", {type: "Areas"});
chart.addPlot("grid", {type: "Grid", hMinorLines: true});
chart.addSeries("Series A", seriesA);
chart.render();
setInterval(function(){updateTest();}, 2000);
};
var i=1;
var updateTest = function(){
seriesA.push(i++);
chart.updateSeries("Series A", seriesA);
chart.render();
};
dojo.addOnLoad(makeObjects);
</script>
</head>
<body>
<h1>Chart 2D Updating Data</h1>
<p>Areas, orange theme, axes, grid. Very crude example to show a chart with updating values.</p>
<div id="test" style="width: 400px; height: 400px;"></div>
</body>
</html>
Stacked.js can't handle a series of object, but numeric arrays. (try with an array of values instead of an array of {x:..., y:...} objects.
I'm trying to change Stacked.js, but I'm stuck with common.js (dojox.charting.axis2d.common): when calculateAxes calls common.collectStackedStats(series), it seems to stats.hmax and stats.hmin are wrong. Regards,