Pass data in np.dnarray to Highcharts

Posted by F.N.B on Stack Overflow See other posts from Stack Overflow or by F.N.B
Published on 2014-06-13T02:59:55Z Indexed on 2014/06/13 3:25 UTC
Read the original article Hit count: 211

Filed under:
|
|
|
|

I'm working with python 2.7, jinja2, flask and Highcharts. I create two numpy array (x1 and x2, type = numpy.dnarray) and I pass to Highcharts. My problems is, Highcharts don't recognize the commas in the vector.

This is my jinja2 code:

<script>
    $(function () {
    $('#container').highcharts({

      series: [{
            name: 'Tokyo',
            data: {{ x1 }}
        },  {
            name: 'London',
            data: {{ x2 }}
        }]
    });
});

And this is the error that I look with network chrome dev tools:

series: [{
     name: 'Tokyo',
     data: [1 4 5 2 3]
},  {
     name: 'London',
     data: [3 6 7 4 1]
}]

I need change the numpy array to python list to pass to Highcharts or there is a better way to do?? Thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about numpy