Question

I have a dojo chart which uses a JsonRest store (/dojo/store/JsonRest to be specific) to populate the series. The store is setup with an interval to periodically update itself. While it does pull back the correct data, the chart is not correctly updating. My intitial impression was that simply updating the store should update the chart. When this did not happen I tried to manually update the series like this, but it only resulted in all the graph points being set to a y-value of zero:

var jStore = new JsonRest( {target: "/TestExecutionSummary/" } );
jStore = Observable(jStore);

// Creating chart
...
...
chart.addSeries("y", new dojox.charting.StoreSeries(jStore, { query: {} }, "totalPassed"));


var interval = setInterval(function() {
  var updates = jStore.query({});
  updates.then(function(result) {
    chart.updateSeries("y", result, true).render();
  });
}, 3* 1000);        

Is there some way that I can get the chart to update itself with the new store, or does the JsonRest store not really support this type of workflow.

Was it helpful?

Solution

I feel like this is a bit of a hack, but the following worked for me. Instead of createing the StoreSeries instance inline, I created an separate instance which I could then manually update by calling its fetch() method.

// Creating chart
...
var mySeries = new StoreSeries(testExecutionSummaryStore, { query: {} }, "totalTests");
chart.addSeries("Total Test Count", mySeries, {plot:"total"});
...

// Call this in the interval to update the chart
mySeries.fetch();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top