• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1684
  • Last Modified:

Radar Chart in VB6.0

I have mschart.ocx and mschart20.ocx (from what I can tell they are the same), I need to display a Radar Chart but none of these controls has it. I have surf the net and experts-exchange site and all comments indicates that this type of chart is included in this controls, how can I display a Radar Chart in Visual Basic?

Regards
0
luis_s_urraza
Asked:
luis_s_urraza
  • 2
1 Solution
 
GrahamSkanRetiredCommented:
The mschart20 on my system does not have a Radar Chart type.
If you want to display a Radar Chart, you can insert an OLE container control on your form and choose a Chart/Graph Object. I have Microsoft Excel Chart and Microsoft Graph 2000 Chart on my system. If you right-click on the graph that is inserted while in Edit Mode, you get a Chart Type... item on the Popup where you can choose 'Radar'.
0
 
luis_s_urrazaAuthor Commented:
Thank you Graham, sorry for the late response. Do you have an example on how to change the values of this graph?

Regards
0
 
GrahamSkanRetiredCommented:
I set a reference to the Microsoft Graph Object library and modified an example from MS until it worked, that is to say, ran without error. It may not make much sense as a chart, but it should get you started.

Option Explicit

Private Sub Command1_Click()
Dim oGraphChart As Graph.Chart
Set oGraphChart = OLE1.object
   With oGraphChart
   
       'Format the embedded chart.
       .ChartArea.Font.Size = 8
       .Application.Update
       .ChartType = xlRadar
       .HasTitle = True
       .ChartTitle.Text = "Sales per Product"
       .ChartTitle.Font.Size = 12
       '.Axes(xlValue).HasTitle = True
       '.Axes(xlValue).AxisTitle.Caption = "Dollars ($)"
       .ChartArea.AutoScaleFont = False
       
       'Add data for the chart to the DataSheet in MSGraph.
       With .Application.DataSheet

           .Cells.Clear

           'Add the chart row labels.
           .Cells(2, 1).Value = "Widgets"
           .Cells(3, 1).Value = "Gadgets"
           .Cells(4, 1).Value = "Gizmos"

           'Add the chart column labels.
           .Cells(1, 2).Value = "1999"
           .Cells(1, 3).Value = "2000"

           'Add data to the chart.
           Dim r As Integer, c As Integer
           For r = 2 To 4
               For c = 2 To 3
                   .Cells(r, c).Value = Rnd() * 100000
               Next
           Next

       End With
   
       .Application.Update 'Update the changes
       .Application.Quit   'and deactivate the chart.
   
   End With

 
End Sub

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now