Skip to content

Commit 0b7d887

Browse files
replace rest of .renderlet( with .on('renderlet',
fixes #906 closes #917
1 parent 59ac87b commit 0b7d887

17 files changed

+34
-31
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ hhravn <[email protected]>
5353
Mihai Hodorogea <[email protected]>
5454
Timothy Ruhle <[email protected]>
5555
Shobhit Gupta <[email protected]>
56+
Alan Kavanagh <[email protected]>

Changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# 2.0 Series
2+
* replace `.renderlet(...)` with `.on("renderlet", ...)` in test and examples, by Alan Kavanagh ([#906](https://github.com/dc-js/dc.js/issues/906) / ([#917](https://github.com/dc-js/dc.js/pull/917))
3+
24
## 2.0.0 beta 10
35
* component package manager support, by Shobhit Gupta ([#860](https://github.com/dc-js/dc.js/pull/860))
46
* add sourcemaps (*.map) to distributions ([#866](https://github.com/dc-js/dc.js/issues/866))

dc.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dc.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/base-mixin-spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ describe("dc.baseMixin", function () {
3232
firstRenderlet = jasmine.createSpy().and.callFake(expectedCallbackSignature);
3333
secondRenderlet = jasmine.createSpy().and.callFake(expectedCallbackSignature);
3434
thirdRenderlet = jasmine.createSpy().and.callFake(expectedCallbackSignature);
35-
chart.renderlet(firstRenderlet);
36-
chart.renderlet(secondRenderlet);
35+
chart.on("renderlet.firstRenderlet", firstRenderlet);
36+
chart.on("renderlet.secondRenderlet", secondRenderlet);
3737
chart.on(third, thirdRenderlet);
3838
});
3939

spec/bubble-chart-spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ describe('dc.bubbleChart', function() {
285285
chart.selectAll("circle").attr("fill", "red");
286286
});
287287
renderlet.and.callThrough();
288-
chart.renderlet(renderlet);
288+
chart.on("renderlet", renderlet);
289289
});
290290

291291
it('is invoked with render', function () {

spec/composite-chart-spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ describe('dc.compositeChart', function() {
354354

355355
describe('subchart renderlets', function () {
356356
beforeEach(function () {
357-
chart.children()[0].renderlet(function(chart) {
357+
chart.children()[0].on("renderlet", function(chart) {
358358
chart.selectAll('rect.bar').attr('width', function(d) {
359359
return 10;
360360
});

spec/coordinate-grid-chart-spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ describe('dc.coordinateGridChart', function() {
117117

118118
describe('renderlets', function () {
119119
beforeEach(function () {
120-
chart.renderlet(function (chart) {
120+
chart.on("renderlet", function (chart) {
121121
chart.selectAll("path").attr("fill", "red");
122122
});
123123
});

spec/data-grid-spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('dc.dataGrid', function() {
8484
chart.selectAll(".dc-grid-label").text("changed");
8585
});
8686
derlet.and.callThrough();
87-
chart.renderlet(derlet);
87+
chart.on("renderlet", derlet);
8888
});
8989
it('custom renderlet should be invoked with render', function() {
9090
chart.render();

spec/data-table-spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ describe('dc.dataTable', function() {
8787
chart.selectAll("td.dc-table-label").text("changed");
8888
});
8989
derlet.and.callThrough();
90-
chart.renderlet(derlet);
90+
chart.on("renderlet", derlet);
9191
});
9292
it('custom renderlet should be invoked with render', function() {
9393
chart.render();

spec/pie-chart-spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ describe('dc.pieChart', function() {
478478
var chart;
479479
beforeEach(function() {
480480
chart = buildChart("chart-renderlet");
481-
chart.renderlet(function() {
481+
chart.on("renderlet", function() {
482482
chart.selectAll("path").attr("fill", "red");
483483
});
484484
});

src/base-mixin.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -980,15 +980,15 @@ dc.baseMixin = function (_chart) {
980980
#### .renderlet(renderletFunction)
981981
A renderlet is similar to an event listener on rendering event. Multiple renderlets can be added
982982
to an individual chart. Each time a chart is rerendered or redrawn the renderlets are invoked
983-
right after the chart finishes its own drawing routine, giving you a way to modify the svg
983+
right after the chart finishes its transitions, giving you a way to modify the svg
984984
elements. Renderlet functions take the chart instance as the only input parameter and you can
985985
use the dc API or use raw d3 to achieve pretty much any effect.
986986
987987
@Deprecated - Use [Listeners](#Listeners) with a 'renderlet' prefix
988-
Generates a random key for the renderlet, which makes it hard for removal.
988+
Generates a random key for the renderlet, which makes it hard to remove.
989989
```js
990-
// renderlet function
991-
chart.renderlet(function(chart){
990+
// do this instead of .renderlet(function(chart) { ... })
991+
chart.on("renderlet", function(chart){
992992
// mix of dc API and d3 manipulation
993993
chart.select('g.y').style('display', 'none');
994994
// its a closure so you can also access other chart variable available in the closure scope

web/docs/api-latest.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -492,15 +492,15 @@ given.
492492
#### .renderlet(renderletFunction)
493493
A renderlet is similar to an event listener on rendering event. Multiple renderlets can be added
494494
to an individual chart. Each time a chart is rerendered or redrawn the renderlets are invoked
495-
right after the chart finishes its own drawing routine, giving you a way to modify the svg
495+
right after the chart finishes its transitions, giving you a way to modify the svg
496496
elements. Renderlet functions take the chart instance as the only input parameter and you can
497497
use the dc API or use raw d3 to achieve pretty much any effect.
498498
499499
@Deprecated - Use [Listeners](#Listeners) with a 'renderlet' prefix
500-
Generates a random key for the renderlet, which makes it hard for removal.
500+
Generates a random key for the renderlet, which makes it hard to remove.
501501
```js
502-
// renderlet function
503-
chart.renderlet(function(chart){
502+
// do this instead of .renderlet(function(chart) { ... })
503+
chart.on("renderlet", function(chart){
504504
// mix of dc API and d3 manipulation
505505
chart.select('g.y').style('display', 'none');
506506
// its a closure so you can also access other chart variable available in the closure scope

web/docs/index.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,13 @@ <h4 id="-rendertitle-boolean-">.renderTitle(boolean)</h4>
513513
<h4 id="-renderlet-renderletfunction-">.renderlet(renderletFunction)</h4>
514514
<p>A renderlet is similar to an event listener on rendering event. Multiple renderlets can be added
515515
to an individual chart. Each time a chart is rerendered or redrawn the renderlets are invoked
516-
right after the chart finishes its own drawing routine, giving you a way to modify the svg
516+
right after the chart finishes its transitions, giving you a way to modify the svg
517517
elements. Renderlet functions take the chart instance as the only input parameter and you can
518518
use the dc API or use raw d3 to achieve pretty much any effect.</p>
519519
<p>@Deprecated - Use <a href="#Listeners">Listeners</a> with a ‘renderlet’ prefix
520-
Generates a random key for the renderlet, which makes it hard for removal.</p>
521-
<pre><code class="lang-js"><span class="hljs-comment">// renderlet function</span>
522-
chart.renderlet(<span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(chart)</span></span>{
520+
Generates a random key for the renderlet, which makes it hard to remove.</p>
521+
<pre><code class="lang-js"><span class="hljs-comment">// do this instead of .renderlet(function(chart) { ... })</span>
522+
chart.on(<span class="hljs-string">"renderlet"</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(chart)</span></span>{
523523
<span class="hljs-comment">// mix of dc API and d3 manipulation</span>
524524
chart.select(<span class="hljs-string">'g.y'</span>).style(<span class="hljs-string">'display'</span>, <span class="hljs-string">'none'</span>);
525525
<span class="hljs-comment">// its a closure so you can also access other chart variable available in the closure scope</span>

web/js/dc.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/js/dc.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/transitions/bar-transitions.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
.yAxisLabel("This is the Y Axis!")
4141
.dimension(runDimension)
4242
.group(speedSumGroup)
43-
.renderlet(function(chart) {
43+
.on("renderlet", function(chart) {
4444
chart.selectAll('rect').on("click", function(d) {
4545
console.log("click!", d);
4646
});

0 commit comments

Comments
 (0)