dashboard version 1
This commit is contained in:
1 parent
1361fc7b18
commit
a05fdd44ec
7 files changed
+731
-98
No files matched your search
@@ -1,5 +1,332 @@
|
||||
<h1>Home page</h1>
|
||||
<!--breadcrumb-->
|
||||
<div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
|
||||
<div class="breadcrumb-title pe-3">Home</div>
|
||||
<div class="ps-3">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb mb-0 p-0">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="javascript:;">
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">Dashboard</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<!--end breadcrumb-->
|
||||
|
||||
<!-- <script>
|
||||
$(".data-attributes span").peity("donut")
|
||||
</script> -->
|
||||
<div class="row row-cols-1 row-cols-lg-2 row-cols-xl-4">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center justify-content-between gap-3">
|
||||
<div
|
||||
class="wh-48 d-flex bg-success text-success bg-opacity-10 align-items-center justify-content-center rounded-circle">
|
||||
<span class="material-symbols-outlined">movie</span>
|
||||
</div>
|
||||
<div class="">
|
||||
<h4 class="mb-0">{{counts.movies}}</h4>
|
||||
<p class="mb-0">Movies</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center justify-content-between gap-3">
|
||||
<div
|
||||
class="wh-48 d-flex bg-danger text-danger bg-opacity-10 align-items-center justify-content-center rounded-circle">
|
||||
<span class="material-icons-outlined">tv</span>
|
||||
</div>
|
||||
<div class="">
|
||||
<h4 class="mb-0">{{counts.series}}</h4>
|
||||
<p class="mb-0">Tv-Series</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center justify-content-between gap-3">
|
||||
<div
|
||||
class="wh-48 d-flex bg-info text-info bg-opacity-10 align-items-center justify-content-center rounded-circle">
|
||||
<span class="material-icons-outlined">favorite_border</span>
|
||||
</div>
|
||||
<div class="">
|
||||
<h4 class="mb-0">{{counts.favorit}}</h4>
|
||||
<p class="mb-0">Favorits</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center justify-content-between gap-3">
|
||||
<div
|
||||
class="wh-48 d-flex bg-orange-light text-orange bg-opacity-10 align-items-center justify-content-center rounded-circle">
|
||||
<span class="material-symbols-outlined">playlist_add_check</span>
|
||||
</div>
|
||||
<div class="">
|
||||
<h4 class="mb-0">{{counts.watchlist}}</h4>
|
||||
<p class="mb-0">Watchlist</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-xl-5 col-xxl-4 d-flex">
|
||||
<div class="card rounded-4 w-100 shadow-none bg-transparent border-0">
|
||||
<div class="card-body p-0">
|
||||
<div class="row g-4">
|
||||
<div class="col-12 col-xl-6 d-flex">
|
||||
<div class="card mb-0 rounded-4 w-100">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-start justify-content-between mb-3">
|
||||
<div class="">
|
||||
<h4 class="mb-0">97.4K</h4>
|
||||
<p class="mb-0">Total Users</p>
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<a href="javascript:;" class="dropdown-toggle-nocaret options dropdown-toggle"
|
||||
data-bs-toggle="dropdown">
|
||||
<span class="material-icons-outlined fs-5">more_vert</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="javascript:;">Action</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:;">Another action</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:;">Something else here</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-container2">
|
||||
<div id="chart3"></div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<p class="mb-0"><span class="text-success me-1">12.5%</span> from last month</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-xl-6 d-flex">
|
||||
<div class="card mb-0 rounded-4 w-100">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-start justify-content-between mb-1">
|
||||
<div class="">
|
||||
<h4 class="mb-0">42.5K</h4>
|
||||
<p class="mb-0">Active Users</p>
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<a href="javascript:;" class="dropdown-toggle-nocaret options dropdown-toggle"
|
||||
data-bs-toggle="dropdown">
|
||||
<span class="material-icons-outlined fs-5">more_vert</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="javascript:;">Action</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:;">Another action</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:;">Something else here</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-container2">
|
||||
<div id="chart2" style="min-height: 131.818px;">
|
||||
<div id="apexcharts3qnjc9lg" class="apexcharts-canvas apexcharts3qnjc9lg apexcharts-theme-light"
|
||||
style="width: 131px; height: 131.818px;"><svg id="SvgjsSvg1785" width="131"
|
||||
height="131.81753540039062" xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev" class="apexcharts-svg"
|
||||
xmlns:data="ApexChartsNS" transform="translate(0, 0)" style="background: transparent;">
|
||||
<foreignObject x="0" y="0" width="131" height="131.81753540039062">
|
||||
<div class="apexcharts-legend" xmlns="http://www.w3.org/1999/xhtml"></div>
|
||||
</foreignObject>
|
||||
<g id="SvgjsG1787" class="apexcharts-inner apexcharts-graphical"
|
||||
transform="translate(-11.5, 0)">
|
||||
<defs id="SvgjsDefs1786">
|
||||
<clipPath id="gridRectMask3qnjc9lg">
|
||||
<rect id="SvgjsRect1788" width="162" height="180" x="-3" y="-1" rx="0" ry="0" opacity="1"
|
||||
stroke-width="0" stroke="none" stroke-dasharray="0" fill="#fff"></rect>
|
||||
</clipPath>
|
||||
<clipPath id="forecastMask3qnjc9lg"></clipPath>
|
||||
<clipPath id="nonForecastMask3qnjc9lg"></clipPath>
|
||||
<clipPath id="gridRectMarkerMask3qnjc9lg">
|
||||
<rect id="SvgjsRect1789" width="160" height="182" x="-2" y="-2" rx="0" ry="0" opacity="1"
|
||||
stroke-width="0" stroke="none" stroke-dasharray="0" fill="#fff"></rect>
|
||||
</clipPath>
|
||||
<linearGradient id="SvgjsLinearGradient1794" x1="0" y1="1" x2="1" y2="1">
|
||||
<stop id="SvgjsStop1795" stop-opacity="0.1" stop-color="rgba(8,102,255,0.1)" offset="0">
|
||||
</stop>
|
||||
<stop id="SvgjsStop1796" stop-opacity="1" stop-color="rgba(0,0,0,1)" offset="1"></stop>
|
||||
<stop id="SvgjsStop1797" stop-opacity="1" stop-color="rgba(0,0,0,1)" offset="1"></stop>
|
||||
</linearGradient>
|
||||
<linearGradient id="SvgjsLinearGradient1804" x1="0" y1="1" x2="1" y2="1">
|
||||
<stop id="SvgjsStop1805" stop-opacity="1" stop-color="rgba(8,102,255,1)" offset="0">
|
||||
</stop>
|
||||
<stop id="SvgjsStop1806" stop-opacity="1" stop-color="rgba(252,24,90,1)" offset="1">
|
||||
</stop>
|
||||
<stop id="SvgjsStop1807" stop-opacity="1" stop-color="rgba(252,24,90,1)" offset="1">
|
||||
</stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="SvgjsG1790" class="apexcharts-radialbar">
|
||||
<g id="SvgjsG1791">
|
||||
<g id="SvgjsG1792" class="apexcharts-tracks">
|
||||
<g id="SvgjsG1793" class="apexcharts-radialbar-track apexcharts-track" rel="1">
|
||||
<path id="apexcharts-radialbarTrack-0"
|
||||
d="M 23.999529440199204 103.18083296600864 A 59.5829268292683 59.5829268292683 0 1 1 132.0004705598008 103.18083296600865"
|
||||
fill="none" fill-opacity="1" stroke="rgba(0, 0, 0, 0.1)" stroke-opacity="1"
|
||||
stroke-linecap="round" stroke-width="4.696536585365855" stroke-dasharray="0"
|
||||
class="apexcharts-radialbar-area"
|
||||
data:pathOrig="M 23.999529440199204 103.18083296600864 A 59.5829268292683 59.5829268292683 0 1 1 132.0004705598008 103.18083296600865">
|
||||
</path>
|
||||
</g>
|
||||
</g>
|
||||
<g id="SvgjsG1799">
|
||||
<g id="SvgjsG1803" class="apexcharts-series apexcharts-radial-series"
|
||||
seriesName="TotalxOrders" rel="1" data:realIndex="0">
|
||||
<path id="SvgjsPath1808"
|
||||
d="M 23.999529440199204 103.18083296600864 A 59.5829268292683 59.5829268292683 0 0 1 131.55277989522526 51.88056403680397"
|
||||
fill="none" fill-opacity="0.85" stroke="url(#SvgjsLinearGradient1804)"
|
||||
stroke-opacity="1" stroke-linecap="round" stroke-width="7.009756097560977"
|
||||
stroke-dasharray="0" class="apexcharts-radialbar-area apexcharts-radialbar-slice-0"
|
||||
data:angle="179" data:value="78" index="0" j="0"
|
||||
data:pathOrig="M 23.999529440199204 103.18083296600864 A 59.5829268292683 59.5829268292683 0 0 1 131.55277989522526 51.88056403680397">
|
||||
</path>
|
||||
</g>
|
||||
<circle id="SvgjsCircle1800" r="57.23465853658537" cx="78" cy="78"
|
||||
class="apexcharts-radialbar-hollow" fill="transparent"></circle>
|
||||
<g id="SvgjsG1801" class="apexcharts-datalabels-group"
|
||||
transform="translate(0, 0) scale(1)" style="opacity: 1;"><text id="SvgjsText1802"
|
||||
font-family="Helvetica, Arial, sans-serif" x="78" y="88" text-anchor="middle"
|
||||
dominant-baseline="auto" font-size="24px" font-weight="400" fill="#111111"
|
||||
class="apexcharts-text apexcharts-datalabel-value"
|
||||
style="font-family: Helvetica, Arial, sans-serif;">78%</text></g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<line id="SvgjsLine1809" x1="0" y1="0" x2="156" y2="0" stroke="#b6b6b6" stroke-dasharray="0"
|
||||
stroke-width="1" stroke-linecap="butt" class="apexcharts-ycrosshairs"></line>
|
||||
<line id="SvgjsLine1810" x1="0" y1="0" x2="156" y2="0" stroke-dasharray="0" stroke-width="0"
|
||||
stroke-linecap="butt" class="apexcharts-ycrosshairs-hidden"></line>
|
||||
</g>
|
||||
</svg></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<p class="mb-0">24K users increased from last month</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-xl-12">
|
||||
<div class="card rounded-4 mb-0">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center gap-3 mb-2">
|
||||
<div class="">
|
||||
<h2 class="mb-0">$65,129</h2>
|
||||
</div>
|
||||
<div class="">
|
||||
<p
|
||||
class="dash-lable d-flex align-items-center gap-1 rounded mb-0 bg-success text-success bg-opacity-10">
|
||||
<span class="material-icons-outlined fs-6">arrow_upward</span>8.6%
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="mb-0">Sales This Year</p>
|
||||
<div class="mt-4">
|
||||
<p class="mb-2 d-flex align-items-center justify-content-between">285 left to Goal<span
|
||||
class="">78%</span></p>
|
||||
<div class="progress w-100" style="height: 7px;">
|
||||
<div class="progress-bar bg-primary" style="width: 65%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-xl-7 col-xxl-8 d-flex">
|
||||
<div class="card w-100 rounded-4">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-start justify-content-between mb-3">
|
||||
<div class="">
|
||||
<h5 class="mb-0 fw-bold">{{watchCount.year}} Watch Stats</h5>
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<a href="javascript:;" class="dropdown-toggle-nocaret options dropdown-toggle" data-bs-toggle="dropdown">
|
||||
<span class="material-icons-outlined fs-5">more_vert</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="javascript:;" (click)="changeYear(2024)">2024</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:;" (click)="changeYear(2023)">2023</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:;" (click)="changeYear(2022)">2022</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:;" (click)="changeYear(2021)">2021</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:;" (click)="changeYear(2020)">2020</a></li>
|
||||
<li><a class="dropdown-item" href="javascript:;" (click)="changeYear(2019)">2019</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="yearlyChart"></div>
|
||||
<div
|
||||
class="d-flex flex-column flex-lg-row align-items-start justify-content-around border p-3 rounded-4 mt-3 gap-3">
|
||||
<div class="d-flex align-items-center gap-4">
|
||||
<div class="">
|
||||
<p class="mb-0 data-attributes">
|
||||
<span
|
||||
data-peity="{ "fill": ["#0d6efd", "rgb(0 0 0 / 10%)"], "innerRadius": 32, "radius": 40 }"
|
||||
style="display: none;">5/7</span><svg class="peity" height="80" width="80">
|
||||
<path
|
||||
d="M 40 0 A 40 40 0 1 1 1.0028835127270526 48.90083735825258 L 8.802306810181644 47.120669886602066 A 32 32 0 1 0 40 8"
|
||||
data-value="5" fill="#0d6efd"></path>
|
||||
<path
|
||||
d="M 1.0028835127270526 48.90083735825258 A 40 40 0 0 1 39.99999999999999 0 L 39.99999999999999 8 A 32 32 0 0 0 8.802306810181644 47.120669886602066"
|
||||
data-value="2" fill="rgb(0 0 0 / 10%)"></path>
|
||||
</svg>
|
||||
</p>
|
||||
</div>
|
||||
<div class="">
|
||||
<p class="mb-1 fs-6 fw-bold">Movies</p>
|
||||
<h2 class="mb-0">{{this.watchCount.moviesTotal}}</h2>
|
||||
<p class="mb-0"><span class="text-success me-2 fw-medium">16.5%</span><span>55.21 USD</span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vr"></div>
|
||||
<div class="d-flex align-items-center gap-4">
|
||||
<div class="">
|
||||
<p class="mb-0 data-attributes">
|
||||
<span
|
||||
data-peity="{ "fill": ["#6f42c1", "rgb(0 0 0 / 10%)"], "innerRadius": 32, "radius": 40 }"
|
||||
style="display: none;">5/7</span><svg class="peity" height="80" width="80">
|
||||
<path
|
||||
d="M 40 0 A 40 40 0 1 1 1.0028835127270526 48.90083735825258 L 8.802306810181644 47.120669886602066 A 32 32 0 1 0 40 8"
|
||||
data-value="5" fill="#6f42c1"></path>
|
||||
<path
|
||||
d="M 1.0028835127270526 48.90083735825258 A 40 40 0 0 1 39.99999999999999 0 L 39.99999999999999 8 A 32 32 0 0 0 8.802306810181644 47.120669886602066"
|
||||
data-value="2" fill="rgb(0 0 0 / 10%)"></path>
|
||||
</svg>
|
||||
</p>
|
||||
</div>
|
||||
<div class="">
|
||||
<p class="mb-1 fs-6 fw-bold">Tv-Series</p>
|
||||
<h2 class="mb-0">{{this.watchCount.seriesTotal}}</h2>
|
||||
<p class="mb-0"><span class="text-success me-2 fw-medium">24.9%</span><span>267.35 USD</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
|
||||
@@ -1,10 +1,251 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import ApexCharts from 'apexcharts';
|
||||
import { EntrySeenService } from '../../core/services/entry-seen.service';
|
||||
import { LibraryService } from '../../core/services/library.service';
|
||||
import { EpisodeSeenService } from '../../core/services/episode-seen.service';
|
||||
import { Observable, forkJoin } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home-page',
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.css']
|
||||
styleUrls: ['./home.component.css'],
|
||||
})
|
||||
export class HomeComponent {
|
||||
export class HomeComponent implements OnInit {
|
||||
counts: {
|
||||
movies: number;
|
||||
series: number;
|
||||
favorit: number;
|
||||
watchlist: number;
|
||||
} = {
|
||||
movies: 0,
|
||||
series: 0,
|
||||
favorit: 0,
|
||||
watchlist: 0,
|
||||
};
|
||||
|
||||
yearlyChart: any;
|
||||
watchCount: {
|
||||
movies: number[];
|
||||
series: number[];
|
||||
moviesTotal: number;
|
||||
seriesTotal: number;
|
||||
year: number;
|
||||
} = {
|
||||
movies: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
series: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
moviesTotal: 0,
|
||||
seriesTotal: 0,
|
||||
year: 0,
|
||||
};
|
||||
|
||||
constructor(
|
||||
private entrySeenService: EntrySeenService,
|
||||
private episodeSeenService: EpisodeSeenService,
|
||||
private libraryService: LibraryService
|
||||
) {
|
||||
console.log('hey im home');
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
// ? get counts (movies, series, favorit, watchlist)
|
||||
this.getCounts();
|
||||
|
||||
// ? get yearly watch stats
|
||||
let year: number = new Date().getFullYear();
|
||||
this.watchCount.year = year;
|
||||
this.getYearlyWatchHistoryStats();
|
||||
}
|
||||
|
||||
changeYear(year: number) {
|
||||
// TODO implement this in the view
|
||||
this.watchCount.year = year;
|
||||
console.log(`Year set to: `, this.watchCount.year);
|
||||
this.getYearlyWatchHistoryStats();
|
||||
}
|
||||
|
||||
async getYearlyWatchHistoryStats() {
|
||||
let moviesObs = this.entrySeenService.getYearlyStats(this.watchCount.year);
|
||||
let seriesObs = this.episodeSeenService.getYearlyStats(
|
||||
this.watchCount.year
|
||||
);
|
||||
|
||||
const forkObs = forkJoin([moviesObs, seriesObs]).subscribe({
|
||||
next: ([movies, series]) => {
|
||||
console.log(`results: `, movies, series);
|
||||
this.watchCount.moviesTotal = 0;
|
||||
this.watchCount.seriesTotal = 0;
|
||||
this.watchCount.movies = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
this.watchCount.series = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
|
||||
for (let i = 0; i < movies.length; i++) {
|
||||
this.watchCount.movies[movies[i].month - 1] = movies[i].count;
|
||||
this.watchCount.moviesTotal += movies[i].count;
|
||||
}
|
||||
|
||||
for (let i = 0; i < series.length; i++) {
|
||||
this.watchCount.series[series[i].month - 1] = series[i].count;
|
||||
this.watchCount.seriesTotal += series[i].count;
|
||||
}
|
||||
|
||||
console.log(
|
||||
`Watch stats for the year ${this.watchCount.year} fetched successfully.`
|
||||
);
|
||||
this.showYearlyStats();
|
||||
},
|
||||
error: (error) => {
|
||||
console.log(error);
|
||||
},
|
||||
complete: () => {
|
||||
forkObs.unsubscribe();
|
||||
},
|
||||
});
|
||||
|
||||
// this.entrySeenService.getYearlyStats(year).subscribe({
|
||||
// next: (stats) => {
|
||||
// // looping through stats
|
||||
// for (let i = 0; i < stats.length; i++) {
|
||||
// this.watchCount.movies[stats[i].month - 1] = stats[i].count;
|
||||
// }
|
||||
// console.log(`Movies Stats for the year ${year}`, stats);
|
||||
// },
|
||||
// error: (error) => {
|
||||
// console.log(`Error getting stats for the year ${year}`, error);
|
||||
// },
|
||||
// });
|
||||
|
||||
// this.episodeSeenService.getYearlyStats(year).subscribe({
|
||||
// next: (stats) => {
|
||||
// // looping through stats
|
||||
// for (let i = 0; i < stats.length; i++) {
|
||||
// this.watchCount.series[stats[i].month - 1] = stats[i].count;
|
||||
// }
|
||||
// this.showYearlyStats();
|
||||
// console.log(`Series Stats for the year ${year}`, stats);
|
||||
// },
|
||||
// error: (error) => {
|
||||
// console.log(`Error getting series stats for the year ${year}`, error);
|
||||
// },
|
||||
// });
|
||||
}
|
||||
|
||||
getCounts() {
|
||||
// TODO performance: change this to get stats from backend directly
|
||||
this.libraryService.getAllEntries(true).subscribe((entries) => {
|
||||
this.counts.favorit = entries.filter((e) => e.favorit).length;
|
||||
this.counts.watchlist = entries.filter((e) => e.watchlist).length;
|
||||
this.counts.movies = entries.filter(
|
||||
(e) => !e.is_tvseries && !e.watchlist
|
||||
).length;
|
||||
this.counts.series = entries.filter(
|
||||
(e) => e.is_tvseries && !e.watchlist
|
||||
).length;
|
||||
});
|
||||
}
|
||||
|
||||
showYearlyStats() {
|
||||
var yearlyChartOptions = {
|
||||
series: [
|
||||
{
|
||||
name: 'Movies',
|
||||
data: this.watchCount.movies,
|
||||
},
|
||||
{
|
||||
name: 'Tv-Series Episodes',
|
||||
data: this.watchCount.series,
|
||||
// data: [17, 10, 45, 15, 25, 15, 40, 10, 24, 5, 6, 3],
|
||||
},
|
||||
],
|
||||
chart: {
|
||||
//width:150,
|
||||
foreColor: '#9ba7b2',
|
||||
height: 235,
|
||||
type: 'bar',
|
||||
toolbar: {
|
||||
show: !1,
|
||||
},
|
||||
sparkline: {
|
||||
enabled: !1,
|
||||
},
|
||||
zoom: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
},
|
||||
stroke: {
|
||||
width: 4,
|
||||
curve: 'smooth',
|
||||
colors: ['transparent'],
|
||||
},
|
||||
fill: {
|
||||
type: 'gradient',
|
||||
gradient: {
|
||||
shade: 'dark',
|
||||
gradientToColors: ['#0d6efd', '#6f42c1'],
|
||||
shadeIntensity: 1,
|
||||
type: 'vertical',
|
||||
// opacityFrom: 0.8,
|
||||
// opacityTo: 0.1,
|
||||
stops: [0, 100, 100, 100],
|
||||
},
|
||||
},
|
||||
colors: ['#0d6efd', '#6f42c1'],
|
||||
plotOptions: {
|
||||
bar: {
|
||||
horizontal: false,
|
||||
borderRadius: 0,
|
||||
borderRadiusApplication: 'around',
|
||||
borderRadiusWhenStacked: 'last',
|
||||
columnWidth: '55%',
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
show: false,
|
||||
borderColor: 'rgba(0, 0, 0, 0.15)',
|
||||
strokeDashArray: 4,
|
||||
},
|
||||
tooltip: {
|
||||
theme: 'dark',
|
||||
fixed: {
|
||||
enabled: !0,
|
||||
},
|
||||
x: {
|
||||
show: !0,
|
||||
},
|
||||
y: {
|
||||
title: 'dd',
|
||||
},
|
||||
marker: {
|
||||
show: !1,
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
categories: [
|
||||
'Jan',
|
||||
'Feb',
|
||||
'Mar',
|
||||
'Apr',
|
||||
'May',
|
||||
'Jun',
|
||||
'Jul',
|
||||
'Aug',
|
||||
'Sep',
|
||||
'Oct',
|
||||
'Nov',
|
||||
'Dec',
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
if (this.yearlyChart) {
|
||||
this.yearlyChart.destroy(); // Destroy the existing chart instance if it exists
|
||||
}
|
||||
|
||||
this.yearlyChart = new ApexCharts(
|
||||
document.querySelector('#yearlyChart'),
|
||||
yearlyChartOptions
|
||||
);
|
||||
this.yearlyChart.render();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user