Pep,
WHAHOOOOOOOO!
Got it to work the best by using PERCENT versus pixels and basing the values on the number of PIEs available. We have a total of THREE (3) at any one time down to only ONE (1) PIE. So, we use the delete function to get rid of the PIEs without data (i.e. Recordset is used for three series of data, if the YVALUETOTAL=0, delete the series!).
So, we need to place the ANNOTATIONS differently at each condition. Here is the code I came up with:
Private Sub DrawAnnotations()
On Error GoTo ErrRoutine
If m_enuChartType = CHT_PERF_STD_PIE_CUSTOM Then
1
Dim XCenter As Integer, YCenter As Integer, SeriesIndex As Integer, xwidth As Integer, ywidth As Integer
Dim xctr As Integer
Dim yctr As Integer
5
With TChart1
'Hide what we don't need...
For SeriesIndex = 0 To .Tools.Count - 1
.Tools.Items(SeriesIndex).Active = False
Next 'SeriesIndex
10
'Now show the series annotations for series which are visible...
For SeriesIndex = 0 To .SeriesCount - 1
.Tools.Items(SeriesIndex).Active = True
15
Select Case .SeriesCount
Case 1
XCenter = 50 + IIf(m_bChartIsPrinting = True, 5, 0)
YCenter = 50 + IIf(m_bChartIsPrinting = True, 5, 0)
20
Case 2
Select Case SeriesIndex
Case 0
XCenter = 50 + IIf(m_bChartIsPrinting = True, 5, 0)
YCenter = 45 + IIf(m_bChartIsPrinting = True, 5, 0)
Case 1
XCenter = 50 + IIf(m_bChartIsPrinting = True, 5, 0)
YCenter = 64 + IIf(m_bChartIsPrinting = True, 5, 0)
End Select
30
Case 3
Select Case SeriesIndex
Case 0
XCenter = 30 + IIf(m_bChartIsPrinting = True, 5, 0)
YCenter = 45 + IIf(m_bChartIsPrinting = True, 5, 0)
Case 1
XCenter = 68 + IIf(m_bChartIsPrinting = True, 5, 0)
YCenter = 45 + IIf(m_bChartIsPrinting = True, 5, 0)
Case 2
XCenter = 30 + IIf(m_bChartIsPrinting = True, 5, 0)
YCenter = 64 + IIf(m_bChartIsPrinting = True, 5, 0)
End Select
40
End Select
.Tools.Items(SeriesIndex).asAnnotation.Shape.ShapeStyle = fosRoundRectangle
.Tools.Items(SeriesIndex).asAnnotation.Shape.Font.Color = vbBlue
.Tools.Items(SeriesIndex).asAnnotation.Shape.Font.Bold = True
.Tools.Items(SeriesIndex).asAnnotation.Shape.CustomPosition = True
.Tools.Items(SeriesIndex).asAnnotation.Shape.Left = XCenter
.Tools.Items(SeriesIndex).asAnnotation.Shape.Top = YCenter
.Tools.Items(SeriesIndex).asAnnotation.Text = .Series(SeriesIndex).Title
50
Next 'SeriesIndex
End With
End If
Exit Sub
I had to put in a FUDGE factor of 5% when it prints, no matter what printer they used, it kinda went off center at the printer refreshed time of printing the chart.
Thanks for the excellent and fast responses!
P.S. Can you answer our Black And White Printer issue we posted the other day????
