@@ -61,6 +61,7 @@ export function BaseChart({ isDark, data, chartType, dataConfig, styleConfig }:
6161 } , [ ] )
6262
6363 // Initialize and update the chart.
64+ const [ screenFull , setScreenFull ] = useState ( false )
6465 useEffect ( ( ) => {
6566 if ( ! echartsLibRef . current || ! domRef . current || isLoading ) return
6667
@@ -94,7 +95,7 @@ export function BaseChart({ isDark, data, chartType, dataConfig, styleConfig }:
9495 chartRef . current = null
9596 }
9697 }
97- } , [ echartsLibRef . current , data , chartType , dataConfig , styleConfig , isLoading , isDark ] )
98+ } , [ screenFull , echartsLibRef . current , data , chartType , dataConfig , styleConfig , isLoading , isDark ] )
9899
99100 // resize
100101 useEffect ( ( ) => {
@@ -119,6 +120,21 @@ export function BaseChart({ isDark, data, chartType, dataConfig, styleConfig }:
119120 }
120121 } , [ chartRef . current ] )
121122
123+ // screen full
124+ useEffect ( ( ) => {
125+ const handleFullscreenChange = ( ) => {
126+ setScreenFull ( ! screenFull )
127+ } ;
128+
129+ document . addEventListener ( 'fullscreenchange' , handleFullscreenChange ) ;
130+ document . addEventListener ( 'webkitfullscreenchange' , handleFullscreenChange ) ;
131+
132+ return ( ) => {
133+ document . removeEventListener ( 'fullscreenchange' , handleFullscreenChange ) ;
134+ document . removeEventListener ( 'webkitfullscreenchange' , handleFullscreenChange ) ;
135+ } ;
136+ } , [ ] ) ;
137+
122138 if ( isLoading ) {
123139 return (
124140 < div className = "w-full h-full flex items-center justify-center" >
@@ -201,7 +217,7 @@ const getCartesianChartOption = (
201217 const isHorizontal = chartType . includes ( 'horizontal' ) ;
202218 const isStacked = chartType . includes ( 'stacked' ) ;
203219 const isLineOrArea = chartType . includes ( 'line' ) || chartType . includes ( 'area' ) ;
204- const isArea = chartType . includes ( 'area' ) || chartType === 'stacked-line' ; // Depending on logic
220+ const isArea = chartType . includes ( 'area' )
205221
206222 // Tooltip
207223 const tooltipFormatter = ( params : any [ ] ) => {
@@ -299,7 +315,8 @@ const getCartesianChartOption = (
299315 name : s . name ,
300316 data : processedData ,
301317 type : isLineOrArea ? 'line' : 'bar' ,
302- symbol : 'none' ,
318+ symbol : 'circle' ,
319+ symbolSize : 0 ,
303320 itemStyle : {
304321 borderRadius : ( ! isLineOrArea && ! isStacked )
305322 ? ( isHorizontal ? [ 0 , 4 , 4 , 0 ] : [ 4 , 4 , 0 , 0 ] )
@@ -308,7 +325,12 @@ const getCartesianChartOption = (
308325 } ;
309326
310327 if ( styleConfig . showDataLabel ) {
311- item . label = { show : true , position : isLineOrArea ? 'top' : 'inside' } ;
328+ item . label = {
329+ show : true ,
330+ position : 'top' ,
331+ fontSize : 10 ,
332+ color : "#666" ,
333+ } ;
312334 }
313335 if ( isStacked ) item . stack = 'total' ;
314336 if ( isArea ) item . areaStyle = { } ;
@@ -407,11 +429,12 @@ const buildLegendOption = (styleConfig: ComponentStyleConfig, seriesNames?: stri
407429const buildTooltipOption = ( type : 'axis' | 'item' , formatter : ( params : any ) => string ) => {
408430 return {
409431 trigger : type ,
410- axisPointer : type === 'axis' ? { type : 'shadow' } : undefined ,
411- appendToBody : true ,
412432 confine : true ,
433+ axisPointer : type === 'axis' ? { type : 'shadow' } : undefined ,
413434 enterable : true ,
414435 extraCssText : 'max-height: 500px; overflow-y: auto;' ,
415- formatter,
436+ appendToBody : ! document . fullscreenElement ,
437+ // renderMode: 'html',
438+ formatter
416439 } ;
417440} ;
0 commit comments