Skip to content

Instantly share code, notes, and snippets.

@mattbaker
Last active December 16, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattbaker/d6a07f33c37c6a41f430 to your computer and use it in GitHub Desktop.
Save mattbaker/d6a07f33c37c6a41f430 to your computer and use it in GitHub Desktop.
Ex. 3 in Reactive Bar Chart Article
function BarChart(svg) {
this.width = $R.state(200);
this.height = $R.state(200);
this.data = $R.state([]);
var y = $R(BarChart.y).bindTo(this.height, this.data)
}
BarChart.y = function (height, data) {
return d3.scale.linear()
.domain([0, d3.max(data, function(d) { return d.value })])
.range([height, 0]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment