Spivey
Published © MIT

Implementing Chart. js in Your Angular Application

Here's how you can easily use Chart. js to display data in your Angular application.

BeginnerProtip30 minutes5,692
Implementing Chart. js in Your Angular Application

Story

Read more

Code

Chart.js

JavaScript
this.chart = new Chart(this.chartRef.nativeElement, {
  type: 'line',
  data: {
    labels: labels, // your labels array
    datasets: [
      {
        data: dataPoints, // your data array
        borderColor: '#00AEFF',
        fill: false
      }
    ]
  },
  options: {
    legend: {
      display: false
    },
    scales: {
      xAxes: [{
        display: true
      }],
      yAxes: [{
        display: true
      }],
    }
  }
});

Credits

Spivey

Spivey

82 projects • 59 followers
Tourist in a Tutu || US Born || Melbourne/Mexico/California Raised || New Yorker at ❤️ || SF to Dublin to be COO of Wia the best IoT startup
Thanks to Iain Andrew.

Comments