Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
695
Reduce thickness of columns in column chart
posted

I have  an ultragrid and ultrachart...according to the data in the grid the data is displayed in the chart.Suppose i have got only one record in the grid  the output which i get in the chart is shown in the attachment(Sample).The width of the columns is too big and i want to reduce its width. i tried using below code,but then the column space between the two bars became more as shown in attachment(Sample1)

 

Private Sub UltraChart_ChartDrawItem(ByVal sender As System.Object, ByVal e As Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs) Handles UltraChart.ChartDrawItem

 

        If ds Is Nothing Then Exit Sub

        If dt.Rows.Count <= 3 Then

            Dim columnWidth As Integer = 15

 

            Dim box As Infragistics.UltraChart.Core.Primitives.Box = TryCast(e.Primitive, Infragistics.UltraChart.Core.Primitives.Box)

 

            If box Is Nothing Then

                Exit Sub

            End If

 

            If box.DataPoint Is Nothing Then

                Exit Sub

            End If

 

            Dim dWidth As Integer = box.rect.Height - columnWidth

 

            If dWidth <= 0 Then

                Exit Sub

            End If

            box.rect.Width = columnWidth

            box.rect.X += dWidth / 2

        End If       

    End Sub