Skip to content

Commit

Permalink
Remove lag chart tooltip. Embolden Title. Remove other superfluous st…
Browse files Browse the repository at this point in the history
…uff. Closes lichess-org#14414
  • Loading branch information
allanjoseph98 committed Jan 8, 2024
1 parent 1803f86 commit 453b551
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions ui/chart/src/lag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import {
ChartType,
DoughnutController,
Title,
Tooltip,
} from 'chart.js';
import dataLabels from 'chartjs-plugin-datalabels';
import { fontColor, fontFamily, tooltipBgColor, resizePolyfill } from './common';
import { fontColor, fontFamily, resizePolyfill } from './common';

declare module 'chart.js' {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand All @@ -21,7 +20,7 @@ declare module 'chart.js' {
}

resizePolyfill();
Chart.register(DoughnutController, ArcElement, Tooltip, dataLabels, Title);
Chart.register(DoughnutController, ArcElement, dataLabels, Title);
Chart.defaults.font = fontFamily();

const v = {
Expand All @@ -40,7 +39,6 @@ export async function initModule() {
hoverBackgroundColor: colors,
borderColor: '#d9d9d9',
borderWidth: 3,
hoverBorderWidth: 4,
circumference: 180,
rotation: 270,
},
Expand All @@ -52,30 +50,13 @@ export async function initModule() {
datasets: dataset,
},
options: {
interaction: {
mode: 'dataset',
axis: 'r',
},
events: [],
plugins: {
title: {
display: true,
text: '',
padding: { top: 100 },
},
tooltip: {
backgroundColor: tooltipBgColor,
titleColor: fontColor,
borderColor: fontColor,
borderWidth: 1,
callbacks: {
title: () => {
const lat = index ? v.network : v.server;
const text = index ? 'Ping:' : 'Server Latency:';
if (lat <= 0) return '';
return `${text} ${lat}` + ' milliseconds';
},
label: () => '',
},
color: fontColor,
},
needle: {
value: index ? v.network : v.server,
Expand Down

0 comments on commit 453b551

Please sign in to comment.