Customise pointer in Linear Gauge

Hi Syncfusion,

In LinearGaugeComponent, we use PointerDirective to display each data points on the component. 

Is there a way to show a customised tooltip with the PointerDirective? Enabling tooltip option in LinearGaugeComponent did not allow for customised tooltip with customised content. Any help would be deeply appreciated. Thank you.



Regards,

Eddy


5 Replies

IR Indumathi Ravi Syncfusion Team October 5, 2021 02:56 PM UTC

Hi Eddy, 
  
Thank you for contacting Syncfusion support. 
  
By setting the HTML DOM element to the “template” property in the “tooltip” property of the Linear Gauge, we can render customized tooltip. The pointer value can be included within the template by using the placeholder text “${value}”. Please find the code snippet for setting the tooltip template below. 
  
Code Snippet
<LinearGaugeComponent 
              tooltip={{ 
                enable: true, 
                template: '<div style="width: 90px;background: rgba(53, 63, 76, 0.90); opacity: 90%;background: rgba(53, 63, 76, 0.90);box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.40);padding-bottom: 10px;padding-top: 10px;padding-left: 10px;padding-right: 10px;border: 1px #abb9c6; color:white"> pointer : ${value} <div>'
              }} 
            > 
             <Inject services={[GaugeTooltip]} /> 
             //.. 
            </LinearGaugeComponent> 
  
We have created a sample to demonstrate the same and it can be found from the below link. 
  
Please let us know if the above solution meets your requirement and let us know if you need any further assistance. 
  
Regards, 
Indumathi R. 



EM Eddy Mackonade October 6, 2021 03:14 PM UTC

Hi  Indumathi R.,


If I do not want to use the ${value} from the pointer but rather from my own data to replace the ${value}, is it possible? Thank you.



Regards.

Eddy



IR Indumathi Ravi Syncfusion Team October 7, 2021 01:38 PM UTC

Hi Eddy, 
  
Thank you for the update. 
  
We can change the content in the tooltip template using the “tooltipRender” event. The “content” property in the argument of the event is used to change the tooltip template content. Please find the code snippet for the same below. 
  
Code Snippet
tooltipRender(args) { 
     //.. 
      args.content = '100'
     //.. 
  } 
  
We have modified the sample and it can be found from the below link. 
  
Please let us know if you need any further assistance. 
  
Regards, 
Indumathi R. 



EM Eddy Mackonade October 15, 2021 02:45 AM UTC

Ok, thank you! I will check it out!



IR Indumathi Ravi Syncfusion Team October 18, 2021 10:21 AM UTC

Hi Eddy, 
Thank you for the update. 

 
Please let us know if you need any further assistance.
 

 
Regards,
Indumathi R. 


Loader.
Up arrow icon