I need to display % utilization for several production lines over several days. So my Y axis will be the % values. I need bars for each of the production lines on each of the days. So my X axis would be groups of columns each labeled for the production line and then grouped and labeled for the date. How would I do this with the MSchart.
Below is a sample of what I need. It shows only 2 production lines (I will need to display more than 2 production lines) and does not include the production line name in the X-axis label.

I am almost there. Here is an image of the chart I am creating:

And here is the code that created it:
Private Sub ChartSetup()
Try
dvCapacityUtilization.RowFilter = ""
dvCapacityUtilization.Sort = "Period ASC, CutUpSet ASC"
Me.cuChart.BeginInit()
With Me.cuChart
.ChartAreas(0).AxisX.Interval = 30
.ChartAreas(0).AxisX.LabelStyle.Format = "MM/yy"
.ChartAreas(0).AxisX.LabelStyle.Angle = -90
.ChartAreas(0).AxisY.MajorGrid.LineColor = Color.Gray
.ChartAreas(0).AxisX.MajorGrid.LineColor = Color.White
.ChartAreas(0).AxisX.MinorGrid.LineColor = Color.White
.DataBindCrossTable(dvCapacityUtilization, _
"CutUpSet", "Period", "CapacityUtilization", "Label = CapacityUtilization")
End With
'
For Each series In Me.cuChart.Series
series.IsValueShownAsLabel = False
series.LabelFormat = "0.0%"
series.SetCustomProperty("PointWidth", "0.5")
series.SetCustomProperty("DrawingStyle", "Cylinder")
series.XValueType = DataVisualization.Charting.ChartValueType.Date
Next
Me.cuChart.EndInit()
Catch ex As Exception
ErrHandler(Me.Name & " - Chart Setup", ex)
End Try
End Sub
- How do I turn the value labels off? In my code I used IsValueShownAsLabel = False but they are still displayed. I eventually will allow the user to turn the values on or off.
- How do I format the values as XX.X%. In my code I used LabelFormat = 0.0% but that did not work.
- How can I get the X axis labels to be the dates associated with the data values. In my code I used AxisX.Interval = 30 just to get the labels on the chart.
Follow up: As stated in #1 above, I used series.IsValueShownAsLabel = False but the value labels were still displayed. To remove them I had to do the following:
For Each point in series.Points point.Label = String.Empty Next
Why should I have to do this instead of using IsValueShownAsLabel = False?