Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fire perspective-config-update event on D3FC legend and axis events #1748

Merged
merged 3 commits into from
Mar 9, 2022

Conversation

texodus
Copy link
Member

@texodus texodus commented Mar 9, 2022

Rebased and fixed-up version of #1732. Fixes #1729. Changes from #1732

  • For the legend-position event, I've changed this from drag to end. For many apps which use <perspective-viewer>, the operations which listen for the perspective-config-update event may be relatively expensive, e.g. sending an event to a server, so we want to generally conserve these to applicable changes. With this change, only 1 event is triggered when the drag operation completes, as opposed to 100s while the legend is moved.
  • There is a cross-platform instability in scatter.html and treemap.html I think was introduced in Virtual column selector #1722 - this PR does not modify these results (as validated in the reference HTML and PNG output I have from previous runs), so these results.json changes are reverted.
  • The 2nd test is incorrect - it does not await .restore(), then clicks on the parent element of the axis label which has the click event listener. The result is, the event for the axis switch is not fired, but the .restore() methods which is not awaited sometimes does, causing this test to flake. Fixed by await-ing restore() and changing the click selector to pick the label itself.
  ● events.html › perspective-config-update event is fired when series axis is changed

    Node is either not clickable or not an HTMLElement

      59 |                         )
      60 |                     ).asElement();
    > 61 |                     await axisLabel.click(axisLabel);
         |                     ^
      62 |
      63 |                     const count = await page.evaluate(async (viewer) => {
      64 |                         // Await the plugin rendering

@texodus texodus added the bug Concrete, reproducible bugs label Mar 9, 2022

pinned = unpinNodeFromTopRight(node, pinned);
drag.on("end", function (event) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for making this update. It did cross my mind that we probably want to fire the event after the user stops updating the position, but wasn't 100% sure how to do that here.

// Await the table load
await viewer.getTable();

viewer.restore({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
viewer.restore({
await viewer.restore({

Good catch on the test above. Probably want to do the same here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this was more nefarious than it appears - turns out that this test had a similar issue, mouse.down() was called to initiate the drag in the test, but not mouse.up() which fires the drag end event. The test "worked" by asserting the perspective-config-update which was fired by restore().

@@ -125,6 +125,7 @@ utils.with_server({}, () => {
await page.mouse.move(start.x, start.y);
await page.mouse.down();
await page.mouse.move(target.x, target.y);
await page.mouse.up();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d'oh

@texodus texodus merged commit b267908 into master Mar 9, 2022
@texodus texodus deleted the d3fc-events branch March 9, 2022 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Concrete, reproducible bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fire perspective-config-update on axis switch for multi-axis charts
2 participants