Is it possible to add additional information to Tooltip or at each chart DateTime category

Hi
I am testing SfChart to display financial data for certain months. However I somehow want to show the total amount for certain months in graph, either in tooltip, or under each DateTime category, which would be much better.

I digged for a while in a documentation but I haven't found anything that would help me get such result, or maybe I just missed something important.

My question is if showing such information as shown in picture with red text is possible with current SfChart for blazor. Without affecting graph values display, just showing total value.

I include desired result picture.


Thanks for your answear.

3 Replies 1 reply marked as answer

DG Durga Gopalakrishnan Syncfusion Team October 29, 2020 02:50 PM UTC

Hi Lukas, 

You can customize the tooltip text using SharedTooltipRender event. We have calculated sum of points and displayed as total in tooltip as per your requirement. Please check with below code snippet and sample. 

<SfChart Title="Mobile Game Market by Country"> 
        <ChartEvents SharedTooltipRender="OnTooltipRender" /> 
</SfChart> 
@code { 
void OnTooltipRender(ISharedTooltipRenderEventArgs args) 
    { 
        List<String> tmpList = args.Text.ToList(); 
        var count = tmpList.Count; 
        double sum = 0; 
        for (int i = 0; i< count; i++) 
        { 
            var str = tmpList[i]; 
            Regex regex = new Regex("<b>(.*)</b>"); 
            var v = regex.Match(str); 
            sum = sum + Convert.ToDouble(v.Groups[1].ToString()); 
        } 
        tmpList.Add("Total: " + sum.ToString("0.00")); 
        args.Text = tmpList.ToArray(); 
    } 
} 

 

Please revert us, if you have any concerns. 

Regards, 
Durga G 


Marked as answer

LU lukas November 4, 2020 10:04 AM UTC

Hi Durga

This is the exact solution I was looking for. 
Thanks again.

Best regards, 
Lukas V. 


DG Durga Gopalakrishnan Syncfusion Team November 5, 2020 06:08 AM UTC

Hi Lukas, 
  
Most welcome. Please get back to us, if you need further assistance. 
  
Regards, 
Durga G 


Loader.
Up arrow icon