i'm making a line chart and it's awesome.
but! (it's a little but)
the little colored indicators in my legend that tell me which series is which come out as lines, but i want them to come out as big fat squares like they do in the designer.
i've attached what they look like in the designer (which is what i want)
however this is what they look like when i run the code
you see how they're little lines, and it's hard to tell what color it is?
how do i make them big, fat squares? i can't find the right property to tickle.
unfortunately this can't be changed through a property setting; it is the difference between using the series collection as a datasource and using the datasource property ... that is, the legend behaves a little differently.
here's some code you can use as a FillSceneGraph event handler to remove the lines and replace them with boxes.
private void ultraChart1_FillSceneGraph(object sender, FillSceneGraphEventArgs e) { PrimitiveCollection primitivesToAdd = new PrimitiveCollection(); PrimitiveCollection primitivesToRemove = new PrimitiveCollection(); foreach (Primitive p in e.SceneGraph) { if (p is Polyline && !string.IsNullOrEmpty(p.Path) && p.Path.Contains("Legend")) { Polyline legendLine = (Polyline)p; Point startPoint = legendLine.points[0].point; Point endPoint = legendLine.points[legendLine.points.Length - 1].point; Box newLegendIcon = new Box(startPoint, endPoint.X - startPoint.X, 5); newLegendIcon.PE = p.PE; newLegendIcon.PE.StrokeWidth = 1; primitivesToRemove.Add(legendLine); primitivesToAdd.Add(newLegendIcon); } } foreach (Primitive p in primitivesToRemove) { e.SceneGraph.Remove(p); } e.SceneGraph.AddRange(primitivesToAdd.ToArray()); }