TypeError: _this[("render" + data.type)] is not a function

Viewed 113

enter image description here

This is an error I'm getting in the console. I don't know why I'm getting this moreover I have written the code according to the documentation of Syncfusion library.

Below is the code I have written:

import React from 'react';
import { SparklineComponent, Inject, SparklineTooltip } from '@syncfusion/ej2-react- 
charts';

const Sparkline = ({ id, height, width, color, currentColor, data, type }) => {
    return (
       <SparklineComponent
          id={id}
          height={height}
          width={width}
          lineWidth={1}
          valueType="Numeric"
          fill={color}
          border={{ color: currentColor, width: 2 }}
          dataSource={data}
          xName="x"
          yName="y"
          type={type}
          tooltipSettings={{
              visible: true,
              format: '${x} : data ${y}', //Getting error in this line//
              trackLineSettings: {
                  visible: true
              }
          }}
      >
          <Inject services={[ SparklineTooltip ]} />
      </SparklineComponent>
  );
};

 export default Sparkline;

Below is the screenshot of the documentation and the link to it too.

Documentation ScreenShot

Link to Syncfusion Documentation

1 Answers

I have ensured your reported scenario with the snippet available in provided documentation link. Sparkline control is rendered properly without any exception. Please check with the below sample and screenshot.

Sparkline

Sample : https://stackblitz.com/edit/react-w5tumd

Related