@@ -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 ,
0 commit comments