Opened 6 years ago

Closed 3 years ago

#17471 closed defect (patchwelcome)

StoreSeries asynchronous fetch() creates race condition with SelectableLegend refresh()

Reported by: cdyson37 Owned by:
Priority: undecided Milestone: 1.13
Component: Charting Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:


If fetch() is called on a StoreSeries?, an associated Chart's series will correspondingly change. A SelectableLegend? must then be refresh()ed to function correctly - if not the checkbuttons do nothing.

However, refresh() will not work correctly until StoreSeries? has finished calling Chart.updateSeries(). Since this happens asynchronously, if a user calls


then refresh() in general won't see the new chart.series in time. I can so far only get this to work when using a CsvStore? to load data externally - the delay is just enough to induce this problem.

I can think of two solutions to this: (1) would be to provide a callback to my_store_series.fetch, so the user would then do


(2) (probably much simpler) SelectableLegend?'s _applyEvents function could bind targetData, shapes, plotName and seriesName inside the hub.connect() callback, instead of further up. This means the legend need not be refreshed at all after the fetch() call, which would be consistent with the principle of least surprise. I've tested this locally and it worked for me at least.

Change History (2)

comment:1 Changed 6 years ago by cjolif

(2) sounds better indeed. Do you have a Dojo CLA? Could you submit a pull request ( with the fixed code? Also if you have an example to add to dojox/charting/tests reproducing the issue it would be welcomed to test the pull request.

comment:2 Changed 3 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: newclosed

Given that no one has shown interest in creating a patch in the past 2+ years, I'm closing this as patchwelcome. Please let us know if you would like to get involved in helping make this change to Dojo!

Note: See TracTickets for help on using tickets.