09.09.2022, 08:48
Custom JS code, adjust as needed.
data.lp should be uploaded via FTP using apps login to the user directory.
For this example it simply generates an array of random numbers:
You can also output storage variable that another script creates:
Code:
$(function() {
// load chartist CSS
$('<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chartist/0.11.4/chartist.min.css" type="text/css">').appendTo('head');
// load chartist JS
$.getScript('https://cdnjs.cloudflare.com/ajax/libs/chartist/0.11.4/chartist.min.js', function() {
// create chart container, add it to plan with ID 8
var el = $('<div></div>').css({
position: 'absolute',
width: '400px',
height: '300px',
left: '10px',
top: '50px',
zIndex: 999
}).appendTo('#plan-8');
// load chart data
$.getJSON('/user/data.lp', function(data) {
// create chart
var chart = new Chartist.Line(
el.get(0),
{
labels: [1, 2, 3, 4, 5, 6, 7, 8],
series: [ data ]
},
{
low: 0,
showArea: true
}
);
});
});
});
data.lp should be uploaded via FTP using apps login to the user directory.
For this example it simply generates an array of random numbers:
Code:
<?
math.randomseed(os.time())
data = {}
for i = 1, 8 do
data[ i ] = math.random(0, 10)
end
json.write(data)
You can also output storage variable that another script creates:
Code:
<?
require('apps')
data = storage.get('my_var_name')
json.write(data)