Manoj
Manoj

Reputation: 47

react-chartjs gives back a type error : (intermediate value)[chartType] is not a function

when i run the server..this component is loaded ...no errors found on server side...but browser console gives back a following error :

Uncaught TypeError: (intermediate value)[chartType] is not a function

my code is as follows :

var React = require('react');
var ReactDOM = require('react-dom');
var chart = require('chart.js');
var DoughnutChart = require("react-chartjs").Doughnut;
var Tempvshum = React.createClass({
  render() {
    var chartOptions = {
    segmentShowStroke : true
  };
var chartData = [{
    value: 300,
    color:"#F7464A",
    highlight: "#FF5A5E",
    label: "Red"
  }];
   return(<DoughnutChart data={chartData} options={chartOptions} />);
   }
  });
module.exports = Tempvshum;

Upvotes: 2

Views: 2927

Answers (1)

pveglia
pveglia

Reputation: 76

I think the issue is related to chart.js.

https://www.npmjs.com/package/chart.js says that the package has been uploaded 2 days ago and it is now in version 2.0.0-beta2. I modified my package.json to use the older version 1.1.1 and everything works.

Upvotes: 5

Related Questions