Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document global renderlet #910

Open
gordonwoodhull opened this issue Apr 12, 2015 · 6 comments
Open

document global renderlet #910

gordonwoodhull opened this issue Apr 12, 2015 · 6 comments
Labels
Milestone

Comments

@gordonwoodhull
Copy link
Contributor

I just noticed this thing existed, it is a single callback directly on dc which gets called directly after any redrawAll or renderAll.

https://github.com/dc-js/dc.js/blob/develop/src/core.js#L283-L289

It fires immediately, like what we're calling "pretransition" #806, and unlike the other "renderlet" events. It takes the group name as its only parameter.

It does not use an event dispatcher. If I were to modernize it, I would suggest an event dispatcher per chart group, and (also/instead) taking the list of charts in the group. I don't know if people use it, though, since it has never been documented. It goes back almost to the beginning of the library.

@gordonwoodhull gordonwoodhull added this to the v2.0 milestone Apr 12, 2015
@mtraynham
Copy link
Contributor

I don't know if this is generally helpful, even if it does fire at the "pretransition" step. dc.js offers very few global properties to be altered at these stages, so what does this gain that adding a listener to the chart does not?

Also I'd like to point out, that a group can contain any type of chart. If a user is to alter the charts in some fashion during this call, it would require them to know what kind of chart it is (i.e. #904). I guess they could also check if a chart has a certain function/property, but that is less intuitive than assigning a "pretransition" to a chart directly and knowing the properties upfront.

@gordonwoodhull
Copy link
Contributor Author

Yeah. I bet this is really just for detecting redraws / renders, if you're doing something else on the screen like updating some text or something. I'd like to deprecate it in favor of some chart group events.

Wish we could find out how people are using it. Oh, we can!

https://github.com/search?q=dc.renderlet&type=Code&utf8=✓

@mtraynham
Copy link
Contributor

Interesting never tried that URL before. Seems to just return a bunch of clones checked into source control.

@gordonwoodhull
Copy link
Contributor Author

Ah, you are right, sorry for the noise. I thought I saw some real results in there, but nothing in the first ten pages. (This the search function at the top of github, if you press backspace then it starts searching over all repos.)

Google says dc.renderlet was implemented in response to #20, for updating the document after interactions. So yeah, chart group events should cover it. And you're right, it has nothing to do with rendering (or even the charts) so it shouldn't be called renderlet.

@r4j4h
Copy link
Contributor

r4j4h commented Apr 21, 2015

The only use I'd see for it you've mentioned and would be provided for by chart (group) events so +1 for deprecating it in favor of cleaner, more semantically explicit events! :)

@gordonwoodhull
Copy link
Contributor Author

For now, minimal documentation as I just posted on gitter:

Usage:

dc.renderlet(function() {
     // do what you need here
})

Replaces any previous callback.

I'll add this to the docs on my next sweep for 2.0. The interface won't change in 2.0.* but in 2.1 we should do better named event dispatches per chart group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants