Bars should have equal width and distance should be proper
Posted: Thu Jul 30, 2009 11:47 am
I have this code-
Public Class BAR_ORIGINAL_MAXPOINT
Public Sub New()
InitializeComponent()
InitializeChart()
End Sub
Private Sub InitializeChart()
TChart1.Panel.Brush.Color = System.Drawing.SystemColors.ActiveCaptionText
TChart1.Panel.MarginTop = 2
TChart1.Size = New System.Drawing.Size(996, 312)
TChart1.TabIndex = 78
'
'
'
'
'
'
'
'
'
TChart1.Walls.Left.Brush.Solid = False
'
'
'
TChart1.Walls.Left.Pen.Color = System.Drawing.Color.FromArgb(CType(CType(254, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
Dim barSeriesBase As Steema.TeeChart.Styles.Bar
Dim barSeriesIncrement As Steema.TeeChart.Styles.Bar
Dim bsDecrement As Steema.TeeChart.Styles.Bar
barSeriesBase = New Steema.TeeChart.Styles.Bar
barSeriesIncrement = New Steema.TeeChart.Styles.Bar
bsDecrement = New Steema.TeeChart.Styles.Bar
barSeriesBase.Add(123, "Afffffffffffffffffffffffff")
barSeriesBase.Add(456, "dr")
barSeriesBase.Add(321, "rea")
barSeriesBase.Add(555, "gggrea")
barSeriesBase.Add(5554, "gggrea")
barSeriesBase.Add(321, "rea")
barSeriesBase.Add(555, "gggrea")
barSeriesBase.Add(5554, "gggrea")
barSeriesIncrement.Add(123, "A")
barSeriesIncrement.Add(456, "dr")
barSeriesIncrement.Add(321, "rea")
barSeriesIncrement.Add(444, "ggrea")
barSeriesIncrement.Add(4441, "ggrea")
barSeriesIncrement.Add(321, "rea")
barSeriesIncrement.Add(444, "ggrea")
barSeriesIncrement.Add(4441, "ggrea")
bsDecrement.Add(123, "A")
bsDecrement.Add(456, "dr")
bsDecrement.Add(321, "rea")
bsDecrement.Add(88, "kjkj")
bsDecrement.Add(881, "kjkj")
bsDecrement.Add(321, "rea")
bsDecrement.Add(88, "kjkj")
bsDecrement.Add(881, "kjkj")
TChart1.Series.Add(barSeriesBase)
TChart1.Series.Add(bsDecrement)
TChart1.Series.Add(barSeriesIncrement)
'barSeriesBase.BarWidthPercent = 20%
'bsDecrement.BarWidthPercent = 20%
'barSeriesIncrement.BarWidthPercent = 20%
'TChart1.Series(0).Clear()
'TChart1.Series(0).Add(123, "AB")
'TChart1.Series(0).Add(456, "dr")
'TChart1.Series(0).Add(321, "rea")
barSeriesBase.MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked
'TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
'TChart1.Series(1).Clear()
'TChart1.Series(1).Add(221, "cd")
'TChart1.Series(1).Add(456, "bg")
'TChart1.Series(1).Add(321, "rea")
'TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
'TChart1.Series(2).Clear()
'TChart1.Series(2).Add(100, "csd")
'TChart1.Series(2).Add(456, "bsg")
'TChart1.Series(2).Add(321, "resa")
'TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
'TChart1.Series(3).Clear()
'TChart1.Series(3).Add(100, "csd")
'TChart1.Series(3).Add(456, "bsg")
'TChart1.Series(3).Add(321, "resa")
'TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
'TChart1.Series(4).Clear()
'TChart1.Series(4).Add(100, "csd")
'TChart1.Series(4).Add(456, "bsg")
'TChart1.Series(4).Add(321, "resa")
TChart1.Legend.CheckBoxes = True
TChart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
TChart1.Axes.Bottom.Automatic = False
TChart1.Axes.Bottom.AutomaticMaximum = True
TChart1.Axes.Bottom.AutomaticMinimum = True
TChart1.Axes.Bottom.Labels.Angle = 90
TChart1.Walls.Bottom.Pen.Width = 1
TChart1.Axes.Left.Maximum = 1800
barSeriesBase.Marks.Visible = False
barSeriesIncrement.Marks.Visible = False
bsDecrement.Marks.Visible = False
TChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom
' TChart1.Aspect.Chart3DPercent = 4
TChart1.Aspect.View3D = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TChart1.Page.MaxPointsPerPage = Val(Me.TextBox1.Text)
End Sub
End Class
==============================================
Now the issue is that i want that all bars should have same width and distance between them should be proper. That is if only 2 bars then they should not be at left and right ends, rather should have equi distance from ends and between them. the max bars i will show is upto 5 bars. the sissue is that as i increase bars the width of bars reduces. also when only 2 bars then the distance should be equi distance from ends and between them. how to do this?
Public Class BAR_ORIGINAL_MAXPOINT
Public Sub New()
InitializeComponent()
InitializeChart()
End Sub
Private Sub InitializeChart()
TChart1.Panel.Brush.Color = System.Drawing.SystemColors.ActiveCaptionText
TChart1.Panel.MarginTop = 2
TChart1.Size = New System.Drawing.Size(996, 312)
TChart1.TabIndex = 78
'
'
'
'
'
'
'
'
'
TChart1.Walls.Left.Brush.Solid = False
'
'
'
TChart1.Walls.Left.Pen.Color = System.Drawing.Color.FromArgb(CType(CType(254, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
Dim barSeriesBase As Steema.TeeChart.Styles.Bar
Dim barSeriesIncrement As Steema.TeeChart.Styles.Bar
Dim bsDecrement As Steema.TeeChart.Styles.Bar
barSeriesBase = New Steema.TeeChart.Styles.Bar
barSeriesIncrement = New Steema.TeeChart.Styles.Bar
bsDecrement = New Steema.TeeChart.Styles.Bar
barSeriesBase.Add(123, "Afffffffffffffffffffffffff")
barSeriesBase.Add(456, "dr")
barSeriesBase.Add(321, "rea")
barSeriesBase.Add(555, "gggrea")
barSeriesBase.Add(5554, "gggrea")
barSeriesBase.Add(321, "rea")
barSeriesBase.Add(555, "gggrea")
barSeriesBase.Add(5554, "gggrea")
barSeriesIncrement.Add(123, "A")
barSeriesIncrement.Add(456, "dr")
barSeriesIncrement.Add(321, "rea")
barSeriesIncrement.Add(444, "ggrea")
barSeriesIncrement.Add(4441, "ggrea")
barSeriesIncrement.Add(321, "rea")
barSeriesIncrement.Add(444, "ggrea")
barSeriesIncrement.Add(4441, "ggrea")
bsDecrement.Add(123, "A")
bsDecrement.Add(456, "dr")
bsDecrement.Add(321, "rea")
bsDecrement.Add(88, "kjkj")
bsDecrement.Add(881, "kjkj")
bsDecrement.Add(321, "rea")
bsDecrement.Add(88, "kjkj")
bsDecrement.Add(881, "kjkj")
TChart1.Series.Add(barSeriesBase)
TChart1.Series.Add(bsDecrement)
TChart1.Series.Add(barSeriesIncrement)
'barSeriesBase.BarWidthPercent = 20%
'bsDecrement.BarWidthPercent = 20%
'barSeriesIncrement.BarWidthPercent = 20%
'TChart1.Series(0).Clear()
'TChart1.Series(0).Add(123, "AB")
'TChart1.Series(0).Add(456, "dr")
'TChart1.Series(0).Add(321, "rea")
barSeriesBase.MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked
'TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
'TChart1.Series(1).Clear()
'TChart1.Series(1).Add(221, "cd")
'TChart1.Series(1).Add(456, "bg")
'TChart1.Series(1).Add(321, "rea")
'TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
'TChart1.Series(2).Clear()
'TChart1.Series(2).Add(100, "csd")
'TChart1.Series(2).Add(456, "bsg")
'TChart1.Series(2).Add(321, "resa")
'TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
'TChart1.Series(3).Clear()
'TChart1.Series(3).Add(100, "csd")
'TChart1.Series(3).Add(456, "bsg")
'TChart1.Series(3).Add(321, "resa")
'TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
'TChart1.Series(4).Clear()
'TChart1.Series(4).Add(100, "csd")
'TChart1.Series(4).Add(456, "bsg")
'TChart1.Series(4).Add(321, "resa")
TChart1.Legend.CheckBoxes = True
TChart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
TChart1.Axes.Bottom.Automatic = False
TChart1.Axes.Bottom.AutomaticMaximum = True
TChart1.Axes.Bottom.AutomaticMinimum = True
TChart1.Axes.Bottom.Labels.Angle = 90
TChart1.Walls.Bottom.Pen.Width = 1
TChart1.Axes.Left.Maximum = 1800
barSeriesBase.Marks.Visible = False
barSeriesIncrement.Marks.Visible = False
bsDecrement.Marks.Visible = False
TChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom
' TChart1.Aspect.Chart3DPercent = 4
TChart1.Aspect.View3D = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TChart1.Page.MaxPointsPerPage = Val(Me.TextBox1.Text)
End Sub
End Class
==============================================
Now the issue is that i want that all bars should have same width and distance between them should be proper. That is if only 2 bars then they should not be at left and right ends, rather should have equi distance from ends and between them. the max bars i will show is upto 5 bars. the sissue is that as i increase bars the width of bars reduces. also when only 2 bars then the distance should be equi distance from ends and between them. how to do this?