I'm trying to divide a bubble chart into 9 different quadrants drawing lines and labels on the chart using Scene Graph. This requires me to add 10 primitives to scene graph object. After I add the 6th primitive, the chart no longer draws the last 4 objects. I've changed the order of adding the primitives and only the first 6 get drawn, so I know the issue is not with the primitive objects.
I'm using Infragastics Win Forms 16.2. Below is the code in the scene graph
Private Sub UltraChart1_FillSceneGraph(ByVal sender As System.Object, _
ByVal e As Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs) Handles UltraBubbleChart.FillSceneGraph
Try
Dim xAxis As IAdvanceAxis = CType(e.Grid("X"), IAdvanceAxis)
Dim yAxis As IAdvanceAxis = CType(e.Grid("Y"), IAdvanceAxis)
If xAxis Is Nothing Or yAxis Is Nothing Then
Return
End If
Dim gridLine As Line = New Line(New Point(xAxis.Map(0.34), yAxis.Map(0)), New Point(xAxis.Map(0.34), yAxis.Map(1)))
gridLine.PE.Stroke = Color.Black
gridLine.PE.StrokeWidth = 5
e.SceneGraph.Add(gridLine)
gridLine = New Line(New Point(xAxis.Map(0.67), yAxis.Map(0)), New Point(xAxis.Map(0.67), yAxis.Map(1)))
gridLine = New Line(New Point(xAxis.Map(0), yAxis.Map(0.34)), New Point(xAxis.Map(1), yAxis.Map(0.34)))
gridLine = New Line(New Point(xAxis.Map(0), yAxis.Map(0.67)), New Point(xAxis.Map(1), yAxis.Map(0.67)))
Dim labelText As New Text()
labelText.PE.Fill = Color.Black
labelText.labelStyle.Font = New Font("Arial", 20.0, FontStyle.Bold)
labelText.bounds = New Rectangle(CInt(xAxis.Map(0.15)), CInt(yAxis.Map(-0.05)), 100, 25)
labelText.SetTextString("Value")
e.SceneGraph.Add(labelText)
labelText = New Text()
labelText.bounds = New Rectangle(CInt(xAxis.Map(0.45)), CInt(yAxis.Map(-0.05)), 100, 25)
labelText.SetTextString("Neutral")
labelText.bounds = New Rectangle(CInt(xAxis.Map(0.75)), CInt(yAxis.Map(-0.05)), 50, 25)
labelText.SetTextString("Growth")
labelText.bounds = New Rectangle(CInt(xAxis.Map(-0.2)), CInt(yAxis.Map(0.15)), 100, 25)
labelText.SetTextString("Small")
labelText.labelStyle.Orientation = TextOrientation.VerticalLeftFacing
labelText.bounds = New Rectangle(CInt(xAxis.Map(-0.2)), CInt(yAxis.Map(0.45)), 100, 25)
labelText.SetTextString("Mid")
labelText.bounds = New Rectangle(CInt(xAxis.Map(-0.2)), CInt(yAxis.Map(-0.45)), 100, 25)
labelText.SetTextString("Large")
Catch ex As Exception
End Try
End Sub
Below is how I set the data source
With Me.UltraBubbleChart
.DataSource = graphSource
.Axis.X.TickmarkStyle = Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Smart
.Axis.X.Labels.ItemFormat = Infragistics.UltraChart.Shared.Styles.AxisItemLabelFormat.Custom
.Axis.X.Labels.ItemFormatString = "<DATA_VALUE: ##.####>"
.Axis.X.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto
.Axis.Y.TickmarkStyle = Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Smart
.Axis.Y.Labels.ItemFormat = Infragistics.UltraChart.Shared.Styles.AxisItemLabelFormat.Custom
.Axis.Y.Labels.ItemFormatString = "<DATA_VALUE:##.####>"
.DataBind()
End With
Hello,
Thank you for sending your code. I am working to implement it in a sample so that I can check into why the rendering isn't working as expected.
Please let me know if you have any questions while I am working on this.
I looked over the code you sent and I found a few small errors. For the labels that are not showing, labelText is not set to a new instance so the settings from the next label overwrite it. Two primitives are added in this case, but they will have identical settings.
I also noticed that the vertical labels were mapped to an X value of -0.2, which may not be visible on the chart. I used a data range of 0,0 to 1,1 in my test and they were far to the left so I used a smaller value. The "Large" label in particular was mapped to a Y value of -0.45, which was completely out of view at first. Finally, the label sizes were 100 pixels wide and 25 pixels high. Swapping these values allowed the full label to be visible.
I have pasted the edited FillSceneGraph code below. Please try it out in your application and let me know whether it looks better. Please note that you may need to adjust the values slightly if your range is different from the one I used.
Dim xAxis As IAdvanceAxis = CType(e.Grid("X"), IAdvanceAxis) Dim yAxis As IAdvanceAxis = CType(e.Grid("Y"), IAdvanceAxis) If xAxis Is Nothing Or yAxis Is Nothing Then Return End If Dim gridLine As Line = New Line(New Point(xAxis.Map(0.34), yAxis.Map(0)), New Point(xAxis.Map(0.34), yAxis.Map(1))) gridLine.PE.Stroke = Color.Black gridLine.PE.StrokeWidth = 5 e.SceneGraph.Add(gridLine) gridLine = New Line(New Point(xAxis.Map(0.67), yAxis.Map(0)), New Point(xAxis.Map(0.67), yAxis.Map(1))) gridLine.PE.Stroke = Color.Black gridLine.PE.StrokeWidth = 5 e.SceneGraph.Add(gridLine) gridLine = New Line(New Point(xAxis.Map(0), yAxis.Map(0.34)), New Point(xAxis.Map(1), yAxis.Map(0.34))) gridLine.PE.Stroke = Color.Black gridLine.PE.StrokeWidth = 5 e.SceneGraph.Add(gridLine) gridLine = New Line(New Point(xAxis.Map(0), yAxis.Map(0.67)), New Point(xAxis.Map(1), yAxis.Map(0.67))) gridLine.PE.Stroke = Color.Black gridLine.PE.StrokeWidth = 5 e.SceneGraph.Add(gridLine) Dim labelText As New Text() labelText.PE.Fill = Color.Black labelText.labelStyle.Font = New Font("Arial", 20.0, FontStyle.Bold) labelText.bounds = New Rectangle(CInt(xAxis.Map(0.15)), CInt(yAxis.Map(-0.1)), 100, 25) labelText.SetTextString("Value") e.SceneGraph.Add(labelText) labelText = New Text() labelText.PE.Fill = Color.Black labelText.labelStyle.Font = New Font("Arial", 20.0, FontStyle.Bold) labelText.bounds = New Rectangle(CInt(xAxis.Map(0.45)), CInt(yAxis.Map(-0.1)), 100, 25) labelText.SetTextString("Neutral") e.SceneGraph.Add(labelText) labelText = New Text() labelText.PE.Fill = Color.Black labelText.labelStyle.Font = New Font("Arial", 20.0, FontStyle.Bold) labelText.bounds = New Rectangle(CInt(xAxis.Map(0.75)), CInt(yAxis.Map(-0.1)), 100, 25) labelText.SetTextString("Growth") e.SceneGraph.Add(labelText) labelText = New Text() labelText.PE.Fill = Color.Black labelText.labelStyle.Font = New Font("Arial", 20.0, FontStyle.Bold) labelText.bounds = New Rectangle(CInt(xAxis.Map(-0.125)), CInt(yAxis.Map(0.35)), 25, 100) labelText.SetTextString("Small") labelText.labelStyle.Orientation = TextOrientation.VerticalLeftFacing e.SceneGraph.Add(labelText) labelText = New Text() labelText.PE.Fill = Color.Black labelText.labelStyle.Font = New Font("Arial", 20.0, FontStyle.Bold) labelText.bounds = New Rectangle(CInt(xAxis.Map(-0.125)), CInt(yAxis.Map(0.75)), 25, 100) labelText.labelStyle.Orientation = TextOrientation.VerticalLeftFacing labelText.SetTextString("Mid") e.SceneGraph.Add(labelText) labelText = New Text() labelText.PE.Fill = Color.Black labelText.labelStyle.Font = New Font("Arial", 20.0, FontStyle.Bold) labelText.bounds = New Rectangle(CInt(xAxis.Map(-0.125)), CInt(yAxis.Map(1.0)), 25, 100) labelText.labelStyle.Orientation = TextOrientation.VerticalLeftFacing labelText.SetTextString("Large") e.SceneGraph.Add(labelText)