-
Chart Question
I have a graph to display currency amounts over a dynamic date span. The graph works fine, and I set the "AutoPlot"(?) to false so that i could manually set the Y-Axis min/max. I can set the Y-Axis min/max properties, but when I do, I lose the labels for the Y-Axis.
Does anybody know how to get the labels back?
Here is the code as i have it.
Code:
'dStart/dEnd = starting and ending dates for data
Dim cMax As Currency
bPG = True
mchSalesReport.RowCount = dEnd - dStart + 1
ReDim cCashTotal(dEnd - dStart + 1), cCheckTotal(dEnd - dStart + 1)
ReDim cCreditTotal(dEnd - dStart + 1), cGiftTotal(dEnd - dStart + 1)
ReDim cDayTotal(dEnd - dStart + 1)
ReDim cAvgTotal(cboAvgSpan.Text)
cMax = 0
With rsDailyReports
mchSalesReport.Title = Format(dStart, "dddddd") & " - " & Format(dEnd, "dddddd")
lblSpan.Caption = dStart & " - " & dEnd
For lx = 0 To (dEnd - dStart)
cCashTotal(lx) = 0: cCheckTotal(lx) = 0: cCreditTotal(lx) = 0: cGiftTotal(lx) = 0
cDayTotal(lx) = 0
Next lx
For lx = 0 To (dEnd - dStart)
.FindFirst ("Date = #" & Format(dStart + lx, "mm-dd-yy") & "#")
If .NoMatch = False Then
cCashTotal(lx) = .Fields("Cash").Value
cCheckTotal(lx) = .Fields("Check").Value
cCreditTotal(lx) = .Fields("Credit").Value
cGiftTotal(lx) = .Fields("Gift").Value
cDayTotal(lx) = cCashTotal(lx) + cCheckTotal(lx) + cCreditTotal(lx) + cGiftTotal(lx)
If cDayTotal(lx) > cMax Then cMax = cDayTotal(lx)
End If
Next lx
ly = 0
cTmp = 0
For lx = 1 To (dEnd - dStart) + 1
mchSalesReport.Row = lx
mchSalesReport.Column = 2: mchSalesReport.Data = cCashTotal(lx - 1)
mchSalesReport.Column = 3: mchSalesReport.Data = cCheckTotal(lx - 1)
mchSalesReport.Column = 4: mchSalesReport.Data = cCreditTotal(lx - 1)
mchSalesReport.Column = 5: mchSalesReport.Data = cGiftTotal(lx - 1)
mchSalesReport.RowLabel = Format(dStart - 1 + lx, "dddd")
ly = ly + 1
cTmp = cTmp + cDayTotal(lx - 1)
If ly = Val(cboAvgSpan.Text) Then
mchSalesReport.Column = 1
For lz = 0 To ly - 1
mchSalesReport.Row = lx - lz: mchSalesReport.Data = cTmp / Val(cboAvgSpan.Text)
Next lz
ly = 0
cTmp = 0
End If
Next lx
End With
With mchSalesReport.Plot
.Axis(VtChAxisIdY).ValueScale.Maximum = cMax
.Axis(VtChAxisIdY).ValueScale.MajorDivision = cMax / 10
.Axis(VtChAxisIdY).ValueScale.MinorDivision = cMax / 20
.Axis(VtChAxisIdY2).ValueScale.Maximum = cMax
.Axis(VtChAxisIdY2).ValueScale.MajorDivision = cMax / 101
.Axis(VtChAxisIdY2).ValueScale.MinorDivision = cMax / 20
End With
bPG = False