
Good morning,
I’m experimenting with BokehJS because the static document I built with Bokeh might be easier to maintain if I skipped python altogether. I created a hybrid of ajax_source.py with the ‘Minimal Complete Example’ at the bottom of Developing with JavaScript to test. Here’s my complete rewrite of lines 8-20 and 27 of ajax_source.py in JavaScript. I’m either doing something wrong or the Bokeh.Plotting API doesn’t behave like bokeh.plotting in this case. The BokehJS version only prints the first circle and doesn’t append subsequent ones.
Thanks for taking a look,
Jan
<**html ****lang=****"en"**><head>
<meta charset="UTF-8">
<title>Ajax Source</title>
<**link rel="stylesheet" href="css/bokeh.min.css" type="text/css" **/>
<script src="js/bokeh.js"></script>
<script src="js/bokeh-api.js"></script>
</head>
<body>
<script>
**const *****source ***= **new **Bokeh.AjaxDataSource({data_url: “http://localhost:5050/data”, polling_interval: 100, mode: “append”});
**const *****p ***= Bokeh.Plotting.figure({height: 300, width: 800,
background_fill_color: “lightgrey”, title: “Streaming Noisy sin(x) via Ajax”});
p.circle({field: ‘x’}, {field: ‘y’}, {source: source});
p.x_range.**follow **= “end”;
p.x_range.**follow_interval **= 10;
Bokeh.Plotting.show(p, document.currentScript.parentElement)
</script>
</body>
</html>
