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
53790
Ultrachart as a Radar chart
posted

Question from Stackoverflow: http://stackoverflow.com/questions/14931894/ultrachart-infragistics  

have an asp .net application which uses an infragistics Ultrachart as a Radar chart. Now the chart is like below

enter image description here

Is it possible to add text next to the radians and levels like below? Any examples please?

enter image description here

Parents
No Data
Reply
  • 53790
    Verified Answer
    posted

    There are different approaches to solve this task. In attached sample I`m using Composite Radar chart with Annotations and Text primitives (please see both attachments - WinForms application and ASP application for more details) 

    Q said:
    "Is it possible to add text next to the radians and levels like below?"

    About the labels around the chart, you could use NumericSeries. By this way you could provide string and decimal value. For example:

    DataTable dt = new DataTable();

    dt.Columns.Add("Label", typeof(string));

    dt.Columns.Add("Value", typeof(double));

    dt.Rows.Add("My Label 1", 10);

    dt.Rows.Add("My Label 2", 20);

    NumericSeries series1 = new NumericSeries();

    series1.DataBind(dt,"Value", "Label");

    series1.PEs.Add(new PaintElement(Color.Red));

    myLayer.Series.Add(series1);

    this.ultraChart1.CompositeChart.Series.Add(series1);

    this.ultraChart1.CompositeChart.ChartLayers.Add(myLayer);

    Another option could be if you are using Points collection of you NumericSeries. For example:

    NumericSeries series1 = new NumericSeries();

    for (int k = 0; k < 10; k++)

    {

      series1.Points.Add( new NumericDataPoint(k + 10, "Label " + k.ToString() + "0", false));

    }

     

    About the labels near to Y axis, you could add BoxAnnotation. For example:

     private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
            {
                int k = 0;
                ultraChart1.Annotations.Annotations.Clear();
                foreach (Primitive pr in e.SceneGraph)
                {
                    if (pr.GetType() == typeof(Text) && ((Text)pr).Path == "Border.Title.Grid.Y")
                    {
                        k++;
                        string temp = ((Text)pr).GetTextString();
                        BoxAnnotation BoxAnn = new BoxAnnotation();
                        BoxAnn.Location.Type = LocationType.Pixels;
                        BoxAnn.Border.Thickness = 0;
                        BoxAnn.TextStyle.FontColor = Color.DimGray;
                        BoxAnn.Text = temp + " Custom Label " + k.ToString();
                        BoxAnn.Location.LocationX = ((Text)pr).bounds.X + 70;
                        BoxAnn.Location.LocationY = ((Text)pr).bounds.Y;
                        ultraChart1.Annotations.Add(BoxAnn);
                    }
                }
            }

    Another option is direct to override your Y axis labels with desired text value. For example:

     private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
            {
                int k = 0;
                ultraChart1.Annotations.Annotations.Clear();
                foreach (Primitive pr in e.SceneGraph)
                 {
                 if (pr.GetType() == typeof(Text) && ((Text)pr).Path == "Border.Title.Grid.Y")
                    {
                    k++;
                    string temp = ((Text)pr).GetTextString();
                    ((Text)pr).bounds.Offset(10, 0);
                    ((Text)pr).SetTextString(temp + " Custom Label " + k.ToString());
                    ((Text)pr).bounds.Width = 100;
                    }
                 }
            }

    Please take a look at the attached samples for more details and let me know if you have any questions.

    Regards

     

     

     

     

     

Children