I would like to color one data point in chart with different colour than other points. How I can do it?
I have code like this:
xDataPointLayout.xNumericTimeSerie.Points[k].PE = new PaintElement(Color.Red); xDataPointLayout.xNumericTimeSerie.Points[k].PE.Fill = Color.Red;
but all data point are same coloured in serie.
Is there some properties, that I should take into account?
Chart is compositechart with chartLayerAppearance.
private void ultraChart1_FillSceneGraph(object sender, FillSceneGraphEventArgs e) { PrimitiveCollection primitivesToAdd = new PrimitiveCollection(); foreach (Primitive p in e.SceneGraph) { PointSet pS = p as PointSet; if (pS != null) { foreach (DataPoint dP in pS.points) { if (dP.DataPoint.PE.ElementType != PaintElementType.None) { Symbol symbolOverlay = new Symbol(dP.point, pS.icon, pS.iconSize); symbolOverlay.PE = dP.DataPoint.PE; primitivesToAdd.Add(symbolOverlay); } } } } e.SceneGraph.AddRange(primitivesToAdd.ToArray()); }
Hi David,
Can you please share some code snippets for the above problem.
I am not sure which property to use to color the points
Thanks
Thank you. I will handle FillSceneGraph event.
PointSets in a ScatterChart are all forced to use the same PaintElement/Brush. in order to color an individual point, you must handle the FillSceneGraph event, loop through e.SceneGraph, find all the PointSets therein, go to the point you want to color, and add a Symbol primitive to the SceneGraph at that same location.
Symbol primitives are just like the points in a PointSet, except they can be independently styled.
Chart type is scatterchart.