Multi Pie Chart Title

TeeChart for ActiveX, COM and ASP
Post Reply
jetgeek
Newbie
Newbie
Posts: 13
Joined: Thu Dec 02, 2004 5:00 am

Multi Pie Chart Title

Post by jetgeek » Sat Sep 03, 2005 2:00 pm

Is there any way to display a title directly underneath a pie chart. I would like to display the current month/year for the data that is being displayed directly underneath the pie chart. I have multiple pie charts in my graph so I would need this funtionality for all displayed pies.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Sep 05, 2005 7:33 am

Hi JW,

Yes, you can use TChart.Canvas.TextOut method as shown here:

Code: Select all

Private Sub Form_Load()
  With TChart1
    .Legend.Visible = True
    For i = 0 To 3
      .AddSeries scPie
      .Series(i).FillSampleValues 7
      .Series(i).Marks.Style = smsValue
    Next i
  End With
End Sub

Private Sub TChart1_OnSeriesBeforeDrawValues(ByVal SeriesIndex As Long)
  'Place the new location of the Chart before painting the Series
  With TChart1
    Select Case SeriesIndex
      Case 0: .ChartRect 0, 0, .Canvas.Width / 2, .Canvas.Height / 2
              .Canvas.TextOut .Canvas.Width / 4, (.Canvas.Height / 2) - 10, "Series" + CStr(SeriesIndex)
      Case 1: .ChartRect .Canvas.Width / 2, 0, .Canvas.Width, .Canvas.Height / 2
              .Canvas.TextOut .Canvas.Width / 1.3, (.Canvas.Height / 2) - 10, "Series" + CStr(SeriesIndex)
      Case 2: .ChartRect 0, .Canvas.Height / 2, .Canvas.Width / 2, .Canvas.Height
              .Canvas.TextOut .Canvas.Width / 4, .Canvas.Height - 20, "Series" + CStr(SeriesIndex)
      Case 3: .ChartRect .Canvas.Width / 2, .Canvas.Height / 2, .Canvas.Width, .Canvas.Height
              .Canvas.TextOut .Canvas.Width / 1.3, .Canvas.Height - 20, "Series" + CStr(SeriesIndex)
    End Select
  End With
End Sub
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

jetgeek
Newbie
Newbie
Posts: 13
Joined: Thu Dec 02, 2004 5:00 am

Post by jetgeek » Wed Mar 01, 2006 6:44 pm

Narcís,

Many thanks on this answer. Sorry it took so long to return the post-reply, but I had to resort to using the annotations versus the printing the text (plus the annotations were a big hit w/ QA).

I THINK that trapping the events at print-time for a var like say, m_bChartPrinting, in the code as described above and alter the FONT size by using the HEIGHT of the printer font may solve some BIG printing problems?

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Mar 07, 2006 5:44 pm

Hi,

I'm not sure what you refer here, using the above code you should be able to print the pies with the text into the pie chart.

In case you want to change the font and print , you should use font.height to define the font size.

Post Reply