Can You Databind a Field to a Chart Series ToolTip?

Thread is closed for posting
3 posts, 0 answers
  1. David
    David avatar
    10 posts
    Member since:
    Sep 2010

    Posted 05 May 2011 Link to this post

    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. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 10 May 2011 Link to this post

    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.

  3. David
    David avatar
    10 posts
    Member since:
    Sep 2010

    Posted 10 May 2011 Link to this post

    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
Back to Top