File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -175,23 +175,29 @@ const Indicator = ({
175175 if ( ! isNaN ( number ) ) {
176176 return number ;
177177 }
178- if ( indicator . raw_data_col . length > 3 ) {
178+ const cleanedData = indicator . raw_data_col . replace ( / ^ [ " ' ] + | [ " ' ] + $ / g, '' ) . trim ( ) ;
179+
180+ if ( cleanedData . length > 9 ) {
181+ // Find the first word
182+ const firstWord = cleanedData . split ( ' ' ) [ 0 ] ;
183+
179184 return (
180185 < span
181186 onMouseEnter = { ( ) => setIsHovered ( true ) }
182187 onMouseLeave = { ( ) => setIsHovered ( false ) }
183188 >
184- { indicator . raw_data_col . substring ( 0 , 3 ) } ...
189+ { firstWord } ...
185190 </ span >
186191 ) ;
187192 } else {
188- return indicator . raw_data_col ;
193+ return cleanedData ;
189194 }
190195 } else {
191196 return hasNoData ? "Data unavailable" : disp_val ;
192197 }
193198 } ;
194199
200+
195201 const getWidthClass = ( ) => {
196202 if ( indicator . raw_data_col . length <= 7 ) {
197203 return "w-auto" ;
@@ -211,7 +217,7 @@ const Indicator = ({
211217 { isHovered && (
212218 < div className = { `absolute right-0 text-center bottom-full mb-2 bg-white shadow-lg border border-gray-200 z-50
213219 ${ getWidthClass ( ) } p-2` } >
214- { indicator . raw_data_col }
220+ { indicator . raw_data_col . replace ( / ^ [ " ' ] + | [ " ' ] + $ / g , '' ) . trim ( ) }
215221 </ div >
216222 ) }
217223 </ span >
You can’t perform that action at this time.
0 commit comments