I am using UltraChart 2007.1 and am setting the PaintElement for each data point as I create it, but all the points end up being rendered with the same fill instead of using different fills for each point. How can I set each point to use a different PaintElement?
Sorry, it's not possible to color individual sections of the line in a line chart by just setting PaintElements. You have to handle FillSceneGraph event, find two data points on the line, create a new line that will overlay a section of the existing line and apply a paint element to that new line.
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e){ Polyline line = null; foreach (Primitive p in e.SceneGraph) { if (p is Polyline) { //find the first available polyline. line = p as Polyline; break; } } if (line != null) { Line l = new Line(line.points[1].point, line.points[2].point); l.PE.Stroke = Color.Red; e.SceneGraph.Add(l); }}
I need to do the same thing. I have a winforms app with a linechart, and i need to mark sections of the lines. I've been trying to do this by setting the PE on the NumericDataPoint items that i'm putting hte series, but having no luck. Is there a different chart type that I should be using instead? I'm charting a series of numbers, so figured line chart with series data would be my best bet.
Thanks,
Scott
What chart type are you using? If it's a line chart, the color of the line is not based on the datapoint color, but instead uses the series.PE. Otherwise, i don't see why this wouldn't work. Can you post your code and show how you set colors on the points?