Skip to content

Commit

Permalink
replace rest of .renderlet( with .on('renderlet',
Browse files Browse the repository at this point in the history
fixes #906
closes #917
  • Loading branch information
gordonwoodhull committed Jun 1, 2015
1 parent 59ac87b commit 0b7d887
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 31 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ hhravn <hhravn@gmail.com>
Mihai Hodorogea <mihaihodorogea@gmail.com>
Timothy Ruhle <timothy.ruhle@gmail.com>
Shobhit Gupta <shobhitg@vmware.com>
Alan Kavanagh <akavanagh208@gmail.com>
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# 2.0 Series
* 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))

## 2.0.0 beta 10
* component package manager support, by Shobhit Gupta ([#860](https://github.com/dc-js/dc.js/pull/860))
* add sourcemaps (*.map) to distributions ([#866](https://github.com/dc-js/dc.js/issues/866))
Expand Down
8 changes: 4 additions & 4 deletions dc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dc.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions spec/base-mixin-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ describe("dc.baseMixin", function () {
firstRenderlet = jasmine.createSpy().and.callFake(expectedCallbackSignature);
secondRenderlet = jasmine.createSpy().and.callFake(expectedCallbackSignature);
thirdRenderlet = jasmine.createSpy().and.callFake(expectedCallbackSignature);
chart.renderlet(firstRenderlet);
chart.renderlet(secondRenderlet);
chart.on("renderlet.firstRenderlet", firstRenderlet);
chart.on("renderlet.secondRenderlet", secondRenderlet);
chart.on(third, thirdRenderlet);
});

Expand Down
2 changes: 1 addition & 1 deletion spec/bubble-chart-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ describe('dc.bubbleChart', function() {
chart.selectAll("circle").attr("fill", "red");
});
renderlet.and.callThrough();
chart.renderlet(renderlet);
chart.on("renderlet", renderlet);
});

it('is invoked with render', function () {
Expand Down
2 changes: 1 addition & 1 deletion spec/composite-chart-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ describe('dc.compositeChart', function() {

describe('subchart renderlets', function () {
beforeEach(function () {
chart.children()[0].renderlet(function(chart) {
chart.children()[0].on("renderlet", function(chart) {
chart.selectAll('rect.bar').attr('width', function(d) {
return 10;
});
Expand Down
2 changes: 1 addition & 1 deletion spec/coordinate-grid-chart-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('dc.coordinateGridChart', function() {

describe('renderlets', function () {
beforeEach(function () {
chart.renderlet(function (chart) {
chart.on("renderlet", function (chart) {
chart.selectAll("path").attr("fill", "red");
});
});
Expand Down
2 changes: 1 addition & 1 deletion spec/data-grid-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('dc.dataGrid', function() {
chart.selectAll(".dc-grid-label").text("changed");
});
derlet.and.callThrough();
chart.renderlet(derlet);
chart.on("renderlet", derlet);
});
it('custom renderlet should be invoked with render', function() {
chart.render();
Expand Down
2 changes: 1 addition & 1 deletion spec/data-table-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('dc.dataTable', function() {
chart.selectAll("td.dc-table-label").text("changed");
});
derlet.and.callThrough();
chart.renderlet(derlet);
chart.on("renderlet", derlet);
});
it('custom renderlet should be invoked with render', function() {
chart.render();
Expand Down
2 changes: 1 addition & 1 deletion spec/pie-chart-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ describe('dc.pieChart', function() {
var chart;
beforeEach(function() {
chart = buildChart("chart-renderlet");
chart.renderlet(function() {
chart.on("renderlet", function() {
chart.selectAll("path").attr("fill", "red");
});
});
Expand Down
8 changes: 4 additions & 4 deletions src/base-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,15 +980,15 @@ dc.baseMixin = function (_chart) {
#### .renderlet(renderletFunction)
A renderlet is similar to an event listener on rendering event. Multiple renderlets can be added
to an individual chart. Each time a chart is rerendered or redrawn the renderlets are invoked
right after the chart finishes its own drawing routine, giving you a way to modify the svg
right after the chart finishes its transitions, giving you a way to modify the svg
elements. Renderlet functions take the chart instance as the only input parameter and you can
use the dc API or use raw d3 to achieve pretty much any effect.
@Deprecated - Use [Listeners](#Listeners) with a 'renderlet' prefix
Generates a random key for the renderlet, which makes it hard for removal.
Generates a random key for the renderlet, which makes it hard to remove.
```js
// renderlet function
chart.renderlet(function(chart){
// do this instead of .renderlet(function(chart) { ... })
chart.on("renderlet", function(chart){
// mix of dc API and d3 manipulation
chart.select('g.y').style('display', 'none');
// its a closure so you can also access other chart variable available in the closure scope
Expand Down
8 changes: 4 additions & 4 deletions web/docs/api-latest.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,15 +492,15 @@ given.
#### .renderlet(renderletFunction)
A renderlet is similar to an event listener on rendering event. Multiple renderlets can be added
to an individual chart. Each time a chart is rerendered or redrawn the renderlets are invoked
right after the chart finishes its own drawing routine, giving you a way to modify the svg
right after the chart finishes its transitions, giving you a way to modify the svg
elements. Renderlet functions take the chart instance as the only input parameter and you can
use the dc API or use raw d3 to achieve pretty much any effect.
@Deprecated - Use [Listeners](#Listeners) with a 'renderlet' prefix
Generates a random key for the renderlet, which makes it hard for removal.
Generates a random key for the renderlet, which makes it hard to remove.
```js
// renderlet function
chart.renderlet(function(chart){
// do this instead of .renderlet(function(chart) { ... })
chart.on("renderlet", function(chart){
// mix of dc API and d3 manipulation
chart.select('g.y').style('display', 'none');
// its a closure so you can also access other chart variable available in the closure scope
Expand Down
8 changes: 4 additions & 4 deletions web/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,13 @@ <h4 id="-rendertitle-boolean-">.renderTitle(boolean)</h4>
<h4 id="-renderlet-renderletfunction-">.renderlet(renderletFunction)</h4>
<p>A renderlet is similar to an event listener on rendering event. Multiple renderlets can be added
to an individual chart. Each time a chart is rerendered or redrawn the renderlets are invoked
right after the chart finishes its own drawing routine, giving you a way to modify the svg
right after the chart finishes its transitions, giving you a way to modify the svg
elements. Renderlet functions take the chart instance as the only input parameter and you can
use the dc API or use raw d3 to achieve pretty much any effect.</p>
<p>@Deprecated - Use <a href="#Listeners">Listeners</a> with a ‘renderlet’ prefix
Generates a random key for the renderlet, which makes it hard for removal.</p>
<pre><code class="lang-js"><span class="hljs-comment">// renderlet function</span>
chart.renderlet(<span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(chart)</span></span>{
Generates a random key for the renderlet, which makes it hard to remove.</p>
<pre><code class="lang-js"><span class="hljs-comment">// do this instead of .renderlet(function(chart) { ... })</span>
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>{
<span class="hljs-comment">// mix of dc API and d3 manipulation</span>
chart.select(<span class="hljs-string">'g.y'</span>).style(<span class="hljs-string">'display'</span>, <span class="hljs-string">'none'</span>);
<span class="hljs-comment">// its a closure so you can also access other chart variable available in the closure scope</span>
Expand Down
8 changes: 4 additions & 4 deletions web/js/dc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/js/dc.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/transitions/bar-transitions.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
.yAxisLabel("This is the Y Axis!")
.dimension(runDimension)
.group(speedSumGroup)
.renderlet(function(chart) {
.on("renderlet", function(chart) {
chart.selectAll('rect').on("click", function(d) {
console.log("click!", d);
});
Expand Down

0 comments on commit 0b7d887

Please sign in to comment.