Hello all,
I am trying to mimic the Excel graph shown so that the red lines between the 2nd and 3rd lines to show the spread. Is there anyway to do this in UltraChart? Also, I am trying to get the week to show on the x-axis. I am pulling the week in from a DB2 database, and the dates are returning as required.
Thanks for all the help in advance!
This is only possible with the help of FillSceneGraph event. Here I’m using a polygon with a hatch. If you need to add each vertical line manually, you can always do that, too, since you already have the points. I’m not really sure what you mean by displaying the weeks. Does that mean week numbers? I don’t think there’s a string format that does that, and if so, you’ll need to implement IRenderLabel , find the week number from the date and insert is as a string into the label.
private void Form1_Load(object sender, EventArgs e) { ultraChart1.Data.DataSource = new int[,] { {1,2,1,3,2,4,3,5,4,5}, {4,5,4,7,4,7,6,7,9,8} }; } private void ultraChart1_FillSceneGraph(object sender, FillSceneGraphEventArgs e) { List lines = new List(); List points = new List(); foreach (var p in e.SceneGraph) { if (p is Polyline) lines.Add(p as Polyline); } if (lines.Count < 2) return; foreach (var point in lines[0].points) { points.Add(point.point); } foreach (var point in lines[1].points.Reverse()) { points.Add(point.point); } Polygon area = new Polygon(points.ToArray()); PaintElement pe = new PaintElement(); pe.ElementType = PaintElementType.Hatch; pe.Hatch = FillHatchStyle.Vertical; pe.Fill = Color.Red; pe.FillStopColor = Color.Transparent; area.PE = pe; e.SceneGraph.Add(area); }
Dave,
Thanks for your help, but I have having trouble following the code (due to the lack of knowledge of paint elements and winchart). I am actually using a composite chart with 2 layers where 2 lines that are needing connected are on the same layer. Do you have any .NET code that could be of use to me?
Thanks!
Thanks! I will look into making the lines with the code you provided, as for the weeks, I was looking to have the given date show on the x-axis, but I got it to work using the NumericTimeSeries datatype.