Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
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,701
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
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
Contact
Thanks to Iain Andrew.

Comments

Please log in or sign up to comment.