From 92a823f097a3e2014ff45628dd863d337eb99924 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Fri, 20 Sep 2024 16:07:32 -0400 Subject: [PATCH 1/3] fix scatterternary with ids attribute --- src/traces/scatterternary/calc.js | 4 ++++ test/image/mocks/ternary_simple.json | 1 + test/jasmine/tests/select_test.js | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/traces/scatterternary/calc.js b/src/traces/scatterternary/calc.js index c41bcde6584..88ba05212b3 100644 --- a/src/traces/scatterternary/calc.js +++ b/src/traces/scatterternary/calc.js @@ -15,6 +15,7 @@ module.exports = function calc(gd, trace) { var displaySum = ternary.sum; var normSum = trace.sum || displaySum; var arrays = {a: trace.a, b: trace.b, c: trace.c}; + var ids = trace.ids; var i, j, dataArray, newArray, fillArray1, fillArray2; @@ -58,6 +59,9 @@ module.exports = function calc(gd, trace) { y = a; x = c - b; cd[i] = {x: x, y: y, a: a, b: b, c: c}; + if (ids) { + cd[i].id = ids[i]; + } } else cd[i] = {x: false, y: false}; } diff --git a/test/image/mocks/ternary_simple.json b/test/image/mocks/ternary_simple.json index 21920c2c186..5683b92458f 100644 --- a/test/image/mocks/ternary_simple.json +++ b/test/image/mocks/ternary_simple.json @@ -4,6 +4,7 @@ "a": [2, 1, 1], "b": [1, 2, 1], "c": [1, 1, 2.12345], + "ids": ["first ID", "second ID", "third ID"], "type": "scatterternary" } ], diff --git a/test/jasmine/tests/select_test.js b/test/jasmine/tests/select_test.js index e7c8fcdfd40..2e127f9a233 100644 --- a/test/jasmine/tests/select_test.js +++ b/test/jasmine/tests/select_test.js @@ -2061,7 +2061,7 @@ describe('Test select box and lasso per trace:', function() { } [false, true].forEach(function(hasCssTransform) { - it('should work on scatterternary traces, hasCssTransform: ' + hasCssTransform, function(done) { + fit('should work on scatterternary traces, hasCssTransform: ' + hasCssTransform, function(done) { var assertPoints = makeAssertPoints(['a', 'b', 'c']); var assertSelectedPoints = makeAssertSelectedPoints(); @@ -2079,6 +2079,7 @@ describe('Test select box and lasso per trace:', function() { function() { assertPoints([[0.5, 0.25, 0.25]]); assertSelectedPoints({0: [0]}); + expect(selectedData.points[0].id).toBe("first ID") }, [380, 180], BOXEVENTS, 'scatterternary select' From 573c060c9004148ddff5d2f03b4df9934489c5db Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Fri, 20 Sep 2024 16:20:42 -0400 Subject: [PATCH 2/3] changelog for 7167, and remove errant `fit` in test --- draftlogs/7167_fix.md | 1 + test/jasmine/tests/select_test.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 draftlogs/7167_fix.md diff --git a/draftlogs/7167_fix.md b/draftlogs/7167_fix.md new file mode 100644 index 00000000000..28059a439eb --- /dev/null +++ b/draftlogs/7167_fix.md @@ -0,0 +1 @@ +- Render scatterternary traces correctly if they have the `ids` attribute [[#7164](https://github.com/plotly/plotly.js/pull/7164)] diff --git a/test/jasmine/tests/select_test.js b/test/jasmine/tests/select_test.js index 2e127f9a233..12a4aecf67e 100644 --- a/test/jasmine/tests/select_test.js +++ b/test/jasmine/tests/select_test.js @@ -2061,7 +2061,7 @@ describe('Test select box and lasso per trace:', function() { } [false, true].forEach(function(hasCssTransform) { - fit('should work on scatterternary traces, hasCssTransform: ' + hasCssTransform, function(done) { + it('should work on scatterternary traces, hasCssTransform: ' + hasCssTransform, function(done) { var assertPoints = makeAssertPoints(['a', 'b', 'c']); var assertSelectedPoints = makeAssertSelectedPoints(); From e7b519be731ff25a6fe39828f677db2d159d778c Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Fri, 20 Sep 2024 16:52:57 -0400 Subject: [PATCH 3/3] fix other interaction tests --- test/jasmine/tests/ternary_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jasmine/tests/ternary_test.js b/test/jasmine/tests/ternary_test.js index 05777a80d5c..c36049f8d92 100644 --- a/test/jasmine/tests/ternary_test.js +++ b/test/jasmine/tests/ternary_test.js @@ -21,7 +21,7 @@ var assertHoverLabelContent = customAssertions.assertHoverLabelContent; var SORTED_EVENT_KEYS = [ 'data', 'fullData', 'curveNumber', 'pointNumber', 'pointIndex', - 'xaxis', 'yaxis', 'a', 'b', 'c', + 'xaxis', 'yaxis', 'a', 'b', 'c', 'id', 'bbox' ].sort();