From 818045ef04b321aa0a66bb8abce30a2e94e9fefa Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 26 Aug 2021 09:00:08 +0200 Subject: Update client dependencies --- .../my-video-channels.component.ts | 49 +++++++++++----------- 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'client/src/app/+my-library/+my-video-channels') diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts index 303f783fd..205ad7a89 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts +++ b/client/src/app/+my-library/+my-video-channels/my-video-channels.component.ts @@ -1,4 +1,4 @@ -import { ChartData } from 'chart.js' +import { ChartData, ChartOptions, TooltipItem, TooltipModel } from 'chart.js' import { max, maxBy, min, minBy } from 'lodash-es' import { mergeMap } from 'rxjs/operators' import { Component } from '@angular/core' @@ -18,7 +18,7 @@ export class MyVideoChannelsComponent { videoChannelsMinimumDailyViews = 0 videoChannelsMaximumDailyViews: number - chartOptions: any + chartOptions: ChartOptions search: string @@ -117,20 +117,33 @@ channel with the same name (${videoChannel.name})!`, private buildChartOptions () { this.chartOptions = { - legend: { - display: false + plugins: { + legend: { + display: false + }, + tooltip: { + mode: 'index', + intersect: false, + external: function ({ tooltip }: { tooltip: TooltipModel }) { + if (!tooltip) return + + // disable displaying the color box + tooltip.options.displayColors = false + }, + callbacks: { + label: (tooltip: TooltipItem) => `${tooltip.formattedValue} views` + } + } }, scales: { - xAxes: [ { + x: { display: false - } ], - yAxes: [ { + }, + y: { display: false, - ticks: { - min: Math.max(0, this.videoChannelsMinimumDailyViews - (3 * this.videoChannelsMaximumDailyViews / 100)), - max: Math.max(1, this.videoChannelsMaximumDailyViews) - } - } ] + min: Math.max(0, this.videoChannelsMinimumDailyViews - (3 * this.videoChannelsMaximumDailyViews / 100)), + max: Math.max(1, this.videoChannelsMaximumDailyViews) + } }, layout: { padding: { @@ -145,18 +158,6 @@ channel with the same name (${videoChannel.name})!`, radius: 0 } }, - tooltips: { - mode: 'index', - intersect: false, - custom: function (tooltip: any) { - if (!tooltip) return - // disable displaying the color box - tooltip.displayColors = false - }, - callbacks: { - label: (tooltip: any, data: any) => `${tooltip.value} views` - } - }, hover: { mode: 'index', intersect: false -- cgit v1.2.3