Skip to content

Commit c8d715b

Browse files
committed
emit 'normalized' a/b/c coords in scatterternary event data
- fixup ternary hover event data test accordingly.
1 parent 451778b commit c8d715b

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

src/traces/scatterternary/event_data.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@ module.exports = function eventData(out, pt, trace, cd, pointNumber) {
1515
if(cd[pointNumber]) {
1616
var cdi = cd[pointNumber];
1717

18-
// N.B. These are the scale coordinates !!!
19-
//
20-
// On master, hover events get the non-scaled coordinates
21-
// whereas selection events get the scaled version.
22-
// Note also that the hover labels show the scaled version.
23-
//
24-
// What about the 'raw' input coordinates?
25-
// Should we include them in parallel here or replace a/b/c with them?
18+
// N.B. These are the normalized coordinates.
2619
out.a = cdi.a;
2720
out.b = cdi.b;
2821
out.c = cdi.c;

test/jasmine/tests/ternary_test.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,9 @@ describe('Test event property of interactions on a ternary plot:', function() {
501501
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
502502
expect(typeof pt.xaxis).toEqual(typeof {}, 'points[0].xaxis');
503503
expect(typeof pt.yaxis).toEqual(typeof {}, 'points[0].yaxis');
504-
expect(pt.a).toEqual(2, 'points[0].a');
505-
expect(pt.b).toEqual(1, 'points[0].b');
506-
expect(pt.c).toEqual(1, 'points[0].c');
504+
expect(pt.a).toEqual(0.5, 'points[0].a');
505+
expect(pt.b).toEqual(0.25, 'points[0].b');
506+
expect(pt.c).toEqual(0.25, 'points[0].c');
507507

508508
expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
509509
expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');
@@ -549,9 +549,9 @@ describe('Test event property of interactions on a ternary plot:', function() {
549549
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
550550
expect(typeof pt.xaxis).toEqual(typeof {}, 'points[0].xaxis');
551551
expect(typeof pt.yaxis).toEqual(typeof {}, 'points[0].yaxis');
552-
expect(pt.a).toEqual(2, 'points[0].a');
553-
expect(pt.b).toEqual(1, 'points[0].b');
554-
expect(pt.c).toEqual(1, 'points[0].c');
552+
expect(pt.a).toEqual(0.5, 'points[0].a');
553+
expect(pt.b).toEqual(0.25, 'points[0].b');
554+
expect(pt.c).toEqual(0.25, 'points[0].c');
555555

556556
expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
557557
expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');
@@ -594,9 +594,9 @@ describe('Test event property of interactions on a ternary plot:', function() {
594594
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
595595
expect(typeof pt.xaxis).toEqual(typeof {}, 'points[0].xaxis');
596596
expect(typeof pt.yaxis).toEqual(typeof {}, 'points[0].yaxis');
597-
expect(pt.a).toEqual(2, 'points[0].a');
598-
expect(pt.b).toEqual(1, 'points[0].b');
599-
expect(pt.c).toEqual(1, 'points[0].c');
597+
expect(pt.a).toEqual(0.5, 'points[0].a');
598+
expect(pt.b).toEqual(0.25, 'points[0].b');
599+
expect(pt.c).toEqual(0.25, 'points[0].c');
600600

601601
expect(xaxes0).toEqual(pt.xaxis, 'xaxes[0]');
602602
expect(xvals0).toEqual(-0.0016654247744483342, 'xaxes[0]');
@@ -638,9 +638,9 @@ describe('Test event property of interactions on a ternary plot:', function() {
638638
expect(pt.pointNumber).toEqual(0, 'points[0].pointNumber');
639639
expect(typeof pt.xaxis).toEqual(typeof {}, 'points[0].xaxis');
640640
expect(typeof pt.yaxis).toEqual(typeof {}, 'points[0].yaxis');
641-
expect(pt.a).toEqual(2, 'points[0].a');
642-
expect(pt.b).toEqual(1, 'points[0].b');
643-
expect(pt.c).toEqual(1, 'points[0].c');
641+
expect(pt.a).toEqual(0.5, 'points[0].a');
642+
expect(pt.b).toEqual(0.25, 'points[0].b');
643+
expect(pt.c).toEqual(0.25, 'points[0].c');
644644

645645
expect(evt.clientX).toEqual(pointPos[0], 'event.clientX');
646646
expect(evt.clientY).toEqual(pointPos[1], 'event.clientY');

0 commit comments

Comments
 (0)