Powerpoint Chart not updated with the data assigned in its datashe

S

Solution Seeker

Hi,

We have a requirement that we need to show the data from database into the
chart. we are using Office 2003 MS Graph OLE Object.

The issue is that the data from the database assigned in the Chart's
datasheet is not reflected in the chart. This happens in almost 50% of the
charts. If we double-click on the chart, then the values in its datasheet are
reflected correctly. We need to make this refresh as automated one. What we
need to do?

For your information, we are using the Application.Chart.Update() already.
But still it is not solved our problem fully.

Sample Code:

// Sample Code starts

//Creating an instance

chart = shape.OLEFormat.Object as Graph.Chart;
dataSheet = chart.Application.DataSheet;

//Assigning the values to the dataSheet created above

dataSheet.Cells[2, 1] = "10%";
dataSheet.Cells[3, 1] = "20%";
dataSheet.Cells[4, 1] = "30%";
dataSheet.Cells[5, 1] = "40%";

//Updating the chart with the datasheet values

chart.Application.Update();
dataSheet = null;
chart.Application.Quit();

// Sample Code ends

Regards,
Guru
 
J

Jean-Pierre Forestier [MVP[

Have you tried to copy your chart then Paste as special with link in ppt?
 
S

Solution Seeker

I have not done like that, since the chart has to be associated with the
values dynamically. We are using template from which we will capture the
chart object and associate the values into its datasheet. During this
operation, some of the charts are refreshed correctly whereas some of them
are not refreshed correctly (having the values of the template).

Thanks,
Guru

Jean-Pierre Forestier [MVP[ said:
Have you tried to copy your chart then Paste as special with link in ppt?
Solution Seeker said:
Hi,

We have a requirement that we need to show the data from database into the
chart. we are using Office 2003 MS Graph OLE Object.

The issue is that the data from the database assigned in the Chart's
datasheet is not reflected in the chart. This happens in almost 50% of the
charts. If we double-click on the chart, then the values in its datasheet
are
reflected correctly. We need to make this refresh as automated one. What
we
need to do?

For your information, we are using the Application.Chart.Update() already.
But still it is not solved our problem fully.

Sample Code:

// Sample Code starts

//Creating an instance

chart = shape.OLEFormat.Object as Graph.Chart;
dataSheet = chart.Application.DataSheet;

//Assigning the values to the dataSheet created above

dataSheet.Cells[2, 1] = "10%";
dataSheet.Cells[3, 1] = "20%";
dataSheet.Cells[4, 1] = "30%";
dataSheet.Cells[5, 1] = "40%";

//Updating the chart with the datasheet values

chart.Application.Update();
dataSheet = null;
chart.Application.Quit();

// Sample Code ends

Regards,
Guru
 
S

Solution Seeker

Hi Steve,

There is no difference between the charts created and no error is reported
on this type of issue. This type of issue occurs in most of the reports where
the no. of charts are huge. Meaning we are creating a chart to show the
performance of salesman in terms of some attributes. If the dealer has huge
number of salesmen then the charts will be drawn to all those salesmen. If
the charts drawn are huge then this type of issue occurrence is more. This
does not mean that it is not happening in the reports with less number of
charts. The frequency is more in terms of huge charts.

Let me know if you need more information about it.

Regards,
Guru

Steve Rindsberg said:
The code appears correct, and as you say, it does work half of the time.

What's different between the charts where it does and doesn't work?

The amount of data to be changed?
Chart type?
Other?

And is error trapping in place? In other words, if PPT/MSGraph throws an error
will you be aware of it?
We have a requirement that we need to show the data from database into the
chart. we are using Office 2003 MS Graph OLE Object.

The issue is that the data from the database assigned in the Chart's
datasheet is not reflected in the chart. This happens in almost 50% of the
charts. If we double-click on the chart, then the values in its datasheet are
reflected correctly. We need to make this refresh as automated one. What we
need to do?

For your information, we are using the Application.Chart.Update() already.
But still it is not solved our problem fully.

Sample Code:

// Sample Code starts

//Creating an instance

chart = shape.OLEFormat.Object as Graph.Chart;
dataSheet = chart.Application.DataSheet;

//Assigning the values to the dataSheet created above

dataSheet.Cells[2, 1] = "10%";
dataSheet.Cells[3, 1] = "20%";
dataSheet.Cells[4, 1] = "30%";
dataSheet.Cells[5, 1] = "40%";

//Updating the chart with the datasheet values

chart.Application.Update();
dataSheet = null;
chart.Application.Quit();

// Sample Code ends

Regards,
Guru
 

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