I try to write HTML widget with JavaScript code in the Dashboard. The data from the thing
can be used in the HTML by inserting the next code {{value}}
into some HTML tag body.
But, I cannot use it in the JavaScript block .
Pure HTML widget:
For example use in the HTML widget:
<h1>Millis data</h1>
<p>Millis value is </p><b>{{value}}</b>
Widget with JavaScript block (don’t work as needed):
I tried to use the same data for plotting (Plotly example).
I can use in the HTML tag id=data
, but, I don’t know how to use this data in the JavaScript block.
My try:
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<div id="data" value={{value}}>Data - {{value}}</div>
<div id="tester" style="width:900px;height:300px;"></div>
<script>
TESTER = document.getElementById('tester');
Plotly.newPlot( TESTER, [{
x: [1, 2, 3, 4, 5],
y: [1, 2, 4, 8, 16] }], {
margin: { t: 0 } } );
</script>
- The data x and y are hard coded for example only.