Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
670
ChartLabelClicked sample
posted

How can I get which chart label (not ChartData) is clicked?

For example consider the chart below: When the user clicks "AdminShare Connection" I want to get the label (and it's datavalue)

 

Parents
  • 28496
    Suggested Answer
    Offline posted

    this isn't a feature of the chart but it's possible through a hack.  handle the FillSceneGraph event and make some adjustments to the Text primitives.  something like this:

    void ultraChart1_FillSceneGraph(object sender, FillSceneGraphEventArgs e)

    {

    foreach (Primitive p in e.SceneGraph)

    {

    if (p is Text)

    {

    p.Caps |= PCaps.HitTest | PCaps.Tooltip;

    p.Layer = e.ChartCore.GetChartLayer();

    p.Chart = this.ultraChart1.ChartType;

    p.Column = p.Row = 0;

    }

    }

    }

     

    after doing this, the labels should raise the ChartDataClicked event.

Reply Children