Эта функция Highcharts JS работает отлично (часть HTML здесь не указана):
<html>
<head>
<title>Highcharts Chart with HTML Data</title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script type="text/javascript">
$(function(mychart) {
Highcharts.chart('container', {
data: {
table: document.getElementById('datatable'),
startRow: 0,
endRow: 10
},
chart: {
type: 'spline'
},
xAxis: {
type: 'category'
},
title: {
text: 'Tides for: Cundy Harbor, New Meadows River, Casco Bay, Maine'
},
yAxis: {
title: {
text: 'Height of tide<br>in feet.'
},
gridLineColor: '#197F07',
gridLineWidth: 0,
lineWidth:1,
plotLines: [{
color: '#FF0000',
width: 1,
value: 0
}]
},
tooltip: {
formatter: function() {
return '<b>' + this.series.name + '</b><br>' +
this.point.y + ' ft.<br>' + this.point.name;
}
}
});
});
</script>
</head>
Что я хотел бы сделать, это поместить функцию JS в отдельный файл (ту же папку) и вызвать ее в<head>
моей страницы хай-чартов. Я создал отдельный файл под названием мой chart.js, содержащий эту функцию. Как мне вызвать этот файл, когда загружается главная страница старших графиков?