personality-insights / sunburst-chart

A visualization for IBM Watson Personality Insights service output.
https://personality-insights.github.io/sunburst-chart/
Apache License 2.0
43 stars 37 forks source link

Cannot set property 'singleArc' of undefined #18

Closed adamgins closed 6 years ago

adamgins commented 7 years ago

Hi there,

I did have the issue of #17 but adding the # to the selector fixed that.

I now have the following issue, which related to d3 but cannot see anything similar in their issues...

TypeError: Cannot set property 'singleArc' of undefined
    at setupD3 (modules.js?hash=b610b31…:18632)
    at Object.setupAndRender (modules.js?hash=b610b31…:18636)
    at PersonalitySunburstChart.show (modules.js?hash=b610b31…:18016)
    at Blaze.View.<anonymous> (app.js?hash=d456a3f…:6892)
    at blaze.js?hash=983d07a…:1875
    at Function.Template._withTemplateInstanceFunc (blaze.js?hash=983d07a…:3687)
    at blaze.js?hash=983d07a…:1873
    at Object.Blaze._withCurrentView (blaze.js?hash=983d07a…:2214)
    at viewAutorun (blaze.js?hash=983d07a…:1872)
    at Tracker.Computation._compute (tracker.js?hash=9f8a0ce…:339)

Looks like a couple of spots... this is how I am calling it...

var chart = new PersonalitySunburstChart({
            'selector': '#sunburstChart', 'version': 'v3'
        });
        chart.show(currentField.value.personalityProfile);

Looks like https://github.com/personality-insights/sunburst-chart/blob/6ebc228b612ba3c2e4fdb1acc61f2c8092f4d5a9/lib/personality-chart-renderer.js#L592

I have the following script file in my header <script src="https://d3js.org/d3.v4.min.js"></script>

Any ideas pls?

thanks

adamgins commented 7 years ago

I got it to work, I changed the d3 library to the one in the example, not the one recommended on the d3 web site.

That said my visualization in grayscale, not colour... is there some param for colour?

dangreenisrael commented 7 years ago

This should be fixed with the latest update.

germanattanasio commented 6 years ago

This is related to the version of d3 you are using. This library doesn't work with D3 v4.

If you are using v4 then d3.svg is undefined so d3.svg. singleArc will throw TypeError: Cannot set property 'singleArc' of undefined

See https://keithpblog.org/post/upgrading-d3-from-v3-to-v4/