Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
680
how to attach sparkline datasource to property of parent
posted

I have a couple of divs like so

  <div class="sparkline" data-values="[33,22,3,4,55,5]"></div>

<div class="sparkline" data-values="[100,12,33,48,58,60]"></div>

I want to init the sparklines using the data attribute but it's not working pretty sure it's just my jquery syntax can anyone point me in the right direction.

           $(".sparkline").igSparkline({              

   dataSource: $(this).data('values'),       

          height: "300px",        

         width: "300px",       

      });

Parents
No Data
Reply
  • 680
    Offline posted

    this works ok, any one going for anything better ?

                $(".sparkline").each(               

      function () {                               

       $(this).igSparkline({                

             dataSource: $(this).data('values'),       

                      height: "300px",         

                    width: "300px",              

           })                

    });

Children