'String is converted to integer automatically while ploting in chart js

<canvas id="myChart" width="400" height="400"></canvas>
<script>
var final={{final|safe}};
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'line',
    data: {
        labels: [{% for i in final %}{{i.Date}},{% endfor %}],
        datasets: [{
            label: 'Actual Price',
            data: [{% for i in final %}{{i.Open}},{% endfor %}]
    },
    {
      label: 'Prediction Price',
      data:[{% for i in final %}{{i.prediction}},{% endfor %}]
   }]
   },
    options: {
        scales: {
            xAxes: [{
              display: true
                }],
            yAxes:[{
              ticks:{
                beginAtZero: true
              }
            }]
            }
        }
    });
</script>
</div>

Graph

Console

String is converted to integer automatically while ploting in chart js. While i am calling a list in final , we can see Date is in string but while taking it to the labels using for loops , it converted string into int. how can i solve that problem ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source