Update main.js

This commit is contained in:
DJObleezy 2025-04-10 16:40:57 -07:00 committed by GitHub
parent d491220a4d
commit 05033f12ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -637,7 +637,7 @@ function initializeChart() {
data: { data: {
labels: [], labels: [],
datasets: [{ datasets: [{
label: 'Hashrate Trend (TH/s)', label: 'HASHRATE TREND (TH/s)',
data: [], data: [],
borderWidth: 2, borderWidth: 2,
borderColor: function (context) { borderColor: function (context) {
@ -681,20 +681,39 @@ function initializeChart() {
ticks: { ticks: {
maxTicksLimit: 8, // Limit number of x-axis labels maxTicksLimit: 8, // Limit number of x-axis labels
maxRotation: 0, // Don't rotate labels maxRotation: 0, // Don't rotate labels
autoSkip: true // Automatically skip some labels autoSkip: true, // Automatically skip some labels
color: '#FFFFFF',
font: {
family: "'VT323', monospace", // Terminal font
size: 14
}
},
grid: {
color: '#333333',
lineWidth: 0.5
} }
}, },
y: { y: {
title: { title: {
display: true, display: true,
text: 'HASHRATE (TH/S)' // Always display unit as TH/s since that's our normalized unit text: 'HASHRATE (TH/S)', // Already uppercase
color: '#f7931a', // Bitcoin orange
font: {
family: "'VT323', monospace", // Terminal font
size: 16,
weight: 'bold'
}
}, },
ticks: { ticks: {
color: 'white', color: '#FFFFFF',
maxTicksLimit: 6, // Limit total number of ticks maxTicksLimit: 6, // Limit total number of ticks
precision: 1, // Control decimal precision precision: 1, // Control decimal precision
autoSkip: true, // Skip labels to prevent overcrowding autoSkip: true, // Skip labels to prevent overcrowding
autoSkipPadding: 10, // Padding between skipped labels autoSkipPadding: 10, // Padding between skipped labels
font: {
family: "'VT323', monospace", // Terminal font
size: 14
},
callback: function (value) { callback: function (value) {
// For zero, just return 0 // For zero, just return 0
if (value === 0) return '0'; if (value === 0) return '0';
@ -722,10 +741,10 @@ function initializeChart() {
} }
}, },
grid: { grid: {
color: '#333', color: '#333333',
lineWidth: 0.5, lineWidth: 0.5,
drawBorder: false, drawBorder: false,
zeroLineColor: '#555', zeroLineColor: '#555555',
zeroLineWidth: 1, zeroLineWidth: 1,
drawTicks: false drawTicks: false
} }
@ -733,11 +752,29 @@ function initializeChart() {
}, },
plugins: { plugins: {
tooltip: { tooltip: {
backgroundColor: 'rgba(0, 0, 0, 0.8)',
titleColor: '#f7931a',
bodyColor: '#FFFFFF',
titleFont: {
family: "'VT323', monospace",
size: 16,
weight: 'bold'
},
bodyFont: {
family: "'VT323', monospace",
size: 14
},
padding: 10,
cornerRadius: 0,
displayColors: false,
callbacks: { callbacks: {
title: function (tooltipItems) {
return tooltipItems[0].label.toUpperCase();
},
label: function (context) { label: function (context) {
// Format tooltip values with appropriate unit // Format tooltip values with appropriate unit
const value = context.raw; const value = context.raw;
return 'Hashrate: ' + formatHashrateForDisplay(value); return 'HASHRATE: ' + formatHashrateForDisplay(value).toUpperCase();
} }
} }
}, },
@ -748,10 +785,9 @@ function initializeChart() {
type: 'line', type: 'line',
yMin: 0, yMin: 0,
yMax: 0, yMax: 0,
borderColor: '#ffd700', // Changed to gold color for better contrast borderColor: '#ffd700', // Gold color
borderWidth: 3, // Increased from 2 to 3 borderWidth: 3,
borderDash: [8, 4], // Modified dash pattern for distinction borderDash: [8, 4],
// Add shadow effect
shadowColor: 'rgba(255, 215, 0, 0.5)', shadowColor: 'rgba(255, 215, 0, 0.5)',
shadowBlur: 8, shadowBlur: 8,
shadowOffsetX: 0, shadowOffsetX: 0,
@ -760,18 +796,15 @@ function initializeChart() {
enabled: true, enabled: true,
content: '24HR AVG: 0 TH/S', content: '24HR AVG: 0 TH/S',
backgroundColor: 'rgba(0,0,0,0.8)', backgroundColor: 'rgba(0,0,0,0.8)',
color: '#ffd700', // Changed to match the line color color: '#ffd700',
font: { font: {
weight: 'bold', family: "'VT323', monospace",
size: 14, // Increased from 13 to 14 size: 16,
family: 'var(--terminal-font)', // Use the terminal font weight: 'bold'
uppercase: true // Make label text uppercase
}, },
padding: { top: 4, bottom: 4, left: 8, right: 8 }, padding: { top: 4, bottom: 4, left: 8, right: 8 },
borderRadius: 2, borderRadius: 0,
position: 'start', position: 'start'
// Add a subtle shadow to the label
textShadow: '0 0 5px rgba(255, 215, 0, 0.7)'
} }
} }
} }