The video below shows how to add a Data Graphic legend to a drawing using C# code. How might you use this code within the context of constructing diagrams with Data Graphics?
As mentioned in a previous blog post, Visio Professional 2010 and Visio Premium 2010 use container shapes to create legends for data graphics. Along with this new feature, the Visio 2010 Object Model includes new APIs that allow you to manipulate container shapes programmatically – including the Page.DropLegend method that allows you to add a Data Graphics legend to your drawing using code. We’ve created this how-to video about using C# to add a Data Graphics legend to a drawing page. While creating this video, we considered some of the larger scenarios where this API might be used.