Hello,
I'm trying to use highcharts with react and not able to make it work. Here is my react ccomponent. Please note I installed highcharts using npm - 'npm install highcharts --save'
import React, { Component } from 'react'
import { findDOMNode } from 'react-dom';
import Highcharts from 'highcharts';
import HighMaps from 'highcharts/highmaps'
import drilldown from 'highcharts/modules/drilldown';
class CustomHighMap extends Component{
componentDidMount() {
// load modules
drilldown(Highcharts);
const options = {
title: {
text: 'Fruit Consumption'
},
plotOptions: {
map: {
states: {
hover: {
color: '#EEDD66'
}
}
}
},
colorAxis: {
min: 0,
minColor: '#E6E7E8',
maxColor: '#005645'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle'
},
subtitle: {
text: 'USA',
floating: true,
align: 'right',
y: 50,
style: {
fontSize: '16px'
}
},
series: [{
data: Highcharts.geojson(Highcharts.maps['https://code.highcharts.com/mapdata/cou ... /us-all.js']),
name: 'USA',
dataLabels: {
enabled: true,
format: '{point.properties.postal-code}'
}
}]
};
this.chart = new Highcharts['Map'](
findDOMNode(this),
options
);
}
componentWillUnmount () {
this.chart.destroy();
}
render() {
return (
<div className="in-highchart"></div>
)
}
}
export default CustomHighMap;
I get this error - 'Cannot read property 'https://code.highcharts.com/mapdata/cou ... /us-all.js' of undefined'. ANy help on pointing to any working example or figure out whats going on. I'm trying to implement a drilldown map with react