I have a column chart that I need to display data points on. I'm not sure if this is the correct terminology so I'm including the chart I have in Excel. I need to be able to place the little triangles on the columns to represent an event that happened in that month. Make sense.
This isn't really supported out of the box. The only series that can display the triangle icons is the scatter series, but that one needs a pair of numeric coordinates and plots on numeric x and numeric y axes. The triangles would have to be added on manually by using FillSceneGraph event. You'd have to calculate the spot where you want the triangle to appear, create a Symbol primitive, set its icon and color and add it to the scene.
Symbol s = new Symbol();s.point = new Point(x, y);s.icon = SymbolIcon.Triangle;s.PE.Fill = Color.Blue;e.SceneGraph.Add(s);
Finding the x and y can be tricky. You have to loop through the SceneGraph to find the 2 Box primitives with matching Row and put the symbol between them.
Thanks Max. The triangles are actually represented by a numerical value just like the columns but my user likes the triangle for some reason. If I just use another column to display this data, most of the values are "0". How can I display the column and number if the value is greater than "0" but display nothing if the value is "0"?
That would be much harder to do, because additional columns introduce additional space that needs to be allocated to specific groups of columns. When the column's value is 0, the chart will display a column with 0 height, but the width of the column still has to be accounted for. As a result, you will have a gap where column's value is a zero. Personally, I think adding triangle symbols is much easier.
Do you have a VB.NET code example of how I could loop through the SceneGraph to accomplish this?
Hello Bill,
I am following up to see were you able to use the suggestion Max has provided using stored procedure.
Thanks,
Bhadresh
I'm still a little unclear how to get my stored procedure fed datasource to the FillSceneGraph sub and how to loop through the chart but I will give it my best shot. Thanks Max.
Something like this: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load UltraChart1.Data.DataSource = New Integer(,) {{1, 1}, {2, 2}, {3, 3}, {4, 4}} End Sub
Private Sub UltraChart1_FillSceneGraph(ByVal sender As System.Object, ByVal e As Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs) Handles UltraChart1.FillSceneGraph If e.Grid.Count = 0 Then Return End If
Dim itemsPerGroup = 2 Dim position = 2
Dim xAxis As IAdvanceAxis = e.Grid("X") Dim yAxis As IAdvanceAxis = e.Grid("Y")
Dim s As Symbol = New Symbol(SymbolIcon.Triangle, SymbolIconSize.Large) Dim pos = 1 + position * (itemsPerGroup + UltraChart1.ColumnChart.SeriesSpacing) Dim value As Double = 2.5 s.point = New Point(xAxis.Map(pos), yAxis.Map(value)) s.PE.Fill = Color.Blue e.SceneGraph.Add(s)
position = 3 value = 3.2 pos = 1 + position * (itemsPerGroup + UltraChart1.ColumnChart.SeriesSpacing) s = New Symbol(SymbolIcon.Triangle, SymbolIconSize.Large) s.point = New Point(xAxis.Map(pos), yAxis.Map(value)) s.PE.Fill = Color.Blue e.SceneGraph.Add(s) End Sub