Line Chart –
A line-chart is a chart which used to displays information as a series of data points and it is called straight line segments.
Stayed Informed - Angular4 Interview Q/A
Example for Line Chart –
LineChart.Component.ts –
import {Component} from '@angular/core'; export class LineChart { data: any; Message: any[]; constructor() { this.data = { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [ { label: '', data: [62, 58, 80, 82, 57, 56, 40], fill: false, borderColor: '#4bc0c0' }, { label: '', data: [29, 47, 42, 19, 84, 25, 90], fill: false, borderColor: '#565656' } ] } } selectChartData(event) { this.Message = []; this.Message.push({ severity: 'info', summary: 'Your Data Selected', 'detail': this.data.datasets[event.element._datasetIndex].data[event.element._index] }); } }
Linechart.html –
<div class="row"> <div class="col-lg-12" id="LineChart"> <p-growl [value]="Message"></p-growl> <p-chart type="line" [data]="data" (onDataSelect)="selectChartData($event)"></p-chart> </div> </div>
Result
–
I hope you are enjoying with this post! Please
share with you friends!! Thank you!!!