score:5
Accepted answer
to answer my own question here, the render function is called after highcharts attempts to look for the div. you can put the chart rendering code in the componentdidmount() section, render the highcharts code directly using dangerouslysetinnerhtml, or set a timer on the highcharts code. to the other answer, the problem with sticking the div tag in my html is that i'm rendering everything else in the jsx and thus want to render my chart from inside my jsx.
score:0
js bin demo
html
<!doctype html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react-dom.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/react-highcharts/11.0.0/reacthighcharts.js"></script>
<meta charset="utf-8">
<title>react-highcharts</title>
</head>
<body>
<div id="container"></div>
</body>
</html>
js part
var config = {
chart: {
type: 'column'
},
title: {
text: 'world\'s largest cities per 2014'
},
subtitle: {
text: 'source: <a href="http://en.wikipedia.org/wiki/list_of_cities_proper_by_population">wikipedia</a>'
},
xaxis: {
type: 'category',
labels: {
rotation: -45,
style: {
fontsize: '13px',
fontfamily: 'verdana, sans-serif'
}
}
},
yaxis: {
min: 0,
title: {
text: 'population (millions)'
}
},
legend: {
enabled: false
},
tooltip: {
pointformat: 'population in 2008: <b>{point.y:.1f} millions</b>'
},
series: [{
name: 'population',
data: [
['shanghai', 23.7],
['lagos', 16.1],
['istanbul', 14.2],
['karachi', 14.0],
['mumbai', 12.5],
['moscow', 12.1],
['são paulo', 11.8],
['beijing', 11.7],
['guangzhou', 11.1],
['delhi', 11.1],
['shenzhen', 10.5],
['seoul', 10.4],
['jakarta', 10.0],
['kinshasa', 9.3],
['tianjin', 9.3],
['tokyo', 9.0],
['cairo', 8.9],
['dhaka', 8.9],
['mexico city', 8.9],
['lima', 8.9]
],
}]
};
reactdom.render(
<reacthighcharts config = {config}/>,
document.getelementbyid('container')
);
Source: stackoverflow.com
Related Query
- creating a bar chart using Highcharts with React - getting an error that rendering div isn't found
- Uncaught Error: Highcharts error #17 while creating sunburst chart using react
- Getting "Highcharts error #17" when creating histogram (using Highcharts with Angular 6)
- Creating depth chart using highcharts and creating bids and asks in such a way that bids and asks are created from center of chart
- Drawing Bubble Chart by using npm highcharts with error #17
- Creating a drilldown chart with Highcharts that contain double(multiple) columns for each column (see example for better explanation)
- Highcharts chart with error bars using react-highcharts
- error with adjusting height of pie chart using highcharts
- dealing with highcharts bar chart with really long category names
- Getting error while using highcharts in Angular 7
- Timeline chart with highcharts using x-range with multiple stacks
- Issues using highcharts node export server from ClojureScript - "0x03 error when performing chart generation"
- Using Trellis Chart with Stacked Columns in Highcharts
- Highcharts - Getting a 3d effect with selected pie chart slices
- Creating negative stacking bar chart with Highcharter(Likert chart)
- How to draw a bubble map with longitude and latitude using Highcharts in react
- Adding round corners to Highcharts Bar Chart with stacked bars when value is 0
- HighCharts Stock Chart error code 18
- Using wkhtmltopdf with highcharts shows blank chart
- Passing in Id for each data item in bar chart using highcharts
- Highcharts bar chart with fixed bar widths and gaps
- Splitted bar chart for paired data with highcharts
- Error while creating the chart using highchart
- How to use Highcharts React to create chart with multiple lines for same XAxis?
- Creating Highcharts with Angular using Highcharts >= 5.0.0 and highcharts-ng >= 1.0.0 using a ChartFactory
- Highcharts - creating chart with same scale axis
- Highcharts vertical stacked bar chart with negative values, is it possible?
- Highcharts - bubble chart with titles at x- and y-Axis - Error #14
- HighCharts - bar chart with indicator
- How can I make milestone lines with a GANTT chart using the highcharts library?
More Query from same tag
- highstock: space between opposite x-axis and range-selector/datepicker
- Highcharts view data table is showing incorrect data
- MySql TimeStamp and JavaScript Time
- Extend Highcharts Export
- highcharts hide the chart except the legend
- the datatime value displayed not correct on highchart
- Preventing a custom piece of text from appearing ON ALL Highcharts present on a page ← piece of text inserted using {events:{load:function(){var
- How to find max: value of colorAxis for highMaps drilldown maps
- Disable a complete bar in highcharts when clicking on its label
- Hicharts.js Boxplots with a mean line
- Highcharts chart not respecting container's width
- Is HighCharts custom marker symbol shape modifiable?
- No results in Highcharts with loading from JSON
- Generating PDFs when JavaScript is being used
- Highstock rangeSelector from days in the future
- Custom colors in R highcharter barplot
- Rotating the highchart
- Highcharts load effect on button click
- Highchart - give to series-marker other zIndex then to the series-lines
- evaluateJavaScript in PyQt - function is not called
- adding click event dynamically created highchart
- How to hide/show a column in a basic column graph of highcharts?
- How to place one highchart on top of another
- Removing and re-adding series while keeping the same markers
- I want to add a line to each column in a Highcharts column chart
- Position events below analog area in Highcharts combined line/timeline chart
- Highcharts, detect if point is first in stack
- HighCharts reading from CSV basic example
- Graph getting hidden while zooming in ( using the zoom scroll bar )
- Highcharts - Cannot display data labels on a spline chart