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
85
Highlight Chart Datapoints!
posted

Hi

I have a chart that I can add comments to when a data point is clicked on, and they are show as tooltips over the datapoint.

I want to be able to highlight these datapoints that have a comment.

I have the following code so far in the FileSceneGraph event:

foreach (Primitive p in e.SceneGraph)

        {

            if (p.GetType() == typeof(Polyline))

            {

                foreach (DataPoint dp in ((Polyline)p).points)

                {

                    if (dp.DataPoint != null)

                    {

                        //Get comments

                        if (comments != null)

                        {

                            BoxAnnotation baX = new BoxAnnotation();

                            baX.Text = "POINT";

                            baX.Location.Type = LocationType.Pixels;

                            baX.Border.Color = Color.White;

                            baX.Location.ValueX = dp.point.X;

                            baX.Location.ValueY = dp.point.Y;

                            ucProductBurndown.Annotations.Add(baX);

                        }

                    }

                }

            }

      }

The annotation does not appear on the graph.

Is there a way to highlight the datapoint?

 

Thanks

Parents
No Data
Reply
  • 17605
    Suggested Answer
    posted

    You need to add the annotations when you create the chart. You can try the following code:

    protected void Page_Load(object sender, EventArgs e)

        {

            this.UltraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.LineChart;

     

            this.UltraChart1.DataSource = DemoTable.Table();

            this.UltraChart1.DataBind();

     

            CalloutAnnotation annotation = new CalloutAnnotation();

            annotation.Location.Type = Infragistics.UltraChart.Shared.Styles.LocationType.RowColumn;

            annotation.Text = "Annotation";

     

            annotation.Location.Row = 0;

            annotation.Location.Column = 1;

     

            this.UltraChart1.Annotations.Add(annotation);

     

        }

     

Children
No Data