Multiple charts per form

TeeChart for ActiveX, COM and ASP
Post Reply
Newbie
Newbie
Posts: 1
Joined: Wed Dec 28, 2005 12:00 am

Multiple charts per form

Post by » Wed Feb 08, 2006 10:04 pm

Hi all

I'm on TChart v 7.0

I want to develop a dashboard like form with Tee Chart. My page would have a bar chart with 2 pie charts below the bar chart. Does Tee Chart allow multiple chart types per page in a form?

How can I link the pie charts to the bar charts such that the pie charts will change depending on which bar I click on?

Your advice most appreciated. Thanks

Best Regards

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

Post by Narcís » Thu Feb 09, 2006 9:45 am

Hi,

Yes, this can be done using the approach shown at the code below. You can also position the charts as shown in the Multiple Pies example at All Features\Welcome!\Chart Styles\Standard\Pie in the TeeChart features demo which can be found at TeeChart's program group.

Code: Select all

Private Sub Form_Load()
    With TChart1.Series(0)
        .Add 12000, "Monitor", vbBlue
        .Add 22000, "Keyboard", vbRed
        .Add 52000, "Mouse", vbGreen
        .Add 8000, "Printer", vbWhite
        .Add 23000, "Webcam", vbYellow
    End With
    
    TChart2.Visible = False
End Sub

Private Sub TChart1_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    TChart2.Visible = True
    
    TChart2.Header.Text.Clear
    TChart2.Header.Text.Add "Monthly " + TChart1.Series(0).ValueMarkText(ValueIndex) + " sales"
    
    Dim NumProds As Long
    NumProds = TChart1.Series(0).YValues.Value(ValueIndex)
    
    Dim Val As Double
    With TChart2.Series(0)
        .Clear
        .Add GenerateValue(NumProds), "January", clTeeColor
        .Add GenerateValue(NumProds), "February", clTeeColor
        .Add GenerateValue(NumProds), "March", clTeeColor
        .Add GenerateValue(NumProds), "April", clTeeColor
        .Add GenerateValue(NumProds), "May", clTeeColor
        .Add GenerateValue(NumProds), "June", clTeeColor
        .Add GenerateValue(NumProds), "July", clTeeColor
        .Add GenerateValue(NumProds), "August", clTeeColor
        .Add GenerateValue(NumProds), "September", clTeeColor
        .Add GenerateValue(NumProds), "October", clTeeColor
        .Add GenerateValue(NumProds), "November", clTeeColor
        .Add NumProds, "December", clTeeColor
    End With
    
    TChart2.Environment.InternalRepaint
    TChart2.Left = TChart1.Left
    TChart2.Top = TChart1.Top
    TChart2.Width = TChart1.Width
    TChart2.Height = TChart1.Height
End Sub

Function GenerateValue(NumProducts) As Double
    GenerateValue = (((NumProducts / 3) - 0 + 1) * Rnd + 0)
    NumProducts = NumProducts - GenerateValue
End Function

Private Sub TChart2_OnClick()
    TChart2.Visible = False
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

Post Reply