@@ -734,16 +734,30 @@ const PriceChartECharts = React.forwardRef(({ items = [], colors = [], hoveredIt
734734
735735 sortedParams . forEach ( p => {
736736 const color = p . color ;
737- const value = p . value ;
737+ const value = Math . round ( p . value ) ;
738738 const name = p . seriesName ;
739+ const item = items . find ( i => i . name === name ) ;
740+
741+ // Get unit label (normalized if active)
742+ let unitLabel = item ?. unit || '' ;
743+ if ( normTargets && item ) {
744+ const parsed = parseUnit ( item . unit ) ;
745+ unitLabel = getTargetUnitLabel ( parsed . type , normTargets [ parsed . type ] , item . unit ) ;
746+ }
747+
739748 // Use the ref directly for instant, lag-free bolding
740749 const isHighlighted = name === hoveredItem || name === localHoveredRef . current ;
741750
742751 html += `
743- <div class="flex items-center gap-2 text-sm ${ isHighlighted ? 'scale-105 origin-left' : '' } transition-all duration-200">
744- <span style="display:inline-block;width:8px;height:8px;border-radius:50%;background-color:${ color } ; box-shadow: ${ isHighlighted ? `0 0 8px ${ color } ` : 'none' } "></span>
745- <span class="${ isHighlighted ? 'font-bold ' + ( isDark ? 'text-white' : 'text-[#2A2442]' ) : 'font-medium ' + ( isDark ? 'text-[#B8AED0]' : 'text-[#8B7E6B]' ) } ">${ name } :</span>
746- <span class="font-bold ${ isHighlighted ? ( isDark ? 'text-white' : 'text-[#2A2442]' ) : ( isDark ? 'text-[#B8AED0]' : 'text-[#5C5247]' ) } ">৳${ value } </span>
752+ <div class="flex items-center justify-between gap-4 text-sm ${ isHighlighted ? 'scale-105 origin-left' : '' } transition-all duration-200">
753+ <div class="flex items-center gap-2 min-w-0">
754+ <span style="display:inline-block;width:8px;height:8px;border-radius:50%;background-color:${ color } ; box-shadow: ${ isHighlighted ? `0 0 8px ${ color } ` : 'none' } "></span>
755+ <span class="truncate ${ isHighlighted ? 'font-bold ' + ( isDark ? 'text-white' : 'text-[#2A2442]' ) : 'font-medium ' + ( isDark ? 'text-[#B8AED0]' : 'text-[#8B7E6B]' ) } ">${ name } :</span>
756+ </div>
757+ <div class="flex items-center gap-1 shrink-0">
758+ <span class="font-bold ${ isHighlighted ? ( isDark ? 'text-white' : 'text-[#2A2442]' ) : ( isDark ? 'text-[#B8AED0]' : 'text-[#5C5247]' ) } ">৳${ value } </span>
759+ <span class="text-[10px] opacity-70 ${ isHighlighted ? 'font-bold' : '' } ">/${ unitLabel } </span>
760+ </div>
747761 </div>
748762 ` ;
749763 } ) ;
0 commit comments