Private Sub FillCalendar()
Dim newFont = New Font("Calibri", 7.0F, FontStyle.Bold)
Dim EE As Integer
Dim vbYear As Integer
Dim Incident As String
Dim ColIndex As Integer 'Day of the month, also the name of the column
Dim RowIndex As Integer ' Month of the year, also row index + 1
EE = CInt(RadTextBoxElement10.Text) ' Employee id #
vbYear = CInt(RadDropDownListElement1.SelectedIndex + 2007) 'Year for calendar
'connection string and mysqlconnect
Dim connstring As String = ("Data Source=MyServer\SQLINSTANCE;Initial Catalog=DATABASENAME;Persist Security Info=True;User ID=MYUSER;Password=MYPASS")
Dim conn As New SqlConnection(connstring)
Dim selectSQL As String
'create selection query
selectSQL = ("Select aDay, aMonth, Incidents From View_AttCombined Where (GPID like '" & EE & "') and (aYear like '" & vbYear & "')")
'create selection command
Dim cmd As New SqlCommand(selectSQL, conn)
'set cmd property
cmd.CommandType = CommandType.Text
'open database
conn.Open()
'create and execute the reader
Dim myreader As SqlDataReader = cmd.ExecuteReader
While myreader.Read
ColIndex = myreader.GetInt32(0)
RowIndex = myreader.GetInt32(1) - 1
Incident = myreader.GetString(2)
Me.RadGridView1.Rows(RowIndex).IsCurrent = True
Me.RadGridView1.Columns(ColIndex).IsCurrent = True
Me.RadGridView1.CurrentCell.Value = Incident
If Len(Me.RadGridView1.CurrentCell.Value) > 3 Then
Me.RadGridView1.CurrentCell.Font = newFont
Else
End If
End While
conn.Close()
Me.AttendanceTableAdapter.Fill(Me.AttendanceDataSet.Attendance, CInt(RadTextBoxElement10.Text), CInt(RadDropDownListElement1.SelectedIndex + 2007))
Me.AttCalCommentsTableAdapter.Fill(Me.CalCommentDataSet.AttCalComments, CInt(RadTextBoxElement10.Text), CInt(RadDropDownListElement1.SelectedIndex + 2007))
Me.RadGridView1.CurrentRow = Me.RadGridView1.Rows(0)
Me.RadGridView1.CurrentColumn = Me.RadGridView1.Columns(1)
End Sub
I have a bar chart that has items overlapping - how do I center these overlapped bars
The code below aligns all the items to the left.
Overlapping is 100% but the additional stacked bars have had their widths reduced to half the width of the main series column. Please view the attached chart to see what I am attempting to achieve.
Dim oTargetSeries As New ChartSeries("Target")
Dim oAchievementSeries As New ChartSeries("Target Achievement")
Dim oVarianceAccSeries As New ChartSeries("Variance - Accessories")
Dim oVariancePartsSeries As New ChartSeries("Variance - Parts")
 
 
With oTargetSeries
.Clear()
.Appearance.FillStyle.FillType = FillType.Solid
.Appearance.FillStyle.MainColor = Color.Black
.Type = ChartSeriesType.Line
.YAxisType = ChartYAxisType.Primary
.Appearance.LabelAppearance.Visible = False
End With
With oAchievementSeries
.Clear()
.Appearance.FillStyle.FillType = FillType.Solid
.Appearance.FillStyle.MainColor = Color.Green
.Type = ChartSeriesType.Bar
.YAxisType = ChartYAxisType.Primary
.Appearance.LabelAppearance.Visible = False
End With
 
With oVarianceAccSeries
.Clear()
.Appearance.FillStyle.FillType = FillType.Solid
.Appearance.FillStyle.MainColor = Color.Yellow
.Type = ChartSeriesType.StackedBar
.YAxisType = ChartYAxisType.Secondary
.Appearance.BarWidthPercent = 50
End With
With oVariancePartsSeries
.Clear()
.Appearance.FillStyle.FillType = FillType.Solid
.Appearance.FillStyle.MainColor = Color.Blue
.Type = ChartSeriesType.StackedBar
.YAxisType = ChartYAxisType.Secondary
.Appearance.BarWidthPercent = 50
End With
oChart.Appearance.BarOverlapPercent = 100
With oChart
.PlotArea.Appearance.FillStyle.FillType = FillType.Solid
.PlotArea.Appearance.FillStyle.MainColor = Color.White
.IntelligentLabelsEnabled = False
.PlotArea.XAxis.AutoScale = False
.PlotArea.XAxis.IsZeroBased = False
.PlotArea.XAxis.Visible = False
.PlotArea.XAxis.AxisLabel.Visible = True
.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 320
.PlotArea.XAxis.Appearance.Width = 3
.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between
.PlotArea.YAxis.AutoScale = False
.PlotArea.YAxis2.AutoScale = False
 
.PlotArea.YAxis.Appearance.Width = 3
.PlotArea.YAxis.MaxValue = 200
.PlotArea.YAxis.MinValue = 0
.PlotArea.YAxis.Step = 20
.PlotArea.YAxis2.Appearance.Width = 3
.PlotArea.YAxis2.MaxValue = 200
.PlotArea.YAxis2.MinValue = -200
.PlotArea.YAxis2.Step = 50
.PlotArea.XAxis.Clear()
 
For Each oItem As clsRptPerformanceVsTarget In oRptPerformanceVsTargetList
Dim oChartAxisItem As New ChartAxisItem
oChartAxisItem.TextBlock.Text = oItem.CICode
.PlotArea.XAxis.Items.Add(oChartAxisItem)
Next
End With
For Each oItem As clsRptPerformanceVsTarget In oRptPerformanceVsTargetList
Dim oTargetItem As New ChartSeriesItem()
Dim oAchievementItem As New ChartSeriesItem()
Dim oVarianceAccItem As New ChartSeriesItem()
Dim oVariancePartsItem As New ChartSeriesItem()
With oTargetItem
.YValue = oItem.Target
End With
With oAchievementItem
.YValue = oItem.TargetAchievement
'.Name = oItem.CICode
End With
With oVarianceAccItem
.YValue = oItem.VarianceAccessories
End With
With oVariancePartsItem
.YValue = oItem.VarianceParts
End With
oTargetSeries.Items.Add(oTargetItem)
oAchievementSeries.Items.Add(oAchievementItem)
oVarianceAccSeries.Items.Add(oVarianceAccItem)
oVariancePartsSeries.Items.Add(oVariancePartsItem)
Next
With oChart
.Series.Add(oTargetSeries)
.Series.Add(oAchievementSeries)
.Series.Add(oVarianceAccSeries)
.Series.Add(oVariancePartsSeries)
End With