Linked PivotTable and Chart

P

Paul - Lydian

I have a webpage with a linked pivottable and chart using OWC 11. Both the
table and chart are first displayed empty then as the user updates the
content from the field list I want the two objects to reflect the changes.

The issue I have is that the chart doesn't display the data content if a
total field is added to the table (the rows/columns aspect work fine). If a
total field is added to the chart then the table updates but not the other
way around.

I'm using scripting and the code snippet I'm using is:

oChart.SetData chConstants.chDimValues, 0, 0

Any suggestions?
 
A

Alvin Bruney [ASP.NET MVP]

post a complete sample of your code that reproduces the problem.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
 
P

Paul - Lydian

Ok, Alvin. Any idea it takes to ship your book to the UK? (We ordered last
week via Lulu.)

TableSpace1.ConnectionString = provider
TableSpace1.DataMember = p_table

TableSpace1.AutoFit = vbTrue
TableSpace1.height = "100%"
TableSpace1.width = "100%"
TableSpace1.ActiveView.AutoLayout
TableSpace1.style.visibility = "visible"

Set chConstants = ChartSpace1.Constants
ChartSpace1.Clear
Set ChartSpace1.DataSource = TableSpace1

<<used to be code to add a 2nd chart>>

On Error Resume Next

For Each oChart in ChartSpace1.Charts
oChart.SetData chConstants.chDimSeriesNames, 0,
chConstants.chPivotColAggregates
oChart.SetData chConstants.chDimCategories, 0, chConstants.chPivotRows
oChart.SetData chConstants.chDimValues, 0, 0
oChart.HasLegend = vbTrue
oChart.HasTitle = vbTrue
oChart.Title.Caption = chart_title_text
Set ax = oChart.Axes(chConstants.chAxisPositionLeft)
ax.NumberFormat = "#,##0"
Next

Alvin Bruney said:
post a complete sample of your code that reproduces the problem.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Paul - Lydian said:
I have a webpage with a linked pivottable and chart using OWC 11. Both the
table and chart are first displayed empty then as the user updates the
content from the field list I want the two objects to reflect the changes.

The issue I have is that the chart doesn't display the data content if a
total field is added to the table (the rows/columns aspect work fine). If
a
total field is added to the chart then the table updates but not the other
way around.

I'm using scripting and the code snippet I'm using is:

oChart.SetData chConstants.chDimValues, 0, 0

Any suggestions?
 
A

Alvin Bruney [ASP.NET MVP]

if i understand you correctly, you need to explicitly tell the chart which
total to bind to since it can bind to several totals and the chart gets lost
on which total to use so you must explicitly instruct it on which total you
want to display. so do something like
chartspace1.setdata(c.chdimvalues,0,"the total i want to see goes here")

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Paul - Lydian said:
Ok, Alvin. Any idea it takes to ship your book to the UK? (We ordered last
week via Lulu.)

TableSpace1.ConnectionString = provider
TableSpace1.DataMember = p_table

TableSpace1.AutoFit = vbTrue
TableSpace1.height = "100%"
TableSpace1.width = "100%"
TableSpace1.ActiveView.AutoLayout
TableSpace1.style.visibility = "visible"

Set chConstants = ChartSpace1.Constants
ChartSpace1.Clear
Set ChartSpace1.DataSource = TableSpace1

<<used to be code to add a 2nd chart>>

On Error Resume Next

For Each oChart in ChartSpace1.Charts
oChart.SetData chConstants.chDimSeriesNames, 0,
chConstants.chPivotColAggregates
oChart.SetData chConstants.chDimCategories, 0, chConstants.chPivotRows
oChart.SetData chConstants.chDimValues, 0, 0
oChart.HasLegend = vbTrue
oChart.HasTitle = vbTrue
oChart.Title.Caption = chart_title_text
Set ax = oChart.Axes(chConstants.chAxisPositionLeft)
ax.NumberFormat = "#,##0"
Next

Alvin Bruney said:
post a complete sample of your code that reproduces the problem.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Paul - Lydian said:
I have a webpage with a linked pivottable and chart using OWC 11. Both
the
table and chart are first displayed empty then as the user updates the
content from the field list I want the two objects to reflect the
changes.

The issue I have is that the chart doesn't display the data content if
a
total field is added to the table (the rows/columns aspect work fine).
If
a
total field is added to the chart then the table updates but not the
other
way around.

I'm using scripting and the code snippet I'm using is:

oChart.SetData chConstants.chDimValues, 0, 0

Any suggestions?
 
P

Paul - Lydian

As the chart and table are built empty then there is no total to work with.
All examples I can find set the property as you suggest using a known total
field or use known dimensions not a generic analysis cube.

I have tried enabling the allaggregates property on the pivot chart and
although that works the total description is included into the row setting of
the table.

Looks like I will have to do something within the TableSpace1_DataChange
event and trap the plDataReasonInsertTotal and plDataReasonRemoveTotal
condition then walk the data element and see if is bound to the chart if that
is possible :)


Alvin Bruney said:
if i understand you correctly, you need to explicitly tell the chart which
total to bind to since it can bind to several totals and the chart gets lost
on which total to use so you must explicitly instruct it on which total you
want to display. so do something like
chartspace1.setdata(c.chdimvalues,0,"the total i want to see goes here")

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Paul - Lydian said:
Ok, Alvin. Any idea it takes to ship your book to the UK? (We ordered last
week via Lulu.)

TableSpace1.ConnectionString = provider
TableSpace1.DataMember = p_table

TableSpace1.AutoFit = vbTrue
TableSpace1.height = "100%"
TableSpace1.width = "100%"
TableSpace1.ActiveView.AutoLayout
TableSpace1.style.visibility = "visible"

Set chConstants = ChartSpace1.Constants
ChartSpace1.Clear
Set ChartSpace1.DataSource = TableSpace1

<<used to be code to add a 2nd chart>>

On Error Resume Next

For Each oChart in ChartSpace1.Charts
oChart.SetData chConstants.chDimSeriesNames, 0,
chConstants.chPivotColAggregates
oChart.SetData chConstants.chDimCategories, 0, chConstants.chPivotRows
oChart.SetData chConstants.chDimValues, 0, 0
oChart.HasLegend = vbTrue
oChart.HasTitle = vbTrue
oChart.Title.Caption = chart_title_text
Set ax = oChart.Axes(chConstants.chAxisPositionLeft)
ax.NumberFormat = "#,##0"
Next

Alvin Bruney said:
post a complete sample of your code that reproduces the problem.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


I have a webpage with a linked pivottable and chart using OWC 11. Both
the
table and chart are first displayed empty then as the user updates the
content from the field list I want the two objects to reflect the
changes.

The issue I have is that the chart doesn't display the data content if
a
total field is added to the table (the rows/columns aspect work fine).
If
a
total field is added to the chart then the table updates but not the
other
way around.

I'm using scripting and the code snippet I'm using is:

oChart.SetData chConstants.chDimValues, 0, 0

Any suggestions?
 
A

Alvin Bruney [ASP.NET MVP]

Ok, Alvin. Any idea it takes to ship your book to the UK? (We ordered last
week via Lulu.)
No, you would have to contact lulu for that info. Sorry

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Paul - Lydian said:
Ok, Alvin. Any idea it takes to ship your book to the UK? (We ordered last
week via Lulu.)

TableSpace1.ConnectionString = provider
TableSpace1.DataMember = p_table

TableSpace1.AutoFit = vbTrue
TableSpace1.height = "100%"
TableSpace1.width = "100%"
TableSpace1.ActiveView.AutoLayout
TableSpace1.style.visibility = "visible"

Set chConstants = ChartSpace1.Constants
ChartSpace1.Clear
Set ChartSpace1.DataSource = TableSpace1

<<used to be code to add a 2nd chart>>

On Error Resume Next

For Each oChart in ChartSpace1.Charts
oChart.SetData chConstants.chDimSeriesNames, 0,
chConstants.chPivotColAggregates
oChart.SetData chConstants.chDimCategories, 0, chConstants.chPivotRows
oChart.SetData chConstants.chDimValues, 0, 0
oChart.HasLegend = vbTrue
oChart.HasTitle = vbTrue
oChart.Title.Caption = chart_title_text
Set ax = oChart.Axes(chConstants.chAxisPositionLeft)
ax.NumberFormat = "#,##0"
Next

Alvin Bruney said:
post a complete sample of your code that reproduces the problem.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Paul - Lydian said:
I have a webpage with a linked pivottable and chart using OWC 11. Both
the
table and chart are first displayed empty then as the user updates the
content from the field list I want the two objects to reflect the
changes.

The issue I have is that the chart doesn't display the data content if
a
total field is added to the table (the rows/columns aspect work fine).
If
a
total field is added to the chart then the table updates but not the
other
way around.

I'm using scripting and the code snippet I'm using is:

oChart.SetData chConstants.chDimValues, 0, 0

Any suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top