2017-07-05 17:08:23 +00:00
|
|
|
import { Directive, Component, OnInit } from '@angular/core';
|
2017-06-19 16:20:21 +00:00
|
|
|
import { Http, Response } from '@angular/http';
|
|
|
|
import { ApiService } from '../providers/api-service';
|
2017-04-27 14:29:31 +00:00
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
templateUrl: 'dashboard.component.html'
|
|
|
|
})
|
|
|
|
export class DashboardComponent implements OnInit {
|
2017-07-18 10:35:43 +00:00
|
|
|
shuffledArray: any;
|
|
|
|
showGraph: any;
|
|
|
|
showSnippet: any;
|
|
|
|
customersThisMonth: any;
|
|
|
|
moneySpentThisMonth: any;
|
|
|
|
pointsTotal: any;
|
|
|
|
averageTransactionToday: any;
|
2017-06-22 15:30:35 +00:00
|
|
|
customersThisWeek: any;
|
|
|
|
customersLastWeek: any;
|
2017-07-05 17:08:23 +00:00
|
|
|
customersLastMonth: any;
|
|
|
|
customersLastYear: any;
|
2017-06-22 15:30:35 +00:00
|
|
|
pointsThisWeek: any;
|
|
|
|
pointsLastWeek: any;
|
2017-07-05 17:08:23 +00:00
|
|
|
percentOfCustomersSector: any;
|
2017-07-18 10:35:43 +00:00
|
|
|
noOfCustomersSector: any;
|
|
|
|
percentOfLocalSuppliers: any;
|
|
|
|
percentOfSingleCompetitorLocalSuppliers: any;
|
2017-04-27 14:29:31 +00:00
|
|
|
|
2017-07-04 14:44:13 +00:00
|
|
|
constructor(
|
2017-06-19 16:20:21 +00:00
|
|
|
private http: Http,
|
|
|
|
private api: ApiService,
|
|
|
|
) {
|
2017-07-04 14:44:13 +00:00
|
|
|
this.shuffle = this.shuffledArray;
|
|
|
|
this.api.graph_data(undefined)
|
2017-06-19 16:20:21 +00:00
|
|
|
.subscribe(
|
|
|
|
result => {
|
|
|
|
console.log(result);
|
2017-07-18 10:35:43 +00:00
|
|
|
// Return what data to show 4 of
|
|
|
|
this.showGraph = result.elementstoshow.graphs;
|
|
|
|
this.showSnippet = result.elementstoshow.snippets;
|
2017-07-05 17:08:23 +00:00
|
|
|
// Percentage Chart
|
2017-07-18 10:35:43 +00:00
|
|
|
this.percentOfLocalSuppliers = result.data.localsuppliers.percentownlocal;
|
|
|
|
this.percentOfSingleCompetitorLocalSuppliers = result.data.localsuppliers.percentsinglecompetitorlocal;
|
|
|
|
// Percentage Chart 2
|
|
|
|
this.percentOfCustomersSector = result.data.customersinsector.percent;
|
|
|
|
this.noOfCustomersSector = result.data.customersinsector.customerno;
|
2017-07-04 16:19:26 +00:00
|
|
|
// Chart 1
|
2017-07-18 10:35:43 +00:00
|
|
|
this.customersThisWeek = result.data.customersthisweek;
|
2017-06-22 15:30:35 +00:00
|
|
|
this.lineChart1Data[0].data = this.customersThisWeek.customerno;
|
|
|
|
this.lineChart1Labels = this.customersThisWeek.day;
|
2017-07-04 16:19:26 +00:00
|
|
|
// Chart 2
|
2017-07-18 10:35:43 +00:00
|
|
|
this.customersLastWeek = result.data.customerslastweek;
|
2017-06-22 15:30:35 +00:00
|
|
|
this.lineChart2Data[0].data = this.customersLastWeek.customerno;
|
|
|
|
this.lineChart2Labels = this.customersLastWeek.day;
|
2017-07-04 16:19:26 +00:00
|
|
|
// Chart 3
|
2017-07-18 10:35:43 +00:00
|
|
|
this.customersLastMonth = result.data.customerslastmonth;
|
2017-07-05 17:08:23 +00:00
|
|
|
this.lineChart3Data[0].data = this.customersLastMonth.customerno;
|
|
|
|
this.lineChart3Labels = this.customersLastMonth.day;
|
2017-07-04 16:19:26 +00:00
|
|
|
// Chart 4
|
2017-07-18 10:35:43 +00:00
|
|
|
this.customersLastYear = result.data.customerslastyear;
|
2017-07-05 17:08:23 +00:00
|
|
|
this.lineChart4Data[0].data = this.customersLastYear.customerno;
|
2017-07-18 10:35:43 +00:00
|
|
|
this.lineChart4Labels = this.customersLastYear.month;
|
2017-07-05 17:08:23 +00:00
|
|
|
// Chart 5
|
2017-07-18 10:35:43 +00:00
|
|
|
this.pointsThisWeek = result.data.pointsthisweek;
|
2017-07-05 17:08:23 +00:00
|
|
|
this.lineChart5Data[0].data = this.pointsThisWeek.points;
|
|
|
|
this.lineChart5Labels = this.pointsThisWeek.day;
|
|
|
|
// Chart 6
|
2017-07-18 10:35:43 +00:00
|
|
|
this.pointsLastWeek = result.data.pointslastweek;
|
2017-06-22 15:30:35 +00:00
|
|
|
this.barChart1Data[0].data = this.pointsLastWeek.points;
|
|
|
|
this.barChart1Labels = this.pointsLastWeek.day;
|
2017-07-18 10:35:43 +00:00
|
|
|
// Chart 7
|
|
|
|
this.customersLastWeek = result.data.customerslastweek;
|
|
|
|
this.lineChart6Data[0].data = this.customersLastWeek.returningcustomerno;
|
|
|
|
this.lineChart6Labels = this.customersLastWeek.day;
|
|
|
|
// Chart 8
|
|
|
|
this.customersLastMonth = result.data.customerslastmonth;
|
|
|
|
this.lineChart7Data[0].data = this.customersLastMonth.returningcustomerno;
|
|
|
|
this.lineChart7Labels = this.customersLastMonth.day;
|
|
|
|
// Chart 9
|
|
|
|
this.customersLastYear = result.data.customerslastyear;
|
|
|
|
this.lineChart8Data[0].data = this.customersLastYear.returningcustomerno;
|
|
|
|
this.lineChart8Labels = this.customersLastYear.month;
|
2017-06-19 16:20:21 +00:00
|
|
|
}
|
2017-06-22 15:30:35 +00:00
|
|
|
),
|
2017-07-04 14:44:13 +00:00
|
|
|
this.api.breadcrumb_data(undefined)
|
2017-06-22 15:30:35 +00:00
|
|
|
.subscribe(
|
|
|
|
result => {
|
|
|
|
console.log(result);
|
|
|
|
this.customersThisMonth = result.customersthismonth;
|
|
|
|
this.moneySpentThisMonth = result.moneyspentthismonth;
|
|
|
|
this.pointsTotal = result.pointstotal;
|
|
|
|
this.averageTransactionToday = result.averagetransactiontoday;
|
|
|
|
}
|
|
|
|
)
|
2017-06-19 16:20:21 +00:00
|
|
|
}
|
2017-07-04 14:44:13 +00:00
|
|
|
|
|
|
|
// Fisher-Yates shuffle function
|
|
|
|
public shuffle(array) {
|
|
|
|
return new Promise(resolve => {
|
|
|
|
let counter = array.length;
|
|
|
|
|
|
|
|
// While there are elements in the array
|
|
|
|
while (counter > 0) {
|
|
|
|
// Pick a random index
|
|
|
|
let index = Math.floor(Math.random() * counter);
|
|
|
|
|
|
|
|
// Decrease counter by 1
|
|
|
|
counter--;
|
2017-04-27 14:29:31 +00:00
|
|
|
|
2017-07-04 14:44:13 +00:00
|
|
|
// And swap the last element with it
|
|
|
|
let temp = array[counter];
|
|
|
|
array[counter] = array[index];
|
|
|
|
array[index] = temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.shuffledArray = array;
|
|
|
|
resolve(true);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-04-27 14:29:31 +00:00
|
|
|
public brandPrimary = '#20a8d8';
|
|
|
|
public brandSuccess = '#4dbd74';
|
|
|
|
public brandInfo = '#63c2de';
|
|
|
|
public brandWarning = '#f8cb00';
|
|
|
|
public brandDanger = '#f86c6b';
|
|
|
|
|
|
|
|
// dropdown buttons
|
|
|
|
public status: { isopen } = { isopen: false };
|
|
|
|
public toggleDropdown($event: MouseEvent): void {
|
|
|
|
$event.preventDefault();
|
|
|
|
$event.stopPropagation();
|
|
|
|
this.status.isopen = !this.status.isopen;
|
|
|
|
}
|
|
|
|
|
|
|
|
// convert Hex to RGBA
|
|
|
|
public convertHex(hex: string, opacity: number) {
|
|
|
|
hex = hex.replace('#', '');
|
|
|
|
const r = parseInt(hex.substring(0, 2), 16);
|
|
|
|
const g = parseInt(hex.substring(2, 4), 16);
|
|
|
|
const b = parseInt(hex.substring(4, 6), 16);
|
|
|
|
|
|
|
|
const rgba = 'rgba(' + r + ', ' + g + ', ' + b + ', ' + opacity / 100 + ')';
|
|
|
|
return rgba;
|
|
|
|
}
|
|
|
|
|
|
|
|
// events
|
|
|
|
public chartClicked(e: any): void {
|
|
|
|
console.log(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
public chartHovered(e: any): void {
|
|
|
|
console.log(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
// lineChart1
|
|
|
|
public lineChart1Data: Array<any> = [
|
|
|
|
{
|
2017-06-19 16:20:21 +00:00
|
|
|
data: [],
|
2017-04-27 14:29:31 +00:00
|
|
|
label: 'Series A'
|
|
|
|
}
|
|
|
|
];
|
2017-06-19 16:20:21 +00:00
|
|
|
public lineChart1Labels: Array<any> = [];
|
2017-04-27 14:29:31 +00:00
|
|
|
public lineChart1Options: any = {
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
gridLines: {
|
|
|
|
color: 'transparent',
|
|
|
|
zeroLineColor: 'transparent'
|
|
|
|
},
|
|
|
|
ticks: {
|
|
|
|
fontSize: 2,
|
|
|
|
fontColor: 'transparent',
|
|
|
|
}
|
|
|
|
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
display: false,
|
|
|
|
ticks: {
|
|
|
|
display: false,
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
borderWidth: 1
|
|
|
|
},
|
|
|
|
point: {
|
|
|
|
radius: 4,
|
|
|
|
hitRadius: 10,
|
|
|
|
hoverRadius: 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public lineChart1Colours: Array<any> = [
|
|
|
|
{ // grey
|
|
|
|
backgroundColor: this.brandPrimary,
|
|
|
|
borderColor: 'rgba(255,255,255,.55)'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart1Legend = false;
|
|
|
|
public lineChart1Type = 'line';
|
|
|
|
|
|
|
|
// lineChart2
|
|
|
|
public lineChart2Data: Array<any> = [
|
|
|
|
{
|
2017-06-22 11:40:36 +00:00
|
|
|
data: [],
|
|
|
|
label: 'Series B'
|
2017-04-27 14:29:31 +00:00
|
|
|
}
|
|
|
|
];
|
2017-06-22 11:40:36 +00:00
|
|
|
public lineChart2Labels: Array<any> = [];
|
2017-04-27 14:29:31 +00:00
|
|
|
public lineChart2Options: any = {
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
gridLines: {
|
|
|
|
color: 'transparent',
|
|
|
|
zeroLineColor: 'transparent'
|
|
|
|
},
|
|
|
|
ticks: {
|
|
|
|
fontSize: 2,
|
|
|
|
fontColor: 'transparent',
|
|
|
|
}
|
|
|
|
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
display: false,
|
|
|
|
ticks: {
|
|
|
|
display: false,
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
tension: 0.00001,
|
|
|
|
borderWidth: 1
|
|
|
|
},
|
|
|
|
point: {
|
|
|
|
radius: 4,
|
|
|
|
hitRadius: 10,
|
|
|
|
hoverRadius: 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public lineChart2Colours: Array<any> = [
|
|
|
|
{ // grey
|
|
|
|
backgroundColor: this.brandInfo,
|
|
|
|
borderColor: 'rgba(255,255,255,.55)'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart2Legend = false;
|
|
|
|
public lineChart2Type = 'line';
|
2017-07-05 17:08:23 +00:00
|
|
|
|
2017-04-27 14:29:31 +00:00
|
|
|
// lineChart3
|
|
|
|
public lineChart3Data: Array<any> = [
|
|
|
|
{
|
2017-06-22 11:40:36 +00:00
|
|
|
data: [],
|
2017-07-05 17:08:23 +00:00
|
|
|
label: 'Series B'
|
2017-04-27 14:29:31 +00:00
|
|
|
}
|
|
|
|
];
|
2017-06-22 11:40:36 +00:00
|
|
|
public lineChart3Labels: Array<any> = [];
|
2017-04-27 14:29:31 +00:00
|
|
|
public lineChart3Options: any = {
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
display: false
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
display: false
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
borderWidth: 2
|
|
|
|
},
|
|
|
|
point: {
|
2017-07-05 17:08:23 +00:00
|
|
|
radius: 2,
|
2017-04-27 14:29:31 +00:00
|
|
|
hitRadius: 10,
|
|
|
|
hoverRadius: 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public lineChart3Colours: Array<any> = [
|
2017-07-05 17:08:23 +00:00
|
|
|
{ // grey
|
|
|
|
backgroundColor: this.brandInfo,
|
|
|
|
borderColor: 'rgba(255,255,255,.55)'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart3Legend = false;
|
|
|
|
public lineChart3Type = 'line';
|
|
|
|
|
|
|
|
// lineChart4
|
|
|
|
public lineChart4Data: Array<any> = [
|
|
|
|
{
|
|
|
|
data: [],
|
|
|
|
label: 'Series B'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart4Labels: Array<any> = [];
|
|
|
|
public lineChart4Options: any = {
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
gridLines: {
|
|
|
|
color: 'transparent',
|
|
|
|
zeroLineColor: 'transparent'
|
|
|
|
},
|
|
|
|
ticks: {
|
|
|
|
fontSize: 2,
|
|
|
|
fontColor: 'transparent',
|
|
|
|
}
|
|
|
|
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
display: false,
|
|
|
|
ticks: {
|
|
|
|
display: false,
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
tension: 0.00001,
|
|
|
|
borderWidth: 1
|
|
|
|
},
|
|
|
|
point: {
|
|
|
|
radius: 4,
|
|
|
|
hitRadius: 10,
|
|
|
|
hoverRadius: 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public lineChart4Colours: Array<any> = [
|
|
|
|
{ // grey
|
|
|
|
backgroundColor: this.brandInfo,
|
|
|
|
borderColor: 'rgba(255,255,255,.55)'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart4Legend = false;
|
|
|
|
public lineChart4Type = 'line';
|
|
|
|
|
2017-07-18 10:35:43 +00:00
|
|
|
// lineChart6
|
|
|
|
public lineChart6Data: Array<any> = [
|
|
|
|
{
|
|
|
|
data: [],
|
|
|
|
label: 'Series B'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart6Labels: Array<any> = [];
|
|
|
|
public lineChart6Options: any = {
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
gridLines: {
|
|
|
|
color: 'transparent',
|
|
|
|
zeroLineColor: 'transparent'
|
|
|
|
},
|
|
|
|
ticks: {
|
|
|
|
fontSize: 2,
|
|
|
|
fontColor: 'transparent',
|
|
|
|
}
|
|
|
|
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
display: false,
|
|
|
|
ticks: {
|
|
|
|
display: false,
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
tension: 0.00001,
|
|
|
|
borderWidth: 1
|
|
|
|
},
|
|
|
|
point: {
|
|
|
|
radius: 4,
|
|
|
|
hitRadius: 10,
|
|
|
|
hoverRadius: 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public lineChart6Colours: Array<any> = [
|
|
|
|
{ // grey
|
|
|
|
backgroundColor: this.brandInfo,
|
|
|
|
borderColor: 'rgba(255,255,255,.55)'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart6Legend = false;
|
|
|
|
public lineChart6Type = 'line';
|
|
|
|
|
|
|
|
// lineChart7
|
|
|
|
public lineChart7Data: Array<any> = [
|
|
|
|
{
|
|
|
|
data: [],
|
|
|
|
label: 'Series B'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart7Labels: Array<any> = [];
|
|
|
|
public lineChart7Options: any = {
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
display: false
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
display: false
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
borderWidth: 2
|
|
|
|
},
|
|
|
|
point: {
|
|
|
|
radius: 2,
|
|
|
|
hitRadius: 10,
|
|
|
|
hoverRadius: 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public lineChart7Colours: Array<any> = [
|
|
|
|
{ // grey
|
|
|
|
backgroundColor: this.brandInfo,
|
|
|
|
borderColor: 'rgba(255,255,255,.55)'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart7Legend = false;
|
|
|
|
public lineChart7Type = 'line';
|
|
|
|
|
|
|
|
// lineChart8
|
|
|
|
public lineChart8Data: Array<any> = [
|
|
|
|
{
|
|
|
|
data: [],
|
|
|
|
label: 'Series B'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart8Labels: Array<any> = [];
|
|
|
|
public lineChart8Options: any = {
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
gridLines: {
|
|
|
|
color: 'transparent',
|
|
|
|
zeroLineColor: 'transparent'
|
|
|
|
},
|
|
|
|
ticks: {
|
|
|
|
fontSize: 2,
|
|
|
|
fontColor: 'transparent',
|
|
|
|
}
|
|
|
|
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
display: false,
|
|
|
|
ticks: {
|
|
|
|
display: false,
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
tension: 0.00001,
|
|
|
|
borderWidth: 1
|
|
|
|
},
|
|
|
|
point: {
|
|
|
|
radius: 4,
|
|
|
|
hitRadius: 10,
|
|
|
|
hoverRadius: 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public lineChart8Colours: Array<any> = [
|
|
|
|
{ // grey
|
|
|
|
backgroundColor: this.brandInfo,
|
|
|
|
borderColor: 'rgba(255,255,255,.55)'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart8Legend = false;
|
|
|
|
public lineChart8Type = 'line';
|
|
|
|
|
2017-07-05 17:08:23 +00:00
|
|
|
// lineChart5
|
|
|
|
public lineChart5Data: Array<any> = [
|
|
|
|
{
|
|
|
|
data: [],
|
|
|
|
label: 'Series A'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public lineChart5Labels: Array<any> = [];
|
|
|
|
public lineChart5Options: any = {
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
display: false
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
display: false
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
borderWidth: 2
|
|
|
|
},
|
|
|
|
point: {
|
|
|
|
radius: 0,
|
|
|
|
hitRadius: 10,
|
|
|
|
hoverRadius: 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public lineChart5Colours: Array<any> = [
|
2017-04-27 14:29:31 +00:00
|
|
|
{
|
|
|
|
backgroundColor: 'rgba(255,255,255,.2)',
|
|
|
|
borderColor: 'rgba(255,255,255,.55)',
|
|
|
|
}
|
|
|
|
];
|
2017-07-05 17:08:23 +00:00
|
|
|
public lineChart5Legend = false;
|
|
|
|
public lineChart5Type = 'line';
|
2017-04-27 14:29:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
// barChart1
|
|
|
|
public barChart1Data: Array<any> = [
|
|
|
|
{
|
2017-06-22 11:40:36 +00:00
|
|
|
data: [],
|
2017-04-27 14:29:31 +00:00
|
|
|
label: 'Series A'
|
|
|
|
}
|
|
|
|
];
|
2017-06-22 11:40:36 +00:00
|
|
|
public barChart1Labels: Array<any> = [];
|
2017-04-27 14:29:31 +00:00
|
|
|
public barChart1Options: any = {
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
display: false,
|
|
|
|
barPercentage: 0.6,
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
display: false
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public barChart1Colours: Array<any> = [
|
|
|
|
{
|
|
|
|
backgroundColor: 'rgba(255,255,255,.3)',
|
|
|
|
borderWidth: 0
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public barChart1Legend = false;
|
|
|
|
public barChart1Type = 'bar';
|
|
|
|
|
|
|
|
// mainChart
|
|
|
|
|
|
|
|
public random(min: number, max: number) {
|
|
|
|
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
|
|
}
|
|
|
|
|
|
|
|
public mainChartElements = 27;
|
|
|
|
public mainChartData1: Array<number> = [];
|
|
|
|
public mainChartData2: Array<number> = [];
|
|
|
|
public mainChartData3: Array<number> = [];
|
|
|
|
|
|
|
|
public mainChartData: Array<any> = [
|
|
|
|
{
|
|
|
|
data: this.mainChartData1,
|
|
|
|
label: 'Current'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: this.mainChartData2,
|
|
|
|
label: 'Previous'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data: this.mainChartData3,
|
|
|
|
label: 'BEP'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
/* tslint:disable:max-line-length */
|
|
|
|
public mainChartLabels: Array<any> = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Thursday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
|
|
|
|
/* tslint:enable:max-line-length */
|
|
|
|
public mainChartOptions: any = {
|
|
|
|
responsive: true,
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
gridLines: {
|
|
|
|
drawOnChartArea: false,
|
|
|
|
},
|
|
|
|
ticks: {
|
|
|
|
callback: function(value: any) {
|
|
|
|
return value.charAt(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
beginAtZero: true,
|
|
|
|
maxTicksLimit: 5,
|
|
|
|
stepSize: Math.ceil(250 / 5),
|
|
|
|
max: 250
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
borderWidth: 2
|
|
|
|
},
|
|
|
|
point: {
|
|
|
|
radius: 0,
|
|
|
|
hitRadius: 10,
|
|
|
|
hoverRadius: 4,
|
|
|
|
hoverBorderWidth: 3,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public mainChartColours: Array<any> = [
|
|
|
|
{ // brandInfo
|
|
|
|
backgroundColor: this.convertHex(this.brandInfo, 10),
|
|
|
|
borderColor: this.brandInfo,
|
|
|
|
pointHoverBackgroundColor: '#fff'
|
|
|
|
},
|
|
|
|
{ // brandSuccess
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
borderColor: this.brandSuccess,
|
|
|
|
pointHoverBackgroundColor: '#fff'
|
|
|
|
},
|
|
|
|
{ // brandDanger
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
borderColor: this.brandDanger,
|
|
|
|
pointHoverBackgroundColor: '#fff',
|
|
|
|
borderWidth: 1,
|
|
|
|
borderDash: [8, 5]
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public mainChartLegend = false;
|
|
|
|
public mainChartType = 'line';
|
|
|
|
|
|
|
|
// social box charts
|
|
|
|
|
|
|
|
public socialChartData1: Array<any> = [
|
|
|
|
{
|
|
|
|
data: [65, 59, 84, 84, 51, 55, 40],
|
|
|
|
label: 'Facebook'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public socialChartData2: Array<any> = [
|
|
|
|
{
|
|
|
|
data: [1, 13, 9, 17, 34, 41, 38],
|
|
|
|
label: 'Twitter'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public socialChartData3: Array<any> = [
|
|
|
|
{
|
|
|
|
data: [78, 81, 80, 45, 34, 12, 40],
|
|
|
|
label: 'LinkedIn'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public socialChartData4: Array<any> = [
|
|
|
|
{
|
|
|
|
data: [35, 23, 56, 22, 97, 23, 64],
|
|
|
|
label: 'Google+'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
public socialChartLabels: Array<any> = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
|
|
|
|
public socialChartOptions: any = {
|
|
|
|
responsive: true,
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
display: false,
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
display: false,
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
borderWidth: 2
|
|
|
|
},
|
|
|
|
point: {
|
|
|
|
radius: 0,
|
|
|
|
hitRadius: 10,
|
|
|
|
hoverRadius: 4,
|
|
|
|
hoverBorderWidth: 3,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public socialChartColours: Array<any> = [
|
|
|
|
{
|
|
|
|
backgroundColor: 'rgba(255,255,255,.1)',
|
|
|
|
borderColor: 'rgba(255,255,255,.55)',
|
|
|
|
pointHoverBackgroundColor: '#fff'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public socialChartLegend = false;
|
|
|
|
public socialChartType = 'line';
|
|
|
|
|
|
|
|
// sparkline charts
|
|
|
|
|
|
|
|
public sparklineChartData1: Array<any> = [
|
|
|
|
{
|
|
|
|
data: [35, 23, 56, 22, 97, 23, 64],
|
|
|
|
label: 'Clients'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public sparklineChartData2: Array<any> = [
|
|
|
|
{
|
|
|
|
data: [65, 59, 84, 84, 51, 55, 40],
|
|
|
|
label: 'Clients'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
public sparklineChartLabels: Array<any> = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
|
|
|
|
public sparklineChartOptions: any = {
|
|
|
|
responsive: true,
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
display: false,
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
display: false,
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
elements: {
|
|
|
|
line: {
|
|
|
|
borderWidth: 2
|
|
|
|
},
|
|
|
|
point: {
|
|
|
|
radius: 0,
|
|
|
|
hitRadius: 10,
|
|
|
|
hoverRadius: 4,
|
|
|
|
hoverBorderWidth: 3,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
display: false
|
|
|
|
}
|
|
|
|
};
|
|
|
|
public sparklineChartDefault: Array<any> = [
|
|
|
|
{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
borderColor: '#d1d4d7',
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public sparklineChartPrimary: Array<any> = [
|
|
|
|
{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
borderColor: this.brandPrimary,
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public sparklineChartInfo: Array<any> = [
|
|
|
|
{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
borderColor: this.brandInfo,
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public sparklineChartDanger: Array<any> = [
|
|
|
|
{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
borderColor: this.brandDanger,
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public sparklineChartWarning: Array<any> = [
|
|
|
|
{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
borderColor: this.brandWarning,
|
|
|
|
}
|
|
|
|
];
|
|
|
|
public sparklineChartSuccess: Array<any> = [
|
|
|
|
{
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
borderColor: this.brandSuccess,
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
public sparklineChartLegend = false;
|
|
|
|
public sparklineChartType = 'line';
|
|
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
// generate random values for mainChart
|
|
|
|
for (let i = 0; i <= this.mainChartElements; i++) {
|
|
|
|
this.mainChartData1.push(this.random(50, 200));
|
|
|
|
this.mainChartData2.push(this.random(80, 100));
|
2017-05-12 16:07:18 +00:00
|
|
|
this.mainChartData3.push(this.random(50, 200));
|
2017-04-27 14:29:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|