[ 3 posts ]

Ryan Cannon

YUI Contributor

  • Username: rcanine
  • Joined: Thu Apr 22, 2010 1:40 pm
  • Posts: 23
  • Location: Culver City, CA
  • Twitter: rcanine
  • GitHub: RCanine
  • Gists: RCanine
  • Offline
  • Profile

Charts / Attribute - setter called before valueFn in tooltip

Post Posted: Thu May 17, 2012 5:55 pm
+0-
This is baking my noodle.

I've got a chart in a fairly complicated module, but it's setup is relatively straightforward:


Code:
var chartConfig = {
   axes: { values: { roundingMethod: "auto" }},
   dataProvider: [...],
   horizontalGridlines: { ... },
   interactionType: marker,
   seriesKeys: [...],
   styles: {...},
   tooltip: {
      styles: { ... },
      markerLabelFunction = function () { ... }
   },
   type: "column",
   render: chartDiv,
   verticalGridlines: { ... }
};
var chart = new Y.Chart(chartConfig);


I'm seeing an exception deep into the chart-base.js, where this._updateTooltip is being called, and looking for this._tooltip, but this._tooltip hasn't been set, so referencing this._tooltip.node dies. this._tooltip is set in this._getTooltip.

The whole thing comes together with:

Code:
ATTRS: {
 ...
  tooltip: {
    valueFn: "_getTooltip",
    setter: function (val) {
      return this._updateTooltip(val);
    }
  }
  ...
}


I'm stumped. I can't replicate or isolate this issue outside of my module, even if I copy the same code and put it on another page. I'm not modifying any YUI modules. Anyone have any hints on how I can debug this?

Update: this change resolved the issue with a local copy of YUI:

Code:
- var tt = this._tooltip,
+ var tt = this._tooltip || this._getTooltip(),

Tripp Bridges

YUI Developer

  • Username: tripp
  • Joined: Wed Jan 07, 2009 1:54 pm
  • Posts: 435
  • GitHub: tripp
  • Gists: tripp
  • YUI Developer
  • Offline
  • Profile

Re: Charts / Attribute - setter called before valueFn in too

Post Posted: Fri May 18, 2012 10:48 am
+0-
Ryan,
Thanks for bringing this to my attention. I have filed a ticket and will investigate this. Your workaround is nice and I'll implement it for the next pr.

Tripp

Ryan Cannon

YUI Contributor

  • Username: rcanine
  • Joined: Thu Apr 22, 2010 1:40 pm
  • Posts: 23
  • Location: Culver City, CA
  • Twitter: rcanine
  • GitHub: RCanine
  • Gists: RCanine
  • Offline
  • Profile

Re: Charts / Attribute - setter called before valueFn in too

Post Posted: Fri May 18, 2012 1:35 pm
+0-
Thanks for looking into this. As far as I can tell, it seems to have something to do with the way attributes are set in the constructor:

http://yuilibrary.com/yui/docs/api/file ... .html#l440

I also was running into some DOM Exception 8 issues when trying to set the tooltip properties after rendering, not sure if they're related though.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum