How to get Value label in chart

2 posts, 0 answers
  1. Dwiyan
    Dwiyan avatar
    2 posts
    Member since:
    May 2018

    Posted 11 Jul 2018 Link to this post

    Is there an event for clicking a chart label Item



  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    4125 posts

    Posted 11 Jul 2018 Link to this post

    Hello, Dwiyan,    

    RadChartView does not provide means for directly attaching a click event to the label elements. You can achieve your task by handling the MouseClick event of the control and after checking for the mouse and the labels locations: 

    public RadForm1()
        BarSeries barSeries = new BarSeries("Performance", "RepresentativeName");
        barSeries.Name = "Series1";
        barSeries.LegendTitle = "Series1";
        barSeries.ShowLabels = true;
        barSeries.DataPoints.Add(new CategoricalDataPoint(177, "Harley"));
        BarSeries barSeries2 = new BarSeries("Performance", "RepresentativeName");
        barSeries2.Name = "Series2";
        barSeries2.LegendTitle = "Series2";
        barSeries2.ShowLabels = true;
        barSeries2.DataPoints.Add(new CategoricalDataPoint(141, "White"));
        this.radChartView1.ShowLegend = true;
        this.radChartView1.MouseClick += radChartView1_MouseClick;
    private void radChartView1_MouseClick(object sender, MouseEventArgs e)
        foreach (ChartSeries series in this.radChartView1.Series)
            foreach (BarPointElement pointElement in series.Children)
                BarLabelElement labelElement = pointElement.Children[0] as BarLabelElement;
                Rectangle rect = CartesianRenderer.ToRectangle(labelElement.GetLayoutSlot());
                rect.Offset(this.radChartView1.ChartElement.View.Margin.Left, this.radChartView1.ChartElement.View.Margin.Top);
                if (rect.Contains(this.radChartView1.ChartElement.Wrapper.PointFromControl(e.Location)))

    I hope this information helps. If you have any additional questions, please let me know.  
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top