import { Injectable } from '@angular/core'; @Injectable() export class ChartsConfigService { DEFAULT_COLLORS = { PLAN: 'green', FAKT: 'orange' } constructor() { } getStatisticChart(names, count, processed) { return { xAxis: { categories: names, title: '', labels: { style: { fontSize: '12px', fontWeight: 'bold', fontFamily: 'OpenSansBold', color: '#000' } } }, yAxis: { title: '', stackLabels: { enabled: true, style: { fontWeight: 'bold', color: 'black' } }, }, chart: { type: 'bar', plotBackgroundColor: null, plotBorderWidth: 0, plotShadow: false }, title: { text: '' }, credits: { enabled: false }, tooltip: { pointFormat: '{point.percentage:.1f}%' }, exporting: { enabled: false }, legend: { reversed: true }, plotOptions: { series: { stacking: 'percent' }, bar: { stacking: 'percent', dataLabels: { enabled: true, color: 'white', style: { textShadow: '0 0 3px black' } } } }, series: [ { name: 'роз\'яснено', color: this.DEFAULT_COLLORS.FAKT, data: processed }, { name: 'виконано', color: this.DEFAULT_COLLORS.PLAN, data: count }] } } getBarLineConfig(dataCategories, dataSeries1, dataSeries2) { return { chart: { type: 'column', }, title: { text: 'Загально по Києву (за тиждень)' }, xAxis: { categories: dataCategories }, yAxis: { title: { text: 'Кількість дзвінків' } }, tooltip: { shared: true, valueSuffix: ' дзвінків' }, credits: { enabled: false }, series: [{ name: 'Факт', data: dataSeries1, color: this.DEFAULT_COLLORS.FAKT }, { name: 'План', data: dataSeries2, color: this.DEFAULT_COLLORS.PLAN }] }; } getBaseLineConfig(title, dataCategories, dataSeries1, dataSeries2) { return { chart: { type: 'line', animation: true }, title: { text: title + ' за тиждень', x: -20 }, xAxis: { categories: dataCategories }, yAxis: { title: { text: 'Кількість звернень' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, credits: { enabled: false }, tooltip: { valueSuffix: 'звернень' }, series: [{ name: 'Факт', color: this.DEFAULT_COLLORS.FAKT, data: dataSeries1 }, { name: 'План', color: this.DEFAULT_COLLORS.PLAN, data: dataSeries2 }] }; } }