Skip to content

Commit

Permalink
reasonable default for scatter plot titles
Browse files Browse the repository at this point in the history
ref #1200
  • Loading branch information
gordonwoodhull committed Dec 23, 2016
1 parent dae8c84 commit e1a1211
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 1 addition & 7 deletions spec/scatter-plot-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ describe('dc.scatterPlot', function () {
.emptySize(4)
.emptyOpacity(0.5)
.emptyColor('#DFFF00')
.transitionDuration(0)
.title(function (d) {
// because of the yucky way scatterPlot sets its own key/value accessors
// perhaps this should be defaulted within the scatter plot
return chart.keyAccessor()(d) + ',' + chart.valueAccessor()(d) + ': ' +
chart.existenceAccessor()(d);
});
.transitionDuration(0);
});

describe('rendering the scatter plot', function () {
Expand Down
7 changes: 7 additions & 0 deletions src/scatter-plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ dc.scatterPlot = function (parent, chartGroup) {
_chart.valueAccessor(function (d) { return originalKeyAccessor(d)[1]; });
_chart.colorAccessor(function () { return _chart._groupName; });

_chart.title(function (d) {
// this basically just counteracts the setting of its own key/value accessors
// see https://github.com/dc-js/dc.js/issues/702
return _chart.keyAccessor()(d) + ',' + _chart.valueAccessor()(d) + ': ' +
_chart.existenceAccessor()(d);
});

var _locator = function (d) {
return 'translate(' + _chart.x()(_chart.keyAccessor()(d)) + ',' +
_chart.y()(_chart.valueAccessor()(d)) + ')';
Expand Down

0 comments on commit e1a1211

Please sign in to comment.