Skip to content

Commit 92a823f

Browse files
committed
fix scatterternary with ids attribute
1 parent 52975c3 commit 92a823f

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/traces/scatterternary/calc.js

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = function calc(gd, trace) {
1515
var displaySum = ternary.sum;
1616
var normSum = trace.sum || displaySum;
1717
var arrays = {a: trace.a, b: trace.b, c: trace.c};
18+
var ids = trace.ids;
1819

1920
var i, j, dataArray, newArray, fillArray1, fillArray2;
2021

@@ -58,6 +59,9 @@ module.exports = function calc(gd, trace) {
5859
y = a;
5960
x = c - b;
6061
cd[i] = {x: x, y: y, a: a, b: b, c: c};
62+
if (ids) {
63+
cd[i].id = ids[i];
64+
}
6165
} else cd[i] = {x: false, y: false};
6266
}
6367

test/image/mocks/ternary_simple.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"a": [2, 1, 1],
55
"b": [1, 2, 1],
66
"c": [1, 1, 2.12345],
7+
"ids": ["first ID", "second ID", "third ID"],
78
"type": "scatterternary"
89
}
910
],

test/jasmine/tests/select_test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,7 @@ describe('Test select box and lasso per trace:', function() {
20612061
}
20622062

20632063
[false, true].forEach(function(hasCssTransform) {
2064-
it('should work on scatterternary traces, hasCssTransform: ' + hasCssTransform, function(done) {
2064+
fit('should work on scatterternary traces, hasCssTransform: ' + hasCssTransform, function(done) {
20652065
var assertPoints = makeAssertPoints(['a', 'b', 'c']);
20662066
var assertSelectedPoints = makeAssertSelectedPoints();
20672067

@@ -2079,6 +2079,7 @@ describe('Test select box and lasso per trace:', function() {
20792079
function() {
20802080
assertPoints([[0.5, 0.25, 0.25]]);
20812081
assertSelectedPoints({0: [0]});
2082+
expect(selectedData.points[0].id).toBe("first ID")
20822083
},
20832084
[380, 180],
20842085
BOXEVENTS, 'scatterternary select'

0 commit comments

Comments
 (0)