Added sample bubble chart

This commit is contained in:
Felix 2019-07-10 12:49:36 +01:00
parent 9f50b3c2ce
commit 1c11f8e936
7 changed files with 100 additions and 30 deletions

View file

@ -1,5 +1,8 @@
import { Component, OnInit, AfterViewInit, Input, Output, EventEmitter, ViewChild, TemplateRef } from '@angular/core';
import { ApiService } from '../providers/api-service';
import { ChartOptions, ChartType, ChartDataSets } from 'chart.js';
import { Color } from 'ng2-charts';
import { BubbleChartComponent } from '../panels/bubble-panel';
import { AgmCoreModule } from '@agm/core';
import { BsModalService, ModalDirective } from 'ngx-bootstrap/modal';
import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
@ -16,6 +19,64 @@ export class MoreStuffComponent implements OnInit { // if you wanna rename this
@Output() public onClick = new EventEmitter();
@Input() public categories: any;
// chart data
public bubbleChartOptions: ChartOptions = {
responsive: true,
scales: {
xAxes: [
{
ticks: {
min: 0,
max: 30,
}
}
],
yAxes: [
{
ticks: {
min: 0,
max: 30,
}
}
]
}
};
public bubbleChartType: ChartType = 'bubble';
public bubbleChartLegend = true;
public bubbleChartData: ChartDataSets[] = [
{
data: [
{ x: 10, y: 10, r: 10 },
{ x: 15, y: 5, r: 15 },
{ x: 26, y: 12, r: 23 },
{ x: 7, y: 8, r: 8 },
],
label: 'Series A',
backgroundColor: 'green',
borderColor: 'blue',
hoverBackgroundColor: 'purple',
hoverBorderColor: 'red',
},
];
public bubbleChartColors: Color[] = [
{
backgroundColor: [
'red',
'green',
'blue',
'purple',
'yellow',
'brown',
'magenta',
'cyan',
'orange',
'pink'
]
}
];
public recurClick(event: any): void {
this.onClick.emit( event );
}
@ -27,4 +88,9 @@ export class MoreStuffComponent implements OnInit { // if you wanna rename this
ngOnInit(): void {
}
private setChartData(dataCat: any) {
}
}