Hi,
I am creating a stacked bar chart programatically with one or several series across the x-axis. The chart is being created and displays fine, except I cannot work out how to change the x-axis labels to a variable text item - everything I have tried so far just results in the x-axis being labelled as 1, 2, 3 etc...
The code being used (and working at present) is:
What I want to do is display the text in the tm field as the label on the x-axis underneath each series of stacked bars. I really want to display this at an angle, but I think I can work out how this is done, not just how to get the label text to show something other than the number.
David Penny
I am creating a stacked bar chart programatically with one or several series across the x-axis. The chart is being created and displays fine, except I cannot work out how to change the x-axis labels to a variable text item - everything I have tried so far just results in the x-axis being labelled as 1, 2, 3 etc...
The code being used (and working at present) is:
Dim cs_hours As New ChartSeries |
cs_hours.Name = "Hours Recorded" |
Dim cs_under As New ChartSeries |
cs_under.Name = "Hours Deficit" |
Dim cs_over As New ChartSeries |
cs_over.Name = "Hours Over" |
cs_hours.Type = ChartSeriesType.StackedBar |
cs_under.Type = ChartSeriesType.StackedBar |
cs_over.Type = ChartSeriesType.StackedBar |
cs_hours.Appearance.FillStyle.FillType = Styles.FillType.Solid |
cs_hours.Appearance.FillStyle.MainColor = Drawing.Color.Green |
cs_under.Appearance.FillStyle.FillType = Styles.FillType.Solid |
cs_under.Appearance.FillStyle.MainColor = Drawing.Color.Blue |
cs_over.Appearance.FillStyle.FillType = Styles.FillType.Solid |
cs_over.Appearance.FillStyle.MainColor = Drawing.Color.Red |
cs_hours.Appearance.LabelAppearance.Visible = False |
cs_under.Appearance.LabelAppearance.Visible = False |
cs_over.Appearance.LabelAppearance.Visible = False |
Chart.Series.Add(cs_hours) |
Chart.Series.Add(cs_under) |
Chart.Series.Add(cs_over) |
While dr.Read |
Dim tm As String = dr.Item(0) |
Dim hrs As Decimal = dr.Item(1) |
Dim ehrs As Decimal = dr.Item(2) |
Dim ah, vh, rh As Decimal |
... |
cs_hours.AddItem(ah, tm, Drawing.Color.Green) |
cs_under.AddItem(vh, "", Drawing.Color.Blue) |
cs_over.AddItem(rh, "", Drawing.Color.Red) |
End While |
What I want to do is display the text in the tm field as the label on the x-axis underneath each series of stacked bars. I really want to display this at an angle, but I think I can work out how this is done, not just how to get the label text to show something other than the number.
David Penny