Skip to content

Commit 5c2c06d

Browse files
fix: rename donut chart symbols to match actual bar chart type
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 53e261d commit 5c2c06d

3 files changed

Lines changed: 22 additions & 22 deletions

File tree

internal/admin/dashboard/static/css/dashboard.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,15 +896,15 @@ td.col-price {
896896
}
897897

898898
/* Usage by Model Chart Section */
899-
.donut-section {
899+
.model-chart-section {
900900
background: var(--bg-surface);
901901
border: 1px solid var(--border);
902902
border-radius: var(--radius);
903903
padding: 24px;
904904
margin-bottom: 24px;
905905
}
906906

907-
.donut-section h3 {
907+
.model-chart-section h3 {
908908
font-size: 16px;
909909
font-weight: 600;
910910
margin-bottom: 16px;

internal/admin/dashboard/static/js/dashboard.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function dashboard() {
4444
usageLogSearch: '',
4545
usageLogModel: '',
4646
usageLogProvider: '',
47-
usageDonutChart: null,
47+
usageBarChart: null,
4848

4949
_parseRoute(pathname) {
5050
const path = pathname.replace(/\/$/, '');
@@ -324,7 +324,7 @@ function dashboard() {
324324
localStorage.setItem('gomodel_theme', t);
325325
this.applyTheme();
326326
this.renderChart();
327-
this.renderDonutChart();
327+
this.renderBarChart();
328328
},
329329

330330
toggleTheme() {
@@ -649,7 +649,7 @@ function dashboard() {
649649

650650
async fetchUsagePage() {
651651
await Promise.all([this.fetchModelUsage(), this.fetchUsageLog(true)]);
652-
this.renderDonutChart();
652+
this.renderBarChart();
653653
},
654654

655655
async fetchModelUsage() {
@@ -692,7 +692,7 @@ function dashboard() {
692692
this.usageMode = mode;
693693
const url = mode === 'costs' ? '/admin/dashboard/usage/costs' : '/admin/dashboard/usage';
694694
history.pushState(null, '', url);
695-
this.renderDonutChart();
695+
this.renderBarChart();
696696
},
697697

698698
usageLogNextPage() {
@@ -738,15 +738,15 @@ function dashboard() {
738738
String(d.getSeconds()).padStart(2, '0');
739739
},
740740

741-
_donutColors() {
741+
_barColors() {
742742
return [
743743
'#c2845a', '#7a9e7e', '#d4a574', '#b8a98e', '#8b9e6b',
744744
'#7d8a97', '#c47a5a', '#6b8e6b', '#a09486', '#9b7ea4',
745745
'#c49a6c'
746746
];
747747
},
748748

749-
_donutData() {
749+
_barData() {
750750
const sorted = [...this.modelUsage].sort((a, b) => {
751751
if (this.usageMode === 'costs') {
752752
return ((b.total_cost || 0) - (a.total_cost || 0));
@@ -776,40 +776,40 @@ function dashboard() {
776776
return { labels, values };
777777
},
778778

779-
donutLegendItems() {
780-
const { labels, values } = this._donutData();
781-
const colors = this._donutColors();
779+
barLegendItems() {
780+
const { labels, values } = this._barData();
781+
const colors = this._barColors();
782782
return labels.map((label, i) => ({
783783
label,
784784
color: colors[i % colors.length],
785785
value: this.usageMode === 'costs' ? '$' + values[i].toFixed(4) : this.formatTokensShort(values[i])
786786
}));
787787
},
788788

789-
renderDonutChart(retries) {
789+
renderBarChart(retries) {
790790
if (retries === undefined) retries = 3;
791791
this.$nextTick(() => {
792-
if (this.usageDonutChart) {
793-
this.usageDonutChart.destroy();
794-
this.usageDonutChart = null;
792+
if (this.usageBarChart) {
793+
this.usageBarChart.destroy();
794+
this.usageBarChart = null;
795795
}
796796

797797
if (this.modelUsage.length === 0) return;
798798
if (this.page !== 'usage') return;
799799

800-
const canvas = document.getElementById('usageDonutChart');
800+
const canvas = document.getElementById('usageBarChart');
801801
if (!canvas || canvas.offsetWidth === 0) {
802802
if (retries > 0) {
803-
setTimeout(() => this.renderDonutChart(retries - 1), 100);
803+
setTimeout(() => this.renderBarChart(retries - 1), 100);
804804
}
805805
return;
806806
}
807807

808808
const colors = this.chartColors();
809-
const { labels, values } = this._donutData();
810-
const palette = this._donutColors();
809+
const { labels, values } = this._barData();
810+
const palette = this._barColors();
811811

812-
this.usageDonutChart = new Chart(canvas, {
812+
this.usageBarChart = new Chart(canvas, {
813813
type: 'bar',
814814
data: {
815815
labels: labels,

internal/admin/dashboard/templates/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ <h2>Usage Analytics</h2>
7272
</div>
7373

7474
<!-- Usage by Model Chart -->
75-
<div class="donut-section" x-show="modelUsage.length > 0">
75+
<div class="model-chart-section" x-show="modelUsage.length > 0">
7676
<h3 x-text="usageMode === 'tokens' ? 'Token Usage by Model' : 'Cost by Model'"></h3>
7777
<div class="bar-chart-wrap">
78-
<canvas id="usageDonutChart"></canvas>
78+
<canvas id="usageBarChart"></canvas>
7979
</div>
8080
</div>
8181

0 commit comments

Comments
 (0)