Hi ,
I want to plot a splinechart like dotted-plain line- plotted. I found in an a previous discussion something like :
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); } }
This works but only for line dotted , how can i do dotted-line-dotted ?
Thanks
Here is the sample
Hello eltorfuerte,
You could add a new Line series and extend our IF condition in the FillSceneGraph event. Please take a look at the attached sample for more details and let me know if you have any questions.
Regards
Hi Actually I have a an extra question : I changed your sample in order to have 2 lineSeries. What I want is to applied the dotted lines on only one lineserie. The other have to stay continuous (no dotted lines).
Do you know how I can do that ?
Hello Eltorfuerte,
Please take a look at the modification that I made in the code:
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 j=0,k = 0; foreach (DataPoint dp in ((Polyline)pr).points) { originals.Add((Polyline)pr); if (k > 1 && k < 6) { dtpFirstStage[j] = dp; j++; } 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); }
}
Here is the result:
I don't really understand what you mean by modify the drawstyle , in your sample eeI tried this :
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 < 2 && k >5 ) 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); } }
so what i want to see is a solid line between point nb 2 and 5 but what I have is just a dotted line.
Can you tell me what is wrong please ?