Binding pivot chart to pivot table does not work after conversion (VB6->VBEE)

Hi,

I was using the following VB6 code and it was working fine:,

Dim pic As Integer, Charttype As Stringaa As String

Private Sub ChartRefresh()
Dim newchart
Dim c
Dim n As Integer

ChartGraph.EnableEvents = False
Set c = ChartGraph.Constants
ChartGraph.clear
Set ChartGraph.DataSource = frm_add.Analayzer_Pivottable
Set newchart = ChartGraph.Charts.Add
newchart.Type = c.chChartTypeColumnClustered
newchart.HasLegend = True
For n = 0 To newchart.SeriesCollection.Count - 1
newchart.SeriesCollection(n).SetData c.chDimValues, 0, n
Next
ChartGraph.EnableEvents = True

End Sub

Private Sub Form_Activate()
windowclose = "C"
'ChartGraph.Charts.Item(0).HasTitle = True
'ChartGraph.Charts.Item(0).Title.Caption = "Sales Value Chart"
End Sub

Private Sub Form_Initialize()
windowclose = "C"
End Sub

Private Sub Form_Load()

On Error Resume Next
Call ChartRefresh

Unload frm_template
windowclose = "C"

MDI_ANALYZER.Analyzer_tool1.Buttons.Item(6).Enabled = True
MDI_ANALYZER.printchart.Enabled = True

pic = 1
Tree.Nodes.clear
Tree.Nodes.Add , , "Chat", "Types Of Charts", "Open"
Tree.Nodes.Add "Chat", tvwChild, , "Column", "Column"
Tree.Nodes.Add "Chat", tvwChild, , "Bar", "Bar"
Tree.Nodes.Add "Chat", tvwChild, , "Line", "Line"
Tree.Nodes.Add "Chat", tvwChild, , "Pie", "Pie"
Tree.Nodes.Add "Chat", tvwChild, , "XY(Scatter)", "XY(Scatter)"
Tree.Nodes.Add "Chat", tvwChild, , "Area", "Area"
Tree.Nodes.Add "Chat", tvwChild, , "Doughnut", "Doughnut"
Tree.Nodes.Add "Chat", tvwChild, , "Radar", "rader"
Tree.Nodes.Add "Chat", tvwChild, , "Bubble", "Bubble"
Tree.Nodes.Add "Chat", tvwChild, , "Stock", "stock"
Tree.Nodes.Add "Chat", tvwChild, , "SmoothLine", "SmoothLine"
Tree.Nodes.Add "Chat", tvwChild, , "Polar", "Polor"
Tree.Nodes.Item("Chat").Expanded = True
ChartGraph.DisplayToolbar = True
ChartGraph.DisplayOfficeLogo = False

End Sub

Private Sub Form_Unload(Cancel As Integer)
MDI_ANALYZER.Analyzer_tool1.Buttons.Item(6).Enabled = False
MDI_ANALYZER.printchart.Enabled = False
windowclose = "O"
End Sub

Private Sub Tree_Expand(ByVal Node As MSComctlLib.Node)
Node.Image = "Open"
End Sub

Private Sub Tree_Collapse(ByVal Node As MSComctlLib.Node)
Node.Image = "Close"
End Sub
Sub chart_setdata()
For n = 0 To newchart.SeriesCollection.Count - 1
ChartGraph.Charts.Add.SeriesCollection(n).SetData c.chDimValues, 0, n
Next
End Sub
Private Sub Tree_NodeClick(ByVal Node As MSComctlLib.Node)
On Error Resume Next

Call chart_setdata
If Node = "Bar" Then
ChartGraph.Charts.Item(0).Type = chChartTypeBarClustered

ElseIf Node = "Column" Then
ChartGraph.Charts.Item(0).Type = chChartTypeColumnClustered

ElseIf Node = "Line" Then
ChartGraph.Charts.Item(0).Type = chChartTypeLine

ElseIf Node = "Pie" Then
ChartGraph.Charts.Item(0).Type = chChartTypePieExploded3D

ElseIf Node = "XY(Scatter)" Then
ChartGraph.Charts.Item(0).Type = chChartTypeScatterLine

ElseIf Node = "Area" Then
ChartGraph.Charts.Item(0).Type = chChartTypeArea

ElseIf Node = "Doughnut" Then
ChartGraph.Charts.Item(0).Type = chChartTypeDoughnutExploded

ElseIf Node = "Radar" Then
ChartGraph.Charts.Item(0).Type = chChartTypeRadarSmoothLine

ElseIf Node = "ScatterLine" Then
ChartGraph.Charts.Item(0).Type = chChartTypeScatterLineMarkers

ElseIf Node = "Bubble" Then
ChartGraph.Charts.Item(0).Type = chChartTypeBubble

ElseIf Node = "Stock" Then
ChartGraph.Charts.Item(0).Type = chChartTypeStockHLC

ElseIf Node = "SmoothLine" Then
ChartGraph.Charts.Item(0).Type = chChartTypeSmoothLineStacked
ElseIf Node = "Polar" Then
ChartGraph.Charts.Item(0).Type = chChartTypePolarMarkers
End If

End Sub

After converting the VB6 Project to VBExpressEdition 2005, this does not work anymore. Please help.

Thanks

Aby



Answer this question

Binding pivot chart to pivot table does not work after conversion (VB6->VBEE)

  • Thomas Freudenberg

    Hi,

    There are no errors or warnings. When it reaches the following line of code, it sets the datasource to nothing and comes out.

    Set ChartGraph.DataSource = frm_add.Analayzer_Pivottable

    Regards

    Aby


  • N_i_X

    Are you getting any errors or warnings

  • Binding pivot chart to pivot table does not work after conversion (VB6->VBEE)