Add game source to tooltip in games chart
Show service name (Steam, Local, Gog, etc.) below the bold game title when hovering over chart segments. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -742,11 +742,28 @@ HTML_TEMPLATE = """<!DOCTYPE html>
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
titleFont: {
|
||||
weight: 'bold'
|
||||
},
|
||||
bodyFont: {
|
||||
weight: 'normal'
|
||||
},
|
||||
callbacks: {
|
||||
title: function(context) {
|
||||
return context[0].label;
|
||||
},
|
||||
beforeBody: function(context) {
|
||||
const index = context[0].dataIndex;
|
||||
const service = chartData[index].service;
|
||||
if (service && service !== 'others') {
|
||||
return service.charAt(0).toUpperCase() + service.slice(1);
|
||||
}
|
||||
return '';
|
||||
},
|
||||
label: function(context) {
|
||||
const value = context.raw;
|
||||
const percent = ((value / totalPlaytime) * 100).toFixed(1);
|
||||
return ' ' + formatTime(value) + ' (' + percent + '%)';
|
||||
return formatTime(value) + ' (' + percent + '%)';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user