jakezatecky/d3-funnel

Chart not rendering on React

Deniscapp opened this issue · 1 comments

I am trying to use d3-funnel with react but it didn't work so far.
I have a div:

<div style={{ height: 400, width: 400 }} id="funnel"></div>

on componentDidMount:


  componentDidMount() {
    const data = [
      { label: 'Inquiries', value: 5000 },
      { label: 'Applicants', value: 2500 },
      { label: 'Admits', value: 500 },
      { label: 'Deposits', value: 200 },
    ];
    const options = {
      chart: {
        height: 400,
        width: 400,
    },
        block: {
            dynamicHeight: true,
            minHeight: 15,
        },
    };

    const chart = new D3Funnel('#funnel');
    chart.draw(data, options);
  }

I end up with an empty div with the right height and width, but nothing in there.
Any help on this?
Thanks in advance! :)

Sorry, my bad. It worked! 😄