Copyright© 2012 Microsoft Corporation Visio Services 2013 Mashup API Chris Hopkins Senior Consultant - Premier Developer Practice Microsoft
Copyright© 2012 Microsoft Corporation
Use the JSOM to dynamically update a Content Editor web part as you select shapes on a Visio diagram with no server post back.
Copyright© 2012 Microsoft Corporation
OnClick() { for (var j = 0; j < data.length; j++) { if (data[j].label == "Step") { document.getElementById('StepData').src= " + "'" + data[j].value + "'"; return; } }} // NOTE: this is pseudo code.
Copyright© 2012 Microsoft Corporation OnClick() { shapes = page1.getShapes(); foreach shape in shapes { if (shape.data[0].value = TextBox.value) { shape.addHighlight(); } } } // NOTE: this is pseudo code.
Copyright© 2012 Microsoft Corporation Demo
Copyright© 2012 Microsoft Corporation
Web Part Page Document Library
Copyright© 2012 Microsoft Corporation
web part ID
Copyright© 2012 Microsoft Corporation
Function callback Event name
Copyright© 2012 Microsoft Corporation At this point the JSOM is initialized and the specified diagram is rendered in the VWA web part
Copyright© 2012 Microsoft Corporation function onShapeSelectionChanged(source, shapeId) { var vwaPage = vwaControl.getActivePage(); var vwaShapes = vwaPage.getShapes(); var vwaShape = vwaShapes.getItemById(shapeId); var data = vwaShape.getShapeData(); for (var j = 0; j < data.length; j++) { if (data[j].label == "Step") { alert(data[j].value); }
Copyright© 2012 Microsoft Corporation
nextShape.addHighlight(4, "red"); Pixel width Color, Hex or Name
Copyright© 2012 Microsoft Corporation
Demo
Copyright© 2012 Microsoft Corporation EventVwaControl MethodsDescription Diagram CompleteaddHandler() / removeHandler()Triggered when the diagram is loaded, refreshed, or changed Diagram ErroraddHandler() / removeHandler()Occurs when a request to render the diagram fails Shape Mouse EnteraddHandler() / removeHandler()Triggered when the mouse pointer is moved into the bounding box of the shape Shape Mouse LeaveaddHandler() / removeHandler()Triggered when the mouse pointer is moved out of the bounding box of the shape Shape Selection ChangedaddHandler() / removeHandler()Occurs when the shape that is currently selected on the page changes
Copyright© 2012 Microsoft Corporation
Content Editor Web Part Visio Web Access Web Part
Copyright© 2012 Microsoft Corporation
Thank You
Copyright© 2012 Microsoft Corporation