Opened 12 years ago

Closed 8 years ago

#6043 closed defect (fixed)

StackedLines didn't work for dynamic graph

Reported by: guest Owned by: cjolif
Priority: high Milestone: 1.8
Component: Charting Version: 1.0
Keywords: Cc: cjolif
Blocked By: Blocking:

Description (last modified by Eugene Lazutkin)

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>

Change History (10)

comment:1 Changed 12 years ago by dylan

Milestone: 1.2

comment:2 Changed 12 years ago by Eugene Lazutkin

Description: modified (diff)
Status: newassigned

comment:3 Changed 12 years ago by Eugene Lazutkin

severity: majornormal

comment:4 in reply to:  description Changed 11 years ago by guest

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,

Nicola

comment:5 Changed 11 years ago by Eugene Lazutkin

Milestone: 1.2future

Moving all open ticketd to the future.

comment:6 Changed 10 years ago by Eugene Lazutkin

Description: modified (diff)

Next time attach files instead of pasting the inline.

comment:7 Changed 10 years ago by Eugene Lazutkin

Description: modified (diff)

comment:8 Changed 8 years ago by cjolif

Cc: cjolif added

I ran the example with 1.7 the problem seems to come that when data are updated Stacked.render() is called but the series stats have not been updated (getSeriesStats() not called back on update). As the stat have not been update render() is immediately finish as _maxRunLength is still equal to 0.

comment:9 Changed 8 years ago by cjolif

Milestone: future1.8
Owner: changed from Eugene Lazutkin to cjolif
Status: assignednew

comment:10 Changed 8 years ago by cjolif

Resolution: fixed
Status: newclosed

fixed in In [27011]

Note: See TracTickets for help on using tickets.