Hi,
I am creating a Bar Graph and I am struggling to align the “Labels” properly on the bottom. The space between the labels are not the same. What am I missing here to acheive this?
Thank you in advance!
[code]
Private Sub mDrawWeeklyEggCountGraph(inArrayData() as Double, inDate as Date)
// The labels for the bar chart
dim labels(-1) as string = array(“Su”,“Mo”, “Tu”, “We”, “Th”, “Fr”,“Sa”,“Total”)
// Create a XYChart object of size 540 x 375 pixels
dim c as new CDXYChartMBS(276,200)
// Add Gradient BackGround
c.setBackground(c.linearGradientColor(0, 0, 0, c.getHeight,&hffffff,&hBFBFBF))
call c.setPlotArea(40, 8, 200, 106, c.linearGradientColor(0, 55, 0, 335, &hf9f9ff, &h6666ff), -1, &hffffff, &hffffff)
// Set the x axis labels
call c.xAxis.setLabels labels
// Draw the ticks between label positions (instead of at label positions)
c.xAxis.setTickOffset(0)
// Set axis label style to 8pts Arial Bold
call c.xAxis.setLabelStyle(“SF Old Republic SC”, 7)
call c.yAxis.setLabelStyle(“SF Old Republic SC”, 7)
// Set axis line width to 2 pixels
c.xAxis.setWidth(2)
c.yAxis.setWidth(2)
// Add a multi-bar layer with 3 data sets
dim layer as CDBarLayerMBS
layer=c.addBarLayer(c.kSide,2)
call layer.addDataSet(inArrayData, &h6666ff,“Egg Count”)
// Convert Month Number to String
Dim CurrentMonth as String = fConvertMonthIntToMonthString(inDate.Month)
Dim CurrentMonthLen as Integer = CurrentMonth.len *8
Dim YearString as String = Str(inDate.Year)
WeekEndDate = fFindEndOfWeek(inDate)
NextMonth = fGetNextMonthString(CurrentMonth)
PrevMonth = fGetPrevMonthString(CurrentMonth)
NumOfDaysPrevMonth = fNumOfDaysInMonth(PrevMonth)
// Show Previous month title if we go into the previous month
if WeekEndDate-7 <= 0 Then AddPrevMonTitle = True
If AddPrevMonTitle = False Then
call c.addText(Self.Width/2-CurrentMonthLen,5,CurrentMonth+" “+YearString,“SF Old Republic SC”,9,&h000000)
Elseif AddPrevMonTitle = True Then
call c.addText(Self.Width/2-CurrentMonthLen,5,PrevMonth+” / " + CurrentMonth+" "+YearString,“SF Old Republic SC”,9,&h000000)
End if
// Set bar border to transparent. Use glass lighting effect with light direction
// from left.
layer.setBorderColor(c.kTransparent, c.glassEffect(1,c.kTopLeft,4))
// Configure the bars within a group to touch each others (no gap)
//layer.setBarGap(1, c.kTouchBar)
// Output the chart
WeeklyStats_GraphPicture=c.makeChartPicture
Invalidate(False)
End Sub[/code]