I'm using chartist to draw a chart. Now the points to put on the chart come as an array and i'm looping over all results to draw multiple charts.
According to the current place in the loop I want a chart with the values from the PHP array.
This is my current code
$('.ct-chart-current').each(function(i,v) {
    new Chartist.Line(this, {
        labels: [<?php echo $labelscurrent[0] ?>],
        series: [
            [<?php echo $current[X] ?>]
        ]
    }, currentopts);
});
You can see I'm trying to get value X from the $current array. Now how could I use the "i" from the function call in my each loop
Pseudo code
$('.ct-chart-current').each(function(--> i <-- ,v) {
    new Chartist.Line(this, {
        labels: [<?php echo $labelscurrent[0] ?>],
        series: [
            [<?php echo $current[ -->i <--] ?>]
        ]
    }, currentopts);
});
I added arrows around the javascript "i" I would love to echo in my PHP.
I've tried different kind of method's like echo'ing <script> tags in my PHP but I'm guessing there should be an easier way? 
 
     
     
    