0

I am trying to implement this chart in my project

See the Codepen

In my React application i have created this component called ChartsGrid where i am importing LineChart from './d3/LineChart' with his subcomponents HorizontalAxis, VerticalAxis and LinePlot

The state of the data is built correctly, i see it in the console

import React from 'react';
import Chart from './Chart';
import LineChart from './d3/LineChart';

export default class ChartsGrid extends React.Component{

  render() {

    const view = [480, 320];
    const trbl = [0, 0, 0, 0]
    const horizontalAxisHeight = 30;
    const verticalAxisWidth = 42;
    const { data } = this.props;

    return (
      <div className="grid">
          <LineChart {...{view, trbl, data, horizontalAxisHeight, verticalAxisWidth}} />
      </div>
    )
  }
};

i am getting this error in the console

enter image description here

It is complaining of my render method in ChartsGrid and i do not really understand what can be wrong. All the settings up seems fine to me, in the previous codepen example the only difference is that it is rendering the linechart data in setTimeout function.

What am i doing potentially wrong here?

1 Answer 1

2

Add a console.log('!!!!', LineChart) and see if it is defined. Maybe you made a mistake importing/exporting

Sign up to request clarification or add additional context in comments.

1 Comment

Yep, import/export mismatches are the most common reason for this error. Given that <LineChart> is the only other thing being rendered, odds are it's not being imported properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.