Is there a way to make the legend more readable for a LineChart on a CompositeChart. To make it easier to understand my question I have included the image of my sample app:
The lines on the legend are so small that it is difficult to tell what they are. I am using NetAdvantage for Windows Forms 2008 Vol. 1. I would appreciate any advice.
Thanks,Kerry Jenkins
you can use FillSceneGraph or ChartDtawItem event to do this.
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e){ foreach (Primitive p in e.SceneGraph) { Polyline poly = p as Polyline; if (poly!= null && poly.Path!=null && poly.Path.ToLower().IndexOf("legend") != -1) { poly.PE.StrokeWidth = 5; } }}
Max Rivlin"] you can use FillSceneGraph or ChartDtawItem event to do this.private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e){ foreach (Primitive p in e.SceneGraph) { Polyline poly = p as Polyline; if (poly!= null && poly.Path!=null && poly.Path.ToLower().IndexOf("legend") != -1) { poly.PE.StrokeWidth = 5; } }}
How would you do this is 2007 Vol.1 version? It doesn't seem to contain a SceneGraph collection.
For any version below 7.3 you have to implement a custom layer and put that code in FillSceneGraph method.
Here's the help link with information on how to implement a custom layer:http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Chart_Writing_a_Layer_Class.html
use
dim poly as Polylineif (typeof p is Polyline) then poly = CType(p, Polyline)endif
CType cannot handle this cast directly
Max Rivlin"] For any version below 7.3 you have to implement a custom layer and put that code in FillSceneGraph method. Here's the help link with information on how to implement a custom layer:http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Chart_Writing_a_Layer_Class.html
Hi Max,
Thanks for the quick response. I've implemented the custom layer and have added it to my ASPX page. However, I got a runtime error. The error is "Specified cast is not valid".
Here is the code for the FillSceneGraph implementation in the custom layer:
Public Sub FillSceneGraph(ByVal scene As Infragistics.UltraChart.Core.SceneGraph) Implements Infragistics.UltraChart.Core.Layers.ILayer.FillSceneGraph For Each p As Primitive In scene Dim poly As Polyline = CType(p, Polyline) 'The error is on this line If Not poly Is Nothing AndAlso Not poly.Path = Nothing AndAlso Not poly.Path.ToLower().IndexOf("legend) = -1 Then poly.PE.StrokeWidth = 5 End If Next End Sub
Public Sub FillSceneGraph(ByVal scene As Infragistics.UltraChart.Core.SceneGraph) Implements Infragistics.UltraChart.Core.Layers.ILayer.FillSceneGraph
For Each p As Primitive In scene
Dim poly As Polyline = CType(p, Polyline) 'The error is on this line
If Not poly Is Nothing AndAlso Not poly.Path = Nothing AndAlso Not poly.Path.ToLower().IndexOf("legend) = -1 Then
poly.PE.StrokeWidth = 5
End If
Next
End Sub
This is where I'm actually calling the above layer (after I've set up the Legend stuff):
chart.CompositeChart.Legends.Add(legend) chart.Layer.Add("SceneGraph Layer", New SceneGraphLayer) chart.UserLayerIndex = New String() {"Default", "SceneGraph Layer"} chart.InvalidateLayers()
chart.CompositeChart.Legends.Add(legend)
chart.Layer.Add("SceneGraph Layer", New SceneGraphLayer)
chart.UserLayerIndex = New String() {"Default", "SceneGraph Layer"}
chart.InvalidateLayers()
Any further help would be appreciated.