Public
Edited
Nov 30, 2023
Insert cell
Insert cell
html`<div id='div_highcharts' style='height:600px; width:600px;'></div>`
Insert cell
chart(randi(7,15),randi(10,24),12)
Insert cell
function randi(min,max){
return Math.floor(Math.random()*(max-min+1))+min;}
Insert cell
function ar(k,a,b){var d=.01,m=640;
return Array(m).fill(k).map((k,t)=>
[k*(Math.cos(d*t)+Math.cos(a*d*t)/2+
Math.sin((a+b)*d*t)/3),
k*(Math.sin(d*t)+Math.sin(a*d*t)/2+
Math.cos((a+b)*d*t)/3)]);}
Insert cell
function col(i){
var r=randi(10*i,255),
g=randi(10*i,255),
b=randi(10*i,255);
return 'rgb('+r+','+g+','+b+')';}
Insert cell
chart=function(a,b,n) {
const series=[];
for (var i=1; i<n+1; i++){
series.push({name:'k='+i,color:col(i),lineWidth:1,
dashStyle:'longdash',data:ar(i,a,b)})};
return Highcharts.chart('div_highcharts',{
chart:{type:'line',backgroundColor:'mintcream'},
xAxis:{title:{text:'x'}},yAxis:{title:{text:'y'}},
title:{text:'Random Parameters: a,b = '+[a,b]},
credits:{enabled:false},legend:{enabled:false},
series:series}) }
Insert cell
$=require('https://code.jquery.com/jquery-3.5.1.js')
Insert cell
Insert cell
import_css=function(src) {
$('head').append(`<link rel='stylesheet' href='${src}'>`)}
Insert cell
import_css('https://code.highcharts.com/css/highcharts.css')
Insert cell
import_js=function(src,module_name) {
/*if (!$('head').find(`script[src='${src}']`)) {
$('head').append(`<script src='${src}'></script>`);
}*/
return new Promise(function(resolve,reject) {
function waiting(){
if (typeof module_name=='undefined') resolve();
if (eval(module_name)) resolve(eval(module_name));
setTimeout(waiting,30);};
require(src).then(function() {waiting();})
.catch(function() {waiting();}); }); }
Insert cell
Highcharts = require('https://bundle.run/highcharts@7.0.2')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more