GherasimGeorgian commented on issue #18339:
URL: https://github.com/apache/echarts/issues/18339#issuecomment-5509618430

   Just use a custom tooltip:
   
   <img width="539" height="383" alt="Image" 
src="https://github.com/user-attachments/assets/497e591f-336d-4556-aa63-f52c52ca2a1e";
 />
   
   private chartInstance: ECharts | null = null;
   tooltipData = signal<PieTooltipData | null>(null);
   tooltipPos = signal({ x: 0, y: 0 });
   
   onChartInit(instance: ECharts): void {
       this.chartInstance = instance;
   
       instance.on('mouseover', { seriesType: 'pie' }, (params: any) => {
         this.tooltipData.set({
           name: params.name,
           value: params.value,
           color: params.color,
         });
         this.tooltipVisible.set(true);
       });
   
       instance.on('mouseout', { seriesType: 'pie' }, () => {
         this.tooltipVisible.set(false);
       });
   
       instance.getZr().on('mousemove', (e: any) => {
         if (this.tooltipVisible()) {
           this.tooltipPos.set({ x: e.offsetX + 16, y: e.offsetY + 16 });
         }
       });
     }
   
   
   
   html:
    <div
             echarts
             class="pie-chart"
             [options]="chartOptions()"
             (chartInit)="onChartInit($event)"
    ></div>
   
   @if (tooltipVisible() && tooltipData(); as tooltip) {
             <div
               class="custom-pie-tooltip"
               [style.left.px]="tooltipPos().x"
               [style.top.px]="tooltipPos().y"
             >
               <div class="custom-pie-tooltip__row">
                 Interval: <strong>{{ tooltip.name }}</strong>
               </div>
               <div class="custom-pie-tooltip__row">
                 {{ numberElementsLabel }} <strong>{{ tooltip.value }}</strong>
               </div>
             </div>
       }
   
   With that tehnique you can avoid CSP errors


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to