I had included the jQuery_1.8.2 js file and then included this code but iam getting the error..
TypeError: $(...).highcharts is not a function [Break On This Error]
data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
i just created a div with id container ..where i went wrong..any order of placing js files wrong..?How to resolve this issue..?
<script>
buildHighCharts();
function buildHighCharts(){
$('#container').highcharts({
chart: {
type: 'line',
marginRight: 130,
marginBottom: 25
},
title: {
text: 'Monthly Average Temperature',
x: -20 //center
},
subtitle: {
text: 'Source: WorldClimate.com',
x: -20
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
text: 'Temperature (°C)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '°C'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
series: [{
name: 'Tokyo',
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
}, {
name: 'London',
data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
}]
});
}
</script>
<script type="text/javascript" src="js/highcharts1/highcharts-2.3.5.js"></script>
<script type="text/javascript" src="js/highcharts1/modules/exporting-2.3.5.js"></script>
any order of placing js files wrong..?
Yes. Your highcharts setup code needs to come after the script tags that loads the highcharts library.
<script type="text/javascript" src="js/highcharts1/highcharts-2.3.5.js"></script>
<script type="text/javascript" src="js/highcharts1/modules/exporting-2.3.5.js"></script>
<script>
function buildHighCharts(){ ... }
</script>
You are using highcharts before you added it to the page. The includes need to come before!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With