This is a migrated thread and some comments may be shown as answers.

Can You Databind a Field to a Chart Series ToolTip?

2 Answers 85 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 05 May 2011, 05:29 PM
Greetings,
    Can the ActiveRegionToolTip of a RadChart be databound to a value returned directly from a datasource?  I am able to set it to the X or Y value in the Chart datapoint using #Y, etc., but if the query is returning extra text in a different field, is there a way to directly feed that into the ActiveRegionToolTip?  (i.e., without resorting to server side code when the items are databound).

Thanks
Dave

2 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 10 May 2011, 09:08 AM
Hi David,

Let's for example have a DataTable as datasouce for your Chart. You can handle the ItemDataBound event of the Chart and bind the values from a Column as ActiveRegionTooltip as shown in our demo with full source code. Here is how it's done:

protected void RadChart1_ItemDataBound(object sender, Telerik.Charting.ChartItemDataBoundEventArgs e)
       {
           if (e.SeriesItem.YValue > 30)
           {
               e.SeriesItem.ActiveRegion.Tooltip = "Attention! Temperature too high! " + '\n';
           }
           else if (e.SeriesItem.YValue < 10)
           {
               e.SeriesItem.ActiveRegion.Tooltip = "Attention! Temperature too low! " + '\n';
           }
           e.SeriesItem.ActiveRegion.Tooltip += ((DataRowView)e.DataItem)["Measurement"].ToString() + ": Temperature: " + e.SeriesItem.YValue;
       }


Regards,
Evgenia
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
David
Top achievements
Rank 1
answered on 10 May 2011, 08:12 PM
Thanks.  I was hoping for direct binding of the tooltip from a SQL data source, so that I could have the tooltip generated in a stored procedure that accesses things in the database table that wouldn't have to be passed directly to the chart.  But we can work around it this way too.

Regards
Dave
Tags
Chart (Obsolete)
Asked by
David
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
David
Top achievements
Rank 1
Share this question
or