Skip to content

Commit

Permalink
Merge pull request #3192 from plotly/typed-array-marker-size-legend-fix
Browse files Browse the repository at this point in the history
Fix legend for traces with typed array marker.size
  • Loading branch information
etpinard authored Oct 31, 2018
2 parents 154317b + c326751 commit 458f593
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/legend/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ module.exports = function style(s, gd) {

function boundVal(attrIn, arrayToValFn, bounds) {
var valIn = Lib.nestedProperty(trace, attrIn).get();
var valToBound = (Array.isArray(valIn) && arrayToValFn) ?
var valToBound = (Lib.isArrayOrTypedArray(valIn) && arrayToValFn) ?
arrayToValFn(valIn) :
valIn;

Expand Down
13 changes: 13 additions & 0 deletions test/jasmine/tests/scatter_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,19 @@ describe('end-to-end scatter tests', function() {
['rgb(0, 255, 0)', 'rgb(0, 0, 255)', 'rgb(255, 0, 0)'],
[40, 30, 20]
);

return Plotly.relayout(gd, 'showlegend', true);
})
.then(function() {
_assert(
['rgb(0, 255, 0)', 'rgb(0, 0, 255)', 'rgb(255, 0, 0)'],
[40, 30, 20]
);

var legendPts = d3.select('.legend').selectAll('.scatterpts');
expect(legendPts.size()).toBe(1, '# legend items');
expect(getColor(legendPts.node())).toBe('rgb(0, 0, 0)', 'legend pt color');
expect(getMarkerSize(legendPts.node())).toBe(16, 'legend pt size');
})
.catch(failTest)
.then(done);
Expand Down

0 comments on commit 458f593

Please sign in to comment.