ItemToolTipOpening is not firing

2 posts, 0 answers
  1. Joe
    Joe avatar
    17 posts
    Member since:
    Nov 2011

    Posted 05 Jan 2012 Link to this post

    Hi,
    I create my chart in code behind, I do not use seriesMapping, I add dataseries to my chart like this:
     /// <summary>
            /// Add dataseries to chart
            /// </summary>
            /// <typeparam name="T"></typeparam>
            /// <param name="chart"></param>
            /// <param name="seriesDef"></param>
            /// <param name="data"></param>
            public static void CreateDataSeries<T>(this RadChart chart, CustomSeriesDefinition<T> seriesDef, IEnumerable<T> data)
            {
                //if already there, do nothing
                if (chart.DefaultView.ChartArea.DataSeries.Any(s => s.LegendLabel == seriesDef.LegendLabel))
                    return;

                var dataSeries = ChartGenerator.CreateDefaultDataSeries(seriesDef);
                if (seriesDef.IsVisableInLegend)
                    dataSeries.LegendLabel = seriesDef.LegendLabel;
                foreach (var dataElement in data)
                {
                    var point = seriesDef.Compute(dataElement);
                    dataSeries.Add(point);

                }
                chart.DefaultView.ChartArea.DataSeries.Add(dataSeries);
            }
    and the CustomSeriesDefinition is defined here
      public CustomSeriesDefinition(string legendLabel, SeriesDefinition chartType, Func<T, DataPoint> compute, bool isVisableInLegend, bool showItemToolTips = false)
            {
                
                ChartType = chartType;
                ChartType.ShowItemToolTips = showItemToolTips;
               
                Compute = compute;
                IsVisableInLegend = isVisableInLegend;
                LegendLabel = legendLabel;

            }
    When I set the ShowItemToolTip = true, I never get the event firing for ItemToolTipOpening. Do I have to use SeriesMapping to use this event?
  2. Rahul
    Rahul avatar
    116 posts
    Member since:
    Feb 2011

    Posted 05 Jan 2012 Link to this post

    Hi Joe,
            
    Try registering event for tooltip in following way.

    radChart.DefaultView.ChartArea.ItemToolTipOpening+=new ItemToolTipEventHandler(ChartArea_ItemToolTipOpening);
     
    void ChartArea_ItemToolTipOpening(ItemToolTip2D tooltip, ItemToolTipEventArgs e)
    {
    tooltip.Content = "Disease Name : " + DiseaseName + "\n" +
                                  "# of Pts     : " + TotalPatientCount + "\n"
                                + "% of Pts     : " + intPercentage;
     }


    Regards,
    Rahul
  3. DevCraft banner
Back to Top