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.

chartist to display nice pie...
#5
thank you so much for the help !

After working on your solution, i change two point and it's better, but still little difference before/after GA event

-------------

//instantane pie
$(function(){
    var chart={};

    grp.listen('20/3/200', function(obj, type) {

    var classImage ='pie1';
    var idChart ='chart1';
    const variableCourbes = ["20/3/0", "20/3/1", "20/3/2", "20/3/3", "20/3/4"];
    const hauteur='200px';
    const largeur='200px';
   
    var labelTab = [];
    var serieTab = [];
    var separateurNom = ' '
   
    for (let i = 0; i < variableCourbes.length; i++) {
      var id = Scada.encodeGroupAddress(variableCourbes[i]);
      var obj = objectStore.getObject(id);
      var nom = obj.name.split(separateurNom)[0]
     
      labelTab.push(nom +'-'+ obj.value + 'W');
      serieTab.push(obj.value);
    }
   
    var data = {
      labels: labelTab,
      series: serieTab
    };
    var options = {
      width: largeur,
      height: hauteur,
      donut: true,
      donutWidth: 50,
      donutSolid: true,
      startAngle: 270,
      showLabel: true
    };

    var plans = $('.' + classImage)[0];

    if (chart[idChart]) {
      chart[idChart].update(data);
    }
    else {
      plans.innerHTML = '';
      chart[idChart] = new Chartist.Pie('.'+classImage, data, options);
    }

    var transform = chart[idChart].container.parentElement.style.transform;
    var scale = parseFloat(transform.replace('scale(', '').replace(')', ''))+0.16;
     
    if (!isNaN(scale)) {
      chart[idChart].container.style.transform = 'scale(' + (1 / scale) + ')';
    }
  }, true);
});
-----------
FRANCE SMARTHOME & SMARTBUILDING INTEGRATION
SE ECO EXPERT
Reply


Messages In This Thread
chartist to display nice pie... - by domotiqa - 05.01.2022, 08:56
RE: chartist to display nice pie... - by jmir - 14.02.2022, 11:32
RE: chartist to display nice pie... - by domotiqa - 06.01.2022, 05:59
RE: chartist to display nice pie... - by jmir - 14.02.2022, 13:34
RE: chartist to display nice pie... - by jmir - 15.02.2022, 11:15
RE: chartist to display nice pie... - by Acla - 12.06.2023, 05:05
RE: chartist to display nice pie... - by JRP - 08.09.2022, 16:18
RE: chartist to display nice pie... - by Acla - 12.06.2023, 15:44
RE: chartist to display nice pie... - by jmir - 25.03.2024, 14:49

Forum Jump: