Editing an existing line chart through VBA

Started by cajenks23, July 29, 2013, 07:36:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cajenks23

In a program that I am building in Visio 2010 I have a two-series line chart that I added using the Insert>Illustrations>Chart procedure. I have been trying for quite some time now to write VBA code to edit the chart data and I have not been able to figure out just how to do it. I know that the chart is stored as an OLE/MSGraph object, and I just need some way to programmatically set the data points for the two series on the line graph and update the axis labels. Thanks in advance for any insight.

cajenks23

Alright, maybe it's time for plan B. The line chart mentioned above was being used to display to the user a timeline for a project. On the x-axis were the dates, and on the y-axis were days remaining until completion of the project. As previously mentioned, there were two series plotted on this chart, one for the initial projected timeline, and another for an adjusted timeline(as the project runs experiences delays the pattern changes). I thought using a line chart would be the best way to display this information, but maybe I was wrong. Does anyone know of a more feasible, nice-looking way I could display the timeline using shapes? I have looked into the built-in Visio timeline shapes, but so far I haven't come up with a way to show both the initial and adjusted timelines neatly.

Yacine

Hi Cajenks,

Inserting a MS Graph object in Visio does not make sense in my opinion. Rather do it in Excel.
Making your own graph in Visio, however brings your request in an other light.

To develop such a solution, you need to clear on how you want to get the data into Visio (input in visio, binding to a DB, XLS, ...).
You would also like to think about giving additional data in your graph (eg. Explanations about the delay).

What about several delay reasons for one task?
Yacine

cajenks23

Thank you for your reply Yacine.

The data for the chart is stored in Excel and is being input to Visio through VBA. I already have all of the data transferral set up, I just need to find something to give it to.

Additional info about the delays that occur is already recorded in other areas of my program; the chart is only meant to be a visual feature that shows the trend of progress on the project.

Attached to this post is an image of the original chart I was trying to use.

Thank you for your help.

Yacine

Hi Cajenks,
As you have your data already imported in VBA, it will be simple to put them in a string of the form x1,y1,x2,y2,... and insert it in a polyline formula of your shape as seen in the attached sample.
Yacine