How do i get an IPointInformation model for a tooltip?

<ChartTooltipSettings Enable="true">
                <Template>
                    @{
                        var data = context as IPointInformation;
                        <div>
                            <span>@DataSource[(int)data.SeriesIndex].MyCustomFieldWithExtraInfo</span>
                        </div>
                    }
                </Template>
</ChartTooltipSettings>

I want to do something like the above? any advice

1 Reply

SM Srihari Muthukaruppan Syncfusion Team December 8, 2020 08:43 AM UTC

Hi Ryan, 
 
We have analysed your query. From that, we suggest you to use IChartTemplate context to get the data values. If you need to change the type kindly revert the use case scenario for further analysis and provide you solution sooner. Based on your requirement we have prepared a tooltipTemplate sample for your reference to access the data inside tooltip template. Please find the below sample, code snippet and screenshot for your reference. 
 
 
Code Snippet: 
<SfChart @ref="@ChartObj" UseGroupingSeparator="true" Title="Profit Comparison of A and B"> 
        // add your additional code here 
        <ChartTooltipSettings Enable="true" Header="(4302) Daisy Street"> 
            <Template> 
                @{ 
                    var data = context as IChartTemplate; 
                    <div> 
                        <table style="width:100%;  border: 1px solid black;"> 
                            <tr><td>(4302) Daisy Street </td><td></td></tr> 
                            <tr><td>Gross Sales % : </td><td> @data.Y</td></tr> 
                            <tr><td>Total Net Sales : </td><td> @data.X</td></tr> 
                        </table> 
                    </div> 
                } 
            </Template> 
        </ChartTooltipSettings> 
        // add your additional code here 
    </SfChart> 
 
// add your additional code here 
 
 
Screenshot: 
 
 
Let us know if you have any concerns. 
 
Regards, 
Srihari M 


Loader.
Up arrow icon