# Question on stacked column charts - I get white space in my bars!

• ### Question

• I use the chart control to make a "stacked" bat chart, but I'm finding white space in the middle of some of my columns.   Maybe I don't understand how it works.  Suppose I want a bar which is 1/3 red and 2/3 green.   I make 2 series, one of which has the number 1 as its y coordinate, and the other has the number 2.   I would expect that would produce the mixed bar, with no white space between the red and green.   Instead, I sometimes get a white chunk that is at least as large as the green.  (I'm oversimplifying, I also have zeros for some series.

Am I doing something wrong?

```   ' this is code for just one bar For j = 0 To scv.Length - 1
theSeries = .Series("Column " & scv(j).colindex)
Next```

• Edited by Wednesday, July 26, 2017 10:39 AM
Wednesday, July 26, 2017 10:38 AM

• It appears the gaps occur when there is no X axis data point for one series but there is x for the others.

In this example you can see at x = 2, series 1 has no x,y value point. But the other two have an x = 2 and y value.

```Imports System.Windows.Forms.DataVisualization.Charting

Public Class Form2
Private Xvalues0 As List(Of Integer) = New List(Of Integer)({1, 2, 3, 4, 5, 6})
Private Xvalues1 As List(Of Integer) = New List(Of Integer)({1, 3, 4, 5, 6, 8})
Private Xvalues2 As List(Of Integer) = New List(Of Integer)({1, 2, 3, 4, 5, 7})

Private Yvalues0 As List(Of Integer) = New List(Of Integer)({1, 3, 2, 3, 1, 3})
Private Yvalues1 As List(Of Integer) = New List(Of Integer)({2, 0, 5, 1, 1, 2})
Private Yvalues2 As List(Of Integer) = New List(Of Integer)({1, 2, 1, 2, 1, 2})

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
InitializeChart()
DrawChart()

End Sub

Private Sub InitializeChart()
With Chart1
.Dock = DockStyle.Fill
.Series.Clear()
Chart1.Series(0).ChartType = DataVisualization.Charting.SeriesChartType.StackedColumn
Chart1.Series(1).ChartType = DataVisualization.Charting.SeriesChartType.StackedColumn
Chart1.Series(2).ChartType = DataVisualization.Charting.SeriesChartType.StackedColumn

.Legends(0).LegendStyle = LegendStyle.Row
.Legends(0).Docking = Docking.Top
.Legends(0).Alignment = StringAlignment.Center
End With

With Chart1.ChartAreas(0)
.AxisX.Title = "Item"
.AxisX.MajorGrid.LineColor = Color.Silver
.AxisX.Maximum = 16
.AxisX.Minimum = 0.0

.AxisY.Title = "Y"
.AxisY.MajorGrid.LineColor = Color.Silver
.AxisY.Minimum = 0.0
.AxisY.Maximum = 10
End With
End Sub

Private Sub DrawChart()

For i As Integer = 0 To 5
Next

For i As Integer = 0 To 5
Next

For i As Integer = 0 To 5
`Private Xvalues1 As List(Of Integer) = New List(Of Integer)({1, 2, 3, 4, 5, 8})`