Skip to content

Instantly share code, notes, and snippets.

@exp0nge
Last active May 26, 2016 03:16
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 exp0nge/e8f43416656c7b79caff70909696ad83 to your computer and use it in GitHub Desktop.
Save exp0nge/e8f43416656c7b79caff70909696ad83 to your computer and use it in GitHub Desktop.
//again, get min/max for our x-axis
var limitBalMinMax = d3.extent(data, function (d) {
return d['LIMIT_BAL'];
});
limitBalDefaultersChart
.width(900)
.height(250)
.dimension(limitDefaultersDim)
.group(limitDefaultersDim.group().reduceSum(dc.pluck('default payment next month')))
.x(d3.scale.linear().domain(limitBalMinMax))
.renderArea(true) //this drops an area under the line chart
.mouseZoomable(true) //allows the graph to be zoomable
.elasticY(true) //free the y-axis! don't do this for X-axis; mouseZoomable(true) will take care of it.
.xAxisLabel('Amount of Credit Given')
.yAxisLabel('People')
.turnOnControls(true)
.controlsUseVisibility(true);
$('#limitBalDefaulters > a').on('click', function (e) {
limitBalDefaultersChart.focus(); //oddly, filterAll() does not reset the zoom, so this does
limitBalDefaultersChart.filterAll();
dc.redrawAll();
e.preventDefault();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment