I am working on react application where I have used react google charts for displaying Line chart with annotation. But I am getting an issue with role attribute for column in Line chart, have already imported react-google-charts in the working component. Below is my code:
Home.tsx > component
import * as React from 'react';
import { Chart } from 'react-google-charts';
import GoogleDataTableColumnRoleType from 'react-google-charts/dist/types';
export class Home extends React.Component<IChildComponentProps,AddDataState> {
constructor(props) {
super(props);
public render() {
<div id="chart_div2">
<Chart
width={400}
height={'300px'}
chartType="LineChart"
loader={<div>Loading Chart</div>}
rows={this.state.o3TargetChart}
columns={[
{
type: "string",
label: "Week"
},
{
type: "number",
label: "O3Done"
},
{
type: "string",
role: GoogleDataTableColumnRoleType.annotation // getting error here
},
{
type: "number",
label: "Target"
}
]}
options={{
title: '',
hAxis: {
title: 'Week', titleTextStyle: {
},
baselineColor: '#cccccc'
},
vAxis: {
title: 'O3 Coverage ( in %)', minValue: 0, maxValue: 100, titleTextStyle: {
},
baselineColor: '#cccccc',
},
pointsVisible: true,
chartArea: {
left: 100
},
height: 400,
width: 1000,
}}
/>
</div>
}
}
Although I can find the type module under node_modules directory as below:
node_modules\react-google-charts\dist\types.d.ts
Have already added below code in webpack.config.js file as suggested by others:
resolve: {
extensions: ['', '.js', '.jsx']
},
Still I am getting module not found error. Please suggest..