Hi
Im trying to create a graph as below (excel example)
When trying to recreate this with ultrachart i am able to get everything to display correctly, however i would need to change the line color.
I have already searched the forums and found that it should be possible to recreate this with the composite charts, however after recreating the graph with the compositechart i again have the same linecolor as my columns (after changing ColorModel.ModelStyle = CustomLinear and adding a custompallet to the colormodel)
Any pointers to where the color should be changed on the compositechart so the line has a different color would be welcome.
Regards
Bert
Hi there,
I tried the same with WinForms UltraChart and wanted to change the color of the lines in the ColumnLineChart.
I want to draw a horizontal line, which is in the color of the first chart bar:
I added the handler for "FillSceneGraph":
private void m_chrtDotGain_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e) { foreach (Infragistics.UltraChart.Core.Primitives.Primitive prim in e.SceneGraph) { if (prim is Infragistics.UltraChart.Core.Primitives.Polyline) { prim.PE.Fill = Color.Red; } } }
This is the result:
The horizontal line is now red as desired, but also the color of the first chart bar has turned red.
Why is that?
Best regards,
Alexander
thx for creating this question, i got the sam issue, in indonesia so difficult to find the right answer, thx again
Hello Bert,
I am glad that you have been able to achieve your requirement according to my suggestion.
Please let me know if you need any further assistance with this matter.
Hi Vasya
This solved my problem, i just needed to add an extra check to see if the primitive was a polyline so i wouldnt get any exceptions.
Private Sub ucColumnLineChart_FillSceneGraph(sender As Object, e As Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs) Handles ucColumnLineChart.FillSceneGraph For Each pr As Primitive In e.SceneGraph If pr.GetType.Equals(GetType(Polyline)) Then Dim pl As Polyline = CType(pr, Polyline) If Not pl Is Nothing Then pl.PE.Fill = Drawing.Color.Red End If End If Next End Sub
Thanks!
Thank you for getting back to me.
What I can suggest for achieving your requirement is handling FillSceneGraph server side event. In this event a the Fill property of the polyline`s PE could be changed to any color of your choice. For example:
protected void UltraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e) { foreach (Primitive pr in e.SceneGraph) { Polyline pl = pr as Polyline; if (pl != null) { pl.PE.Fill = Color.Red; } } }
protected void UltraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
{
foreach (Primitive pr in e.SceneGraph)
Polyline pl = pr as Polyline;
if (pl != null)
pl.PE.Fill = Color.Red;
}
I am also attaching a sample project illustrating my suggestion.
Please feel free to contact me if you have any additional questions regarding this matter.