Skip to content

Instantly share code, notes, and snippets.

@manfromanotherland
Created January 20, 2017 15:08
Show Gist options
  • Save manfromanotherland/304d096c4d19764492a4793179da53ae to your computer and use it in GitHub Desktop.
Save manfromanotherland/304d096c4d19764492a4793179da53ae to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
import { CHART_DIRECTIVES } from 'ng2-charts/ng2-charts';
@Component({
selector: 'my-app',
directives: [CHART_DIRECTIVES],
styles: [`
.chart {
display: block;
}
`],
template: `
<base-chart
class="chart"
[datasets]="datasets"
[labels]="labels"
[options]="options"
[chartType]="'line'">
</base-chart>
`
})
export class AppComponent {
private datasets = [
{
label: "# Quota used",
data: [1200, 2100, 5100, 10100, 12544, 15750]
},
{
label: "# Quota projection",
data: [1200, 2100, 5100, 10100, 12544, 15750,
18725, 21817,24999, 29061, 33179, 38295]
},
{
label: "# Quota",
data: [30000, 30000, 30000, 30000, 30000, 30000,
30000, 30000,30000, 30000, 30000, 30000]
},
{
label: "# Threshold",
data: [25000, 25000, 25000, 25000, 25000, 25000,
25000, 25000,25000, 25000, 25000, 25000]
}
];
private labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August','September', 'October', 'November', 'December'];
private options = {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment