# Create a chart
And, here’s what it can look like in our component class. Import chartjs-plugin-streaming and register it. In the component class, define datasets and options with a realtime scale.
# src/app/app.component.ts
import { Component } from '@angular/core';
import { Chart, ChartDataset, ChartOptions } from 'chart.js';
import 'chartjs-adapter-luxon';
import StreamingPlugin from 'chartjs-plugin-streaming';
Chart.register(StreamingPlugin);
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
public datasets: ChartDataset[] = [{
data: []
}, {
data: []
}];
public options: ChartOptions = {
scales: {
x: {
type: 'realtime'
}
}
};
}