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

focusOnNode is not defined #87

Open
rjortiguero opened this issue Jun 14, 2022 · 2 comments
Open

focusOnNode is not defined #87

rjortiguero opened this issue Jun 14, 2022 · 2 comments

Comments

@rjortiguero
Copy link

HI,

I was trying to override the onClick event for the sunburst chart but upon calling the focusOnNode function I get this error:

focusOnNode is not defined

the snippet:

var systems = Sunburst()
.data(types)
.width(700)
.height(800)
//.minSliceAngle(.4)
.size('size')
.color((function (d, node) {

          if (d.hasOwnProperty('color') && d.color != 'none') {
            
            return d.color;
          }
          else{
            return color(d.name)
          }
          
        }))
        .radiusScaleExponent(1)
        .excludeRoot(true)
        .maxLevels(2)
        .showLabels(true)
        .label((function (d) {
           
            if (d.hasOwnProperty('size') && d.size != null) {
            
            return d.name+": "+d.size;
          }
          else{
            return d.name;
          }
          
        }))
        .onClick(node => {
            this.focusOnNode(node);

            // do other operations with node
        })
        .tooltipContent((d, node) => `Assets: <i>${node.value}</i>`)
        (document.getElementById('system'));

Thank you for your help

@vasturiano
Copy link
Owner

@rjortiguero most likely you'd want to call focusOnNode on your sunburst instance variable, not on this. So

systems.focusOnNode(node)

instead of

this.focusOnNode(node);

@shradha0810
Copy link

It still shows focusOnNode is not a function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants