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
How to create a trend line that will display forecasted data as a dashed line?
posted

Do you have any examples of how to create a trend line that will display forecasted data as a dashed line?

so what would be great is data that is current or past would be shown as a solid line then forecasted data shown as a dashed line.

  • 53790
    Verified Answer
    posted

    One possible approach to acheive desired behavior could be if you are using FillScenGraphe event and Polyline Primitive.  For example

    private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)

            {

                List<Polyline> originals = new List<Polyline>();

                List<Polyline> fisrtStageLsit = new List<Polyline>();

                 foreach (Primitive pr in e.SceneGraph)

                {

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

                    {

                        DataPoint[] dtpFirstStage = new DataPoint[((Polyline)pr).points.Count()];

                        int k = 0;

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

                        {

                            originals.Add((Polyline)pr);

                            if (k < 4) dtpFirstStage[k] = dp;

                            k++;

                         }

                        ((Polyline)pr).lineStyle.DrawStyle = LineDrawStyle.Dot;

                        ((Polyline)pr).PE.Fill = Color.Yellow;

                        ((Polyline)pr).PE.StrokeWidth = 3;

     

                        Polyline fisrtStage = new Polyline(dtpFirstStage);

                        fisrtStage.PE.Fill = Color.LightBlue;

                        fisrtStage.PE.StrokeWidth = 4;

                        fisrtStage.lineStyle.DrawStyle = LineDrawStyle.Solid;

                         fisrtStageLsit.Add(fisrtStage);

                    }

                }

                if (fisrtStageLsit.Count > 0)

                {

                    foreach (Primitive item in fisrtStageLsit) e.SceneGraph.Add(item);

                }

             }

     

    Please take a look at the attached sample for more details