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

StackedBar100SeriesDefinition tooltip

1 Answer 40 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Jingying Wu
Top achievements
Rank 1
Jingying Wu asked on 29 Jul 2009, 09:51 PM
I'm using 2 StackedBar100SeriesDefinition, one for pass, one for fail.
How do i show on the tooltip that the percentage of pass and fail?

1 Answer, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 31 Jul 2009, 08:50 AM
Hi Jingying Wu,

Currently, the chart does not support such formatting. Here is a work-around you can use:
public Page() 
    InitializeComponent(); 
 
    this.RadChart1.DefaultView.ChartArea.ItemToolTipOpening += new ItemToolTipEventHandler(ChartArea_ItemToolTipOpening); 
 
private void ChartArea_ItemToolTipOpening(ItemToolTip2D tooltip, ItemToolTipEventArgs e) 
    DataSeriesCollection series = this.RadChart1.DefaultView.ChartArea.DataSeries; 
 
    double sum = 0; 
 
    for (int i = 0; i < series.Count; i++) 
    { 
        if (series[i].Count > e.ItemIndex) 
            sum += series[i][e.ItemIndex].YValue; 
    } 
     
    tooltip.Content = string.Format("{0:p2}",e.DataPoint.YValue / sum); 

Let me know if you need further assistance.

Kind regards,
Evtim
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Chart
Asked by
Jingying Wu
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Share this question
or