This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

PVPC trend graph in visu
#5
Custom JS code, adjust as needed.
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)
Reply


Messages In This Thread
PVPC trend graph in visu - by JRP - 26.08.2022, 10:45
RE: PVPC trend graph in visu - by JRP - 08.09.2022, 10:55
RE: PVPC trend graph in visu - by admin - 08.09.2022, 11:55
RE: PVPC trend graph in visu - by JRP - 08.09.2022, 16:15
RE: PVPC trend graph in visu - by admin - 09.09.2022, 08:48
RE: PVPC trend graph in visu - by JRP - 09.09.2022, 18:03
RE: PVPC trend graph in visu - by admin - 12.09.2022, 09:43
RE: PVPC trend graph in visu - by JRP - 13.09.2022, 18:51
RE: PVPC trend graph in visu - by admin - 14.09.2022, 06:47
RE: PVPC trend graph in visu - by JRP - 14.09.2022, 16:24
RE: PVPC trend graph in visu - by admin - 15.09.2022, 07:15
RE: PVPC trend graph in visu - by JRP - 16.09.2022, 08:41
RE: PVPC trend graph in visu - by JRP - 21.09.2022, 08:36
RE: PVPC trend graph in visu - by admin - 21.09.2022, 08:42
RE: PVPC trend graph in visu - by JRP - 22.09.2022, 18:02
RE: PVPC trend graph in visu - by JRP - 23.09.2022, 10:43
RE: PVPC trend graph in visu - by admin - 23.09.2022, 11:05
RE: PVPC trend graph in visu - by JRP - 23.09.2022, 11:47
RE: PVPC trend graph in visu - by admin - 23.09.2022, 11:50
RE: PVPC trend graph in visu - by JRP - 23.09.2022, 12:09
RE: PVPC trend graph in visu - by admin - 23.09.2022, 12:12
RE: PVPC trend graph in visu - by JRP - 23.09.2022, 12:52
RE: PVPC trend graph in visu - by JRP - 24.09.2022, 11:24
RE: PVPC trend graph in visu - by JRP - 03.10.2022, 09:53
RE: PVPC trend graph in visu - by Daniel - 03.10.2022, 10:07
RE: PVPC trend graph in visu - by JRP - 03.10.2022, 10:35
RE: PVPC trend graph in visu - by admin - 03.10.2022, 13:10
RE: PVPC trend graph in visu - by JRP - 06.10.2022, 17:16
RE: PVPC trend graph in visu - by admin - 07.10.2022, 05:36
RE: PVPC trend graph in visu - by JRP - 16.10.2022, 17:25
RE: PVPC trend graph in visu - by JRP - 18.10.2022, 07:30
RE: PVPC trend graph in visu - by admin - 18.10.2022, 09:31
RE: PVPC trend graph in visu - by JRP - 18.10.2022, 17:30
RE: PVPC trend graph in visu - by JRP - 19.10.2022, 07:41
RE: PVPC trend graph in visu - by admin - 19.10.2022, 07:42
RE: PVPC trend graph in visu - by JRP - 20.10.2022, 18:11
RE: PVPC trend graph in visu - by icuzz - 14.02.2024, 16:43
RE: PVPC trend graph in visu - by admin - 15.02.2024, 08:05
RE: PVPC trend graph in visu - by icuzz - 16.02.2024, 05:20
RE: PVPC trend graph in visu - by admin - 16.02.2024, 07:21
RE: PVPC trend graph in visu - by icuzz - 17.02.2024, 18:18
RE: PVPC trend graph in visu - by admin - 19.02.2024, 06:01
RE: PVPC trend graph in visu - by icuzz - 20.02.2024, 07:21
RE: PVPC trend graph in visu - by icuzz - 01.03.2024, 04:21

Forum Jump: