%%html
<script src="https://code.highcharts.com/highcharts.js"></script>
%%html
<div id="container" style="width:100%; height:400px;"></div>
%%javascript
/*
.ipynb ファイルを開き直したときに次のエラーになる。
Javascript error adding output!
ReferenceError: Highcharts is not defined
See your browser Javascript console for more details.
*/
/*
$(function () {
var myChart = Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: 'Fruit Consumption'
},
xAxis: {
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: {
title: {
text: 'Fruit eaten'
}
},
series: [{
name: 'Jane',
data: [1, 0, 4]
}, {
name: 'John',
data: [5, 7, 3]
}]
});
});
*/
%%javascript
console.log($.fn.jquery);
// 2.2.4
%%javascript
const plot = () => {
if (document.readyState !== 'complete' ||
typeof Highcharts !== 'object' ||
typeof Highcharts.chart !== 'function') {
const timeoutID = setTimeout(plot, 1000);
return {};
}
var myChart = Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: 'Fruit Consumption'
},
xAxis: {
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: {
title: {
text: 'Fruit eaten'
}
},
series: [{
name: 'Jane',
data: [1, 0, 4]
}, {
name: 'John',
data: [5, 7, 3]
}]
});
return myChart;
};
plot();