Opened 10 years ago

Closed 8 years ago

#9012 closed defect (fixed)

Chart2D Legend icons incorrect when chart stores load slowly

Reported by: Peter Bell Owned by: Eugene Lazutkin
Priority: high Milestone: 1.6
Component: Charting Version: 1.3.0rc2
Keywords: charting Cc: bell.pa@…
Blocked By: Blocking:

Description

I have defined a chart using the dojox.charting.widget.Chart2D widget. The chart has two series that take data from an ItemFileReadStore?. (about 1008 points). The chart renders the series correctly after about 2 seconds when (I assume) the data has been downloaded and processed. I have added a dojox.charting.widget.Legend widget to the chart. The icons on this legend are being rendered as boxes with a cross in them. I think this is wrong - they should be horizontal lines drawn in the colours used for drawing the series. If I add a third series that uses a data attribute the icons are rendered as I would expect. Looking at the buildRendering function in dojox/charting/widget/Chart2D.js, line 70 onwards, it seems that a render is performed immediately if any series has type 'data'. Otherwise rendering is deferred until the store calls back the onComplete function (I think). I know that if I force the chart to be rendered immediately by adding render=true; at line 71, before the c.addSeries(series.name, series.data, series.kwArgs); call, it fixes my problem. I doubt that this is the right way to solve this, but it may help someone to work out what's going wrong...

I've attached a zip containing the html/css/data that I'm using. I've left out the dojo directories. They should be added next to widget.html.

This 'defect' occurs when I use http://download.dojotoolkit.org/release-1.2.3/dojo-release-1.2.3-src.tar.gz or the 1.3.rc2 version on both Firefox 3.0.8 runnning on Ubuntu Ibex and IE 7.0.5730.13 running on windows XP.

Attachments (1)

dojox_bug.zip (6.1 KB) - added by Peter Bell 10 years ago.
Zip of html/css/data files that demonstrate bug. View widget.html

Download all attachments as: .zip

Change History (8)

Changed 10 years ago by Peter Bell

Attachment: dojox_bug.zip added

Zip of html/css/data files that demonstrate bug. View widget.html

comment:1 Changed 10 years ago by Eugene Lazutkin

Component: DojoX WidgetsCharting
Milestone: tbdfuture
Owner: changed from dante to Eugene Lazutkin
Status: newassigned

The legend widget should use events to be updated when data is available or changed.

comment:2 Changed 10 years ago by Eugene Lazutkin

#7898 added refresh() to a legend widget. Probably we need to call it dynamically.

Right now a legend acts independently of a chart. Either we need to register it with a chart, or it should subscribe to relevant events. In the latter case we need to make sure it is unsubscribed when destroyed.

comment:3 Changed 10 years ago by Just

Hi Eugene, Peter,

I've come across something that may be a different manifestation of the problem on this ticket: if I define a chart with a StackedColumns? plot, then add some dummy data to the two series on it using addSeries (--> [0]), then I render it. Then instantiate a legend, that legend doesn't render properly (the colour coordinated boxes that represent the series are black and crossed-out).

I put together a blurb and a live demo over here: http://justberkhout.x10hosting.com/LegendRenderProblem.htm

Things that I tried to get the Legend to render properly:

  • Add 'real' data to the StackedColumns? series [works]
  • Add an array of 0's the size of the x-axis [doesn't work]
  • change Plot type to StackedAreas? [works!]
  • fidget with the order inwhich I add data [works a bit] (If I add 'real' data to the first series, but dummy to the second, the legend renders OK for both series. If I add dummy data to the first series, but real data to the second, the legend renders incorrect for the first, yet correct for the second series. :-/)

Anyway. Hope it helps

Cheers, Just

comment:4 Changed 10 years ago by Eugene Lazutkin

Milestone: future1.4

comment:5 Changed 10 years ago by Eugene Lazutkin

Milestone: 1.41.5

bumping tickets that didn't make the 1.4 cut, but most likely to go in the next point release.

comment:6 Changed 9 years ago by Eugene Lazutkin

Milestone: 1.51.6

comment:7 Changed 8 years ago by Eugene Lazutkin

Resolution: fixed
Status: assignedclosed

It appears that this problem was fixed --- now all series (even empty ones) are allocated visual resources.

Please reopen, if there is a way to reproduce it.

In any case there is a way to force a legend to redraw --- just call refresh() on it.

Note: See TracTickets for help on using tickets.