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

tooltip and Item Click not working

1 Answer 46 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 24 Jun 2010, 01:36 PM
Hi,
I have successfully created a chart with a series , but cannot seem to get tooltips visible OR item click firing?
Here is the relevant code i use...

Many Thanks
Mark
this.RadChart1.SeriesMappings.Add(seriesmapping);  
this.RadChart1.DefaultView.ChartArea.ItemClick+=new EventHandler<ChartItemClickEventArgs>(ChartArea_ItemClick);  

this

 

.RadChart1.ItemsSource = ReturnChartData;

 

 

 


private SeriesMapping seriesmapping()  
        {  
            SeriesMapping _seriesMapping = new SeriesMapping();  
            _seriesMapping.SeriesDefinition = new BarSeriesDefinition();  
            ItemMapping yMap = new ItemMapping("yValue0"  , DataPointMember.YValue);  
            ItemMapping xMap = new ItemMapping("xCategory", DataPointMember.XCategory);  
 
            _seriesMapping.ItemMappings.Add(yMap);  
            _seriesMapping.ItemMappings.Add(xMap);  
            _seriesMapping.SeriesDefinition.ShowItemToolTips = true;  
            return _seriesMapping;  
        }  
 
        private void ChartArea_ItemClick(object sender, ChartItemClickEventArgs e)  
        {  
            MessageBox.Show("asfafasfasfasfasfasfasf","my message", MessageBoxButton.OK);  
        } 
    private List<ChartData> ReturnChartData()  
    {  
        List<ChartData> data = new List<ChartData>();  
        data.Add(new ChartData("Toyota", 125,10,100));  
        data.Add(new ChartData("GM", 192, 20, 90));  
        data.Add(new ChartData("VW", 151, 30, 80));  
        data.Add(new ChartData("Ford", 125, 40, 70));  
        data.Add(new ChartData("Honda", 154, 50, 60));  
        data.Add(new ChartData("Nissan", 79, 30, 50));  
        data.Add(new ChartData("PSA", 79, 20, 100));  
        data.Add(new ChartData("Hyundai", 64, 10, 46));  
 
        return data;  
    }  
 
    public class ChartData  
    {  
        public ChartData()  
        {  
 
        }  
        public ChartData(string _xCategory, int _yValue0, int _yValue1, int _yValue2)  
        {  
            this.xCategory = _xCategory;  
            this.yValue0 = _yValue0;  
            this.yValue1 = _yValue1;  
            this.yValue2 = _yValue2;  
        }  
        public ChartData(string _xCategory, int _yValue0, int _yValue1)  
        {  
            this.xCategory = _xCategory;  
            this.yValue0 = _yValue0;  
            this.yValue1 = _yValue1;  
        }  
        public ChartData(string _xCategory, int _yValue0 )  
        {  
            this.xCategory = _xCategory;  
            this.yValue0 = _yValue0;  
        }  
        public string xCategory  
        {  
            get;  
            set;  
        }  
        public int yValue0  
        {  
            get;  
            set;  
        }  
        public int yValue1  
        {  
            get;  
            set;  
        }  
        public int yValue2  
        {  
            get;  
            set;  
        }  
    } 

1 Answer, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 24 Jun 2010, 05:19 PM
Hi
I have answered my own question again.

On my page i had a textblock which was declared after the chart. The textblock had no size set, so i assume it was covering the chart (hence the tooltip and click not working). I removed the textblock and all is working ok now.

Mark
Tags
Chart
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Share this question
or