@@ -31,6 +31,7 @@ import {
3131 getPowerUserDailyData ,
3232 COPILOT_PLANS ,
3333 getPowerUserDailyBreakdown ,
34+ getUniqueModelsFromBreakdown ,
3435 getLastDateFromData ,
3536 getExceededRequestDetails ,
3637 getUserExceededRequestSummary
@@ -69,6 +70,12 @@ function App() {
6970 return getPowerUserDailyBreakdown ( data , [ selectedPowerUser ] ) ;
7071 } , [ selectedPowerUser , data , powerUserDailyBreakdown ] ) ;
7172
73+ // Get unique models from the power user breakdown data
74+ const getPowerUserModels = useCallback ( ( ) => {
75+ const breakdown = getFilteredPowerUserBreakdown ( ) ;
76+ return getUniqueModelsFromBreakdown ( breakdown ) ;
77+ } , [ getFilteredPowerUserBreakdown ] ) ;
78+
7279 const processFile = useCallback ( ( file : File ) => {
7380 if ( ! file ) return ;
7481
@@ -307,16 +314,16 @@ function App() {
307314
308315 // Generate colors for models in bar chart
309316 const getModelColors = useCallback ( ( ) => {
310- // Use a set of predefined colors that are visually distinct
317+ // Use a set of predefined colors that are visually distinct from exceeding requests red (#ef4444)
311318 const colors = [
312319 "#4285F4" , // Blue
313- "#EA4335 " , // Red
320+ "#9C27B0 " , // Purple (changed from red to avoid confusion with exceeding requests)
314321 "#FBBC05" , // Yellow
315322 "#34A853" , // Green
316323 "#8E44AD" , // Purple
317324 "#F39C12" , // Orange
318325 "#16A085" , // Teal
319- "#E74C3C " , // Red-Orange
326+ "#FF9800 " , // Amber (changed from red-orange to avoid confusion with exceeding requests)
320327 "#3498DB" , // Light Blue
321328 "#1ABC9C" // Turquoise
322329 ] ;
@@ -622,7 +629,7 @@ function App() {
622629 onClick = { ( ) => selectedPowerUser && handlePowerUserSelect ( null ) }
623630 title = { selectedPowerUser ? 'Click to show all power users' : undefined }
624631 >
625- Power User Requests Breakdown (Compliant vs Exceeding )
632+ Power User Requests Breakdown (By Model & Compliance )
626633 { selectedPowerUser && (
627634 < span className = "text-sm font-normal text-muted-foreground ml-2" >
628635 - { selectedPowerUser }
@@ -646,10 +653,21 @@ function App() {
646653 </ div >
647654 < div className = "h-[300px]" >
648655 < ChartContainer
649- config = { {
650- compliantRequests : { color : "#10b981" } , // green
651- exceedingRequests : { color : "#ef4444" } , // red
652- } }
656+ config = { ( ( ) => {
657+ const models = getPowerUserModels ( ) ;
658+ const modelColors = getModelColors ( ) ;
659+ const config : Record < string , { color : string } > = {
660+ compliantRequests : { color : "#10b981" } , // green
661+ exceedingRequests : { color : "#ef4444" } , // red
662+ } ;
663+
664+ // Add each model with its color
665+ models . forEach ( ( model , index ) => {
666+ config [ model ] = { color : modelColors [ model ] || "#94a3b8" } ;
667+ } ) ;
668+
669+ return config ;
670+ } ) ( ) }
653671 className = "h-full w-full"
654672 >
655673 < BarChart data = { getFilteredPowerUserBreakdown ( ) } >
@@ -739,7 +757,21 @@ function App() {
739757 />
740758 < Legend content = { ( props ) => < CustomLegend payload = { props . payload } /> } />
741759
742- { /* Stacked bars for compliant and exceeding requests */ }
760+ { /* Dynamic stacked bars for each model */ }
761+ { getPowerUserModels ( ) . map ( ( model ) => {
762+ const modelColors = getModelColors ( ) ;
763+ return (
764+ < Bar
765+ key = { model }
766+ dataKey = { model }
767+ name = { model }
768+ stackId = "models"
769+ fill = { modelColors [ model ] || "#94a3b8" }
770+ />
771+ ) ;
772+ } ) }
773+
774+ { /* Keep the original compliant/exceeding bars but make them toggleable */ }
743775 { visibleBars . includes ( 'compliantRequests' ) && (
744776 < Bar
745777 dataKey = "compliantRequests"
0 commit comments