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
#7
What does you user.lp return? It must be a valid JSON array with up to 24 numbers.
I've modified the example to handle resizing when plan changes. It fixed the issue when chart is not rendered correctly on a plan that is not visible when rendering happens.
Code:
$(function() {
  $('<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chartist/0.11.4/chartist.min.css" type="text/css">').appendTo('head');

  $.getScript('https://cdnjs.cloudflare.com/ajax/libs/chartist/0.11.4/chartist.min.js', function() {
    var el = $('<div></div>').css({
      position: 'absolute',
      width: '600px',
      height: '300px',
      left: '10px',
      top: '50px',
      zIndex: 999
    }).appendTo('#plan-8');

    $.getJSON('/user/data.lp', function(data) {
      var labels = [];
      
      for (var i = 0; i < 24; i++) {
        var label = '';
        
        if ((i % 3) == 0) {
          label = i + ':00';
        }
        
        labels.push(label);
      }
      
      var chart = new Chartist.Line(
        el.get(0),
        {
          labels: labels,
          series: [ data ]
        },
        {
          low: 0,
          showArea: true
        }  
      );
      
      $('body').on('showplan', function() {
        chart.resizeListener();
      });
    });
  });
});
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: