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

Get events working on X3DOM Scatterplot #185

Open
emipgit opened this issue Jan 27, 2021 · 1 comment
Open

Get events working on X3DOM Scatterplot #185

emipgit opened this issue Jan 27, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@emipgit
Copy link

emipgit commented Jan 27, 2021

In the scatterplot chart example for 3xdom an event handler is defined for the onclick, onmouseover and onmouseout events. The event handler is not executed because:

  1.  In the componentBubbles no event listener is attached to a bubble
    
  2.  In  chartScatterplot the data structure passed to the event handler is different from the one required by the component to which  data must be  passed (componentCrosshair for the onclick event and componetLabel for the mouseover).
    

I could execute the event handler:

  1.  In componentBubbles I selected the “Shape” elements and attached them the event listener: attachEventListners(shapeSelection)
    
  2.  In chartScatterplot I used the mappings function to read each data field and then I created a new  data  with a structure used by  componentCrosshair and componentLabel
    

var d1= d3.select(e.target).datum();

   var colorVal = d1.values.find(function (v) {
        return v.key === mappings.color;
      }).value;
   var xVal = d1.values.find(function (v) {
          return v.key === mappings.x;
        }).value;
   var yVal = d1.values.find(function (v) {
          return v.key === mappings.y;
        }).value;
   var zVal = d1.values.find(function (v) {
          return v.key === mappings.z;
        }).value;

   var d = {key:d1.key,value:colorVal,x:xVal,y:yVal,z:zVal}
@jamesleesaunders
Copy link
Owner

Hi,
Thank you for raising this. As you have probably noticed the events code in d3-x3d is very much WIP.
I would very much welcome any contributions in this area :-)
You will see I have tried to put all events code in events.js if any help for you.

Thanks,
Jim

@jamesleesaunders jamesleesaunders added the enhancement New feature or request label Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants