We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

cutomizing tool tip

I have a multiple series line chart, and I was wondering if there is a way to customize the tooltip so when I hover over a point I can add a comment about the point. Then I will save the comment to my database so next time I look at this graph I can see the comment I left. Wasn't sure if this is possible? Right now my tooltip displays the x and y values for the point I'm hovering over.

Here is my code in the view:

<div>
            @Html.EJS().Chart("stdDevAsic").PrimaryXAxis(px => px.Title("Image Number").
                                         ValueType(Syncfusion.EJ2.Charts.ValueType.Category)).Series(series =>
                                         {
                                             for (var i = 0; i < countAsic; i++)
                                             {
                                                 series.Type(
                                               Syncfusion.EJ2.Charts.ChartSeriesType.Line
                                           ).DataSource(ViewBag.StandardDeviationAsic[i]).Name(ViewBag.AsicNames[i]).XName("ImageNumber").YName("Value").Add();
                                             }
                                         }
                                         ).PrimaryYAxis(py => py.Title("Value")).Title("Standard Deviation of Asics").Tooltip(tt => tt.Enable(true)).ZoomSettings(z => z.EnableMouseWheelZooming(true)).Render()
        </div>

Thanks.

2 Replies

KC Kalaimathi Chellaiah Syncfusion Team July 15, 2019 08:28 AM UTC

Hi Team,

We are validating the requested requirement and we will update the status on or before 6:00PM IST (July 15, 2019).

Thanks,
Kalai.
 



KC Kalaimathi Chellaiah Syncfusion Team July 15, 2019 01:26 PM UTC

Hi Gideon, 
 
Greetings from Syncfusion. 
 
We have analyzed your query. We can achieve your requirement using tooltipRender event. Using this event we can customize the tooltip text and assign it to the args.text. This event fires when hovering over on the chart point. We have prepared a sample based on your requirement. Please find below sample and code snippet, 
 
Code Snippet: 
var tooltipRender = function (args) { 
            if (args.series.index == 0) { 
                args.text = "<b>Series 1 Text</b><br/>" + args.point.x + ':' + args.point.y; 
 
            } else if (args.series.index == 1) { 
                args.text = "<b>Series 2 Text</b><br/>" +  args.point.x + ':' + args.point.y; 
            } else { 
                args.text = "<b>Series 3 Text</b><br/>" + args.point.x + ':' + args.point.y; 
            } 
        } 
 
Screenshot: 
 
 
 
Kindly check the above sample and revert us, if you have any queries. 
 
Regards, 
Kalai. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon