Presentation is loading. Please wait.

Presentation is loading. Please wait.

4/13/2017 5:55 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.

Similar presentations


Presentation on theme: "4/13/2017 5:55 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered."— Presentation transcript:

1 4/13/2017 5:55 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2 Visualizing Information the Smart (Diagram) Way
4/13/2017 5:55 PM Visualizing Information the Smart (Diagram) Way David J Parker MVP (Visio) bVisual ltd © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

3 Who am I? Microsoft MVP (Visio) Microsoft MCP (Visio, SQL)
Pre-Microsoft acquisition Visio Business Partner, Speaker at Visio Conferences 1997 &1998 Started bVisual in 1998 Post-Microsoft acquisition Microsoft Visio Solution Provider since 1999 Speaker at Microsoft Office Visio Conferences 2006 & 2008 Visio Solution Provider Training for Microsoft EMEA Visualizing Information with Microsoft Office Visio 2007 McGraw-Hill, 2007 DataLegends – Visio add-in to add Data Graphic legends WBS Modeler for Visio and Project Visio Blog

4 Business Data Visualised
bVisual Integration Visio Graphics Enterprise Data

5 Data Features in Visio Import > Link > Display > Communicate
On-line Visio Drawing Shape Data Source Prints Graphics odc Data Reports eebc53a68034&displaylang=en Import > Link > Display > Communicate

6 Microsoft Office Visio 2007
Visualise complex information to better understand it Analyse information to identify trends and issues and act on them Communicate using diagrams that can be shared with a broad audience Customise and extend Office Visio 2007 programmatically to fit customised needs

7 Visio 2007 Editions Visual data
Microsoft Office Visio 2007 Standard Database Wizard Microsoft Office Visio 2007 Professional Database reverse engineering UML models Link Data To Shapes * PivotDiagrams * Data Graphics * Visio.Application.DataFeaturesEnabled will return false for standard

8 Visio 2007 File Formats Drawing, Template and Stencil files XML files
Binary (*.vsd, *.vst, *.vss) XML (*.vdx, *.vtx, *.vsx) XML files 7-10 larger than binary Not yet a zip file (like the big three Office 2007 applications) with sub-folders and files Files compatible with Visio 2003 Unless using new ShapeSheet formulae

9 Visible Data Visio Professional 2007
Shape Data Renamed from Custom Properties Link Data to Shapes Multiple data sources per shape Read only Uses Office Data Connections (*.odc files) PivotDiagrams Diagrammatic version of PivotTables Data Graphics Data sensitive text and graphics on shapes Ignoring SolutionXML – not visible Data1, 2 and 3 were once the only visible shape data

10 Visio Development Platform
.NET Primary Interoperability Assemblies (PIAs) Save As Web Sample code Visio Object Model (COM) Full Visio Client App Visio Drawing Control (ActiveX) Extensibility Support Visio SDK Data Diagramming ML Tools & Wizards VSTO Add-in COM Add-in Visio 2007 also has the ability to export to Xps and Pdf Xps is a zipped format which can be extended, I will show an example of enhancing the Xps output to include Shape Data for smarter communication. Add-ons Visio Viewer VBA ShapeSheet, Smart Shapes ShapeStudio Drawings Visio Visio Engine

11 AdventureWorks Sample DB Modifications made
Added table EmployeeManager For non-direct reports Added view vDirectReports Adds LEVEL column to Employees Added stored procedure uspGetEmployees Can pass LEVEL as a parameter Filters down to passed LEVEL Added function ufnGetDottedLineManagers Returns comma seperated list of manager ids

12 Shape Data Any shape can have Shape Data

13 Link Data to Shapes Data / Link Data to Shapes…

14 Data Connection Wizard

15 Importing Linked Data DataConnection and DataRecordsets
Visio 12.0 Type Lib Add, AddFromConnectionFile, AddFromXML UI and code links to: Microsoft Office Excel & Access SharePoint Services Lists SQL Server Tables and Views OLEDB & ODBC Can also create link in code to : SQL Server stored procedures XML files

16 Link to SQL Server Stored Proc Declarations & Connection String
Dim dds As Visio.DataRecordset 'The data recordset Dim ary() As String ‘Array to hold the p key columns Dim SQLConnStr As String 'The connection string Dim SQLCommStr As String 'The Command string Dim datasetName As String 'The dataset name SQLConnStr = "Provider=SQLOLEDB.1;" & _ "Integrated Security=SSPI;" & _ "Persist Security Info=True;" & _ "Data Source=.;" & _ "Initial Catalog=AdventureWorks;" & _ "Use Procedure for Prepare=1“

17 Link to SQL Server Stored Proc Command String & Adding DataRecordset
SQLCommStr = "EXEC uspGetEmployees 1" ary() = Split("EmployeeID", ";") datasetName = "Employees“ Set dds = Visio.ActiveDocument.DataRecordsets.Add( _ SQLConnStr, SQLCommStr, _ VisDataRecordsetAddOptions.visDataRecordsetDelayQuery, _ datasetName) dds.SetPrimaryKey VisPrimaryKeySettings.visKeySingle, ary() dds.Refresh Visio.ActiveWindow.Windows.ItemFromID( _ visWinIDExternalData).Visible = True In VBA, requires reference to Microsoft Scripting Runtime

18 Link to XML file Connection String
Dim doc As Visio.Document Dim dst As Visio.DataRecordset Dim xmlFile As String Dim dom As New MSXML2.DOMDocument Dim OK As Boolean Set doc = Visio.ActiveDocument xmlFile = “MyXMLFile.xml" OK = dom.Load(xmlFile) Set dst = doc.DataRecordsets.AddFromXML( _ dom.XML, 0, “Any Name") Requires reference to Microsoft XML

19 Refreshing Linked Data
UI and code refreshing of DataRecordset .Refresh .GetAllRefreshConflicts .GetMatchingRowsForRefreshConflict .RemoveRefreshConflict XML files can only be refreshed in code .RefreshUsingXML Automation requires assigned name and file

20 Link to XML file Refreshing
Dim doc As Visio.Document Dim dst As Visio.DataRecordset Dim xmlFile As String Dim dom As New MSXML2.DOMDocument Dim OK As Boolean Set doc = Visio.ActiveDocument xmlFile = “MyXMLFile.xml" OK = dom.Load(xmlFile) For Each dst In Visio.ActiveDocument.DataRecordsets If dst.Name = “Any Name" Then dst.RefreshUsingXML dom.XML Exit For End If Next Requires reference to Microsoft XML Need to know both the file and Name used when added

21 Linking Shapes from External Data Window
Select a Master – Drag data row(s) Drag a data row onto any shape Shape Data key field(s) contain values - AutoLink

22 External Data on shapes
Basic Data Graphics usually added by default Can switch off automatic generation of graphics

23 External Data Configuration
Right mouse menu

24 External Data on Shapes What the user sees
Shape Data automatically added to shapes Basic Data Graphics usually added by default Can switch off automatic generation of graphics

25 External Data on Shapes Behind the scenes
User-defined Cells Shape Data _VisDM_ prefixes column names Unless already exist! Remember that Blue rows are not inherited from the Master! Therefore, consider having named shape data in Master before linking.

26 demo Importing Data 4/13/2017 5:55 PM Run code examples:
CreateRecordset DropEmployees © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

27 Create Linked Shapes in Code Definition
DropManyLinkedU ObjectsToInstance() array of variants XYs() array of doubles DataRecordsetID long DataRowIDs() array of longs ApplyDataGraphicAfterLink boolean ShapeIDs() out array of longs

28 Create Linked Shapes in Code Example
'Retrieve the row ids from the datarecordset Dim aryRowIDs() As Long aryRowIDs = drs.GetDataRowIDs("") 'Drop the master in random co-ords, and linked to the datarecordset, applying a DataGraphic Dim aryShapeIDs() As Long Dim applyDataGraphics As Boolean Visio.ActiveDocument.DocumentSheet.Cells( _ "User.msvLastAppliedDataGraphic").FormulaU = _ "=""Data - Employees""" applyDataGraphics = True Visio.ActivePage.DropManyLinkedU _ aryMsts, aryXYs, drs.ID, aryRowIDs, _ applyDataGraphics , aryShapeIDs Setting these properties can improve speed in automation Application.AutoLayout Application.InhibitSelectChange Application.ScreenUpdating Application.ShowChanges Ensure that "=""Data - Employees""“ exists

29 demo Linking Data to Shapes Drop Many... 4/13/2017 5:55 PM
Run code examples: CreateRecordset DropEmployees Drop Many... © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

30 Connecting Shapes from Data Using DataRecordsets in code
Many types of diagrams require shapes to be connected Organization Charts, Network diagrams, Process Connecting shapes example code ConnectSubordinates ConnectDottedLineManagers Can then use different layouts for display LayoutPage... example code LayoutSelection... example code

31 ConnectSubordinates Code excerpt
For iEmp = 0 To UBound(aryShapeIDs) 'Get the potential manager row Set shpEmp = Visio.ActivePage.Shapes.ItemFromID(aryShapeIDs(iEmp)) rowID = shpEmp.GetLinkedDataRow(drs.ID) varRowData = drs.GetRowData(rowID) 'Arrays are zero based empID = CLng(varRowData(empColumn - 1)) 'Filter the rows to get sub-ordinates of the current employee aryRowIDs = drs.GetDataRowIDs("ManagerID = " & CStr(empID)) 'Iterate thru the subordinate datarecordset rows For iSub = 0 To UBound(aryRowIDs) v = drs.GetRowData(aryRowIDs(iSub)) 'Get the subordinate shapes Visio.ActivePage.GetShapesLinkedToDataRow drs.ID, aryRowIDs(iSub), arySubShapeIDs 'Check that there is actually something in the array If IsArrayAllocated(arySubShapeIDs) = True Then 'Iterate thru the subordinate shapes For iSubShape = 0 To UBound(arySubShapeIDs) Set shpSub = Visio.ActivePage.Shapes.ItemFromID(arySubShapeIDs(iSubShape)) 'Create a dynamic connection from manager to subordinate shpEmp.AutoConnect shpSub, visAutoConnectDirUp Next iSubShape End If Next iSub Next iEmp

32 LayoutPage code Part 1 of 2
Private Sub LayoutPage( ByVal placeStyle As Visio.VisCellVals, _ ByVal routeStyle As Visio.VisCellVals, _ ByVal lineRouteExt As Visio.VisCellVals) 'Create the Section, Row, Cell stream array Dim arySRC(1 To 12) As Integer arySRC(1) = Visio.VisSectionIndices.visSectionObject arySRC(2) = Visio.VisRowIndices.visRowPageLayout arySRC(3) = Visio.VisCellIndices.visPLOPlaceStyle arySRC(4) = Visio.VisSectionIndices.visSectionObject arySRC(5) = Visio.VisRowIndices.visRowPageLayout arySRC(6) = Visio.VisCellIndices.visPLORouteStyle arySRC(7) = Visio.VisSectionIndices.visSectionObject arySRC(8) = Visio.VisRowIndices.visRowPageLayout arySRC(9) = Visio.VisCellIndices.visPLOLineRouteExt 'Required to force update of connectors arySRC(10) = Visio.VisSectionIndices.visSectionObject arySRC(11) = Visio.VisRowIndices.visRowPageLayout arySRC(12) = Visio.VisCellIndices.visPLOAvenueSizeX

33 LayoutPage Code Part 2 of 2
'Create the Formula array Dim aryFormula(0 To 3) As Variant aryFormula(0) = placeStyle aryFormula(1) = routeStyle aryFormula(2) = lineRouteExt 'Required to force update of connectors aryFormula(3) = Visio.ActivePage.PageSheet.CellsSRC( _ arySRC(10), arySRC(11), arySRC(12)) ‘Set the page cell formulae Visio.ActivePage.PageSheet.SetFormulas _ arySRC(), aryFormula(), Visio.visSetBlastGuards Visio.ActivePage.Layout Visio.ActivePage.ResizeToFitContents Visio.ActiveWindow.ViewFit = visFitPage End Sub Private Sub LayoutPage( _ ByVal placeStyle As Visio.VisCellVals, _ ByVal routeStyle As Visio.VisCellVals, _ ByVal lineRouteExt As Visio.VisCellVals)

34 Calling PageLayout Examples
Public Sub LayoutPageHierarchy() LayoutPage _ VisCellVals.visPLOPlaceHierarchyTopToBottomCenter, _ VisCellVals.visLORouteOrgChartNS, _ VisCellVals.visLORouteExtStraight End Sub Public Sub LayoutPageRadial() VisCellVals.visPLOPlaceRadial, _ VisCellVals.visLORouteCenterToCenter, _ VisCellVals.visLORouteExtDefault

35 Hierachichal Layouts Standard Hierachy Org Chart Page Layout
Modified with Selection Layout cf Org Chart Wizard

36 Alternative Layouts Other Page Layouts may also be suitable
Compact Tree Radial Circular

37 Connecting Shapes from Data
4/13/2017 5:55 PM demo Connecting Shapes from Data Run code examples: CreateRecordset DropEmployees Reading Data and Layouts © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

38 Multiple Managers Added EmployeeManager table
Allows secondary managers

39 Using the Connection to Write
'Get the DataRecordset Dim drs As DataRecordset Set drs = Visio.ActiveWindow.Windows.ItemFromID( _ Visio.visWinIDExternalData).SelectedDataRecordset ... ‘Get the connection string Dim conStr As String conStr = drs.DataConnection.ConnectionString ‘Use the connection string to create a connection Dim dbCnxn As New ADODB.Connection dbCnxn.ConnectionString = conStr dbCnxn.Open dbCnxn.BeginTrans Needs reference to ADODB

40 Writing Data from Shapes
4/13/2017 5:55 PM demo Writing Data from Shapes Run code examples: CreateRecordset DropEmployees © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

41 Data Graphics Overview
Color By Value Text Data Bar Icon Set The order of the graphic items in the Z-order

42 Data Graphics Color by Value graphic item
Colors can be customised

43 Data Graphics Text graphic item
Text values, with optional label

44 Data Graphics Data Bar graphic item
Variable size depending on data value

45 Data Graphics Icon Set graphic item
Maximum of 5 icons per set specify values for icon display

46 DataGraphic Masters What the user sees
Document stencil only shows visible masters Drawing Explorer displays all (but not type)

47 DataGraphic Masters Behind the scenes
Public Sub EnumMasters() Dim mst As Visio.Master Debug.Print "ID", "Hidden", "Type", "IsDGCallout", "Name" For Each mst In Visio.ActiveDocument.Masters Debug.Print mst.ID, mst.Hidden, mst.Type, _ mst.Shapes(1).IsDataGraphicCallout, mst.name Next mst End Sub Note that DataGraphic and GraphicItem masters are both hidden by default Can only really recognise a GraphicItem by its main shape

48 Master and Instances Document Stencil Document Page Normal Master
Master instance with DataGraphic GraphicItem Master DataGraphic Master

49 Creating DataGraphics in code
Create a new DataGraphic master Document.Masters.AddEx(visTypeDataGraphic) Open the new Master Master.Open Copy an existing GraphicItem to it .GraphicItems.AddCopy(existingGI) Amend GraphicItems .HorizontalPosition & .VerticalPosition .SetExpression VisGraphicField, string Close Master Cannot create new GraphicItems in code ... only copy existing Constant Value Description visGraphicPropertyLabel 1 The label of a shape data item. visGraphicExpression 2 The ShapeSheet formula of a shape data item.

50 GraphicItem Master Group shape contains special cells
User.msvCalloutIconNumber controls display of elements

51 GraphicItems Group shape
Some User-defined cells required One Shape Data row required

52 GraphicItems Sub Shape(s)
Fills, visibility, etc linked to parent User cell

53 Custom Icon Set Graphic Item GenderMaritalStatus
User.msvCalloutIconNumber = 0 ( unknown ) = 1 Male = 2 Male + Married = 3 Female = 4 Female + Married

54 Custom Formulae Select “More Fields...” in Data field box
Can use cell names Can use Shape Data labels in braces {...}

55 Custom Formulae Set criteria in Edit Icon Set
Visio Toolbox for alternative icon sets using images Not as efficient as using shape geometry

56 Min & Max Values for Data Bars SetDataBarMinMaxValues code
A Data Bar graphic item can be Multiple times in same Data Graphic In multiple Data Graphics Each instance has different value ranges Min and max values read from shape instances Prop. msvCalloutField Data Bar can have multiple fields E.g. Multi-bar graph Prop. msvCalloutPropFieldn where n=2 to 5 Update master using .Open

57 Setting Min & Max Values
Document Stencil Document Page 5. Update DataGraphic Master Data Bar GraphicItem Min/Max Values 4. Read Min/Max of Data Bar Graphic Items 2. Collect Data Bar GraphicItems 1. Get Active DataGraphic Master 3. Create Selection

58 SetMinMaxDatabarValues Start Part
Const UserType As String = "User.msvCalloutType“ Const UserDGID As String = "User.visDGItemID " Const PropMax As String = "Prop.msvCalloutPropMax" Const PropMin As String = "Prop.msvCalloutPropMin“ 'Get the active Data Graphic Dim mstDG As Master Set mstDG = GetActiveDataGraphic im dicDataBarShapes As New Dictionary Dim gi As Visio.GraphicItem 'Create a dictionary of data bars For Each gi In mstDG.GraphicItems If gi.Type = visTypeDataBar Then dicDataBarShapes.Add CStr(gi.ID), 0 End If Next gi Public Function GetActiveDataGraphic() As Visio.Master Dim mstName As String 'You can get the Data Graphics master from a particlar cell value If Visio.ActiveDocument.DocumentSheet.CellExistsU( _ "User.msvLastAppliedDataGraphic", Visio.visExistsAnywhere) <> 0 Then mstName = Visio.ActiveDocument.DocumentSheet.Cells( _ "User.msvLastAppliedDataGraphic").ResultStr("") End If If Len(mstName) = 0 Then Set GetActiveDataGraphic = Nothing Else Set GetActiveDataGraphic = Visio.ActiveDocument.Masters(mstName) Exit Function End Function

59 SetMinMaxDatabarValues Middle Part
Dim colDataBarShapes As New Collection Dim itmGraphic As Visio.shape Dim gID As String 'Update the data bars dictionary with shape pseudo-index For Each itmGraphic In mstDG.Shapes(1).Shapes If itmGraphic.IsDataGraphicCallout = True Then If itmGraphic.Cells(UserType).ResultStr("") = "Data Bar" Then gID = CStr(itmGraphic.Cells(UserDGID).ResultInt("", 0)) dicDataBarShapes.Item(gID) = itmGraphic.NameU colDataBarShapes.Add gID End If Next itmGraphic 'Iterate thru each page to collect min/max values For Each pag In Visio.ActiveDocument.Pages 'Get all shapes that use this data graphic master Set sel = pag.CreateSelection(visSelTypeByDataGraphic, 0, mstDG) ... Next shp Next pag

60 SetMinMaxDatabarValues End Part
... 'Finally - update the ItemGraphic in the DataGraphic Master Dim mstCopy As Visio.Master Set mstCopy = mstDG.Open For Each itmGraphic In mstCopy.Shapes(1).Shapes If itmGraphic.IsDataGraphicCallout = True Then If itmGraphic.Cells(UserType).ResultStr("") = "Data Bar" Then gID = CStr(itmGraphic.Cells(UserDGID).ResultInt("", 0)) itmGraphic.Cells(PropMax).FormulaU = "=" & dicMaxVal.Item(gID) itmGraphic.Cells(PropMin).FormulaU = "=" & dicMinVal.Item(gID) End If Next itmGraphic 'Close the copy to update all instances mstCopy.Close

61 Updating DataBar Minimum and Maximum Values automatically
4/13/2017 5:55 PM demo Data Graphics Updating DataBar Minimum and Maximum Values automatically © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

62 PivotDiagrams Either File / New /Business / PivotDiagram
Or Data / Insert PivotDiagram… Create a new connection or use an existing one

63 Data Selector Columns and Rows

64 PivotDiagram Initial appearance
Total Pivot Node automatically added at the top left of page

65 PivotDiagram Breakdown
Breakdown data into Categories Sort Merge Promote Collapse

66 PivotDiagrams Apply Shape
Uses Master from any stencil to reinforce node type

67 PivotDiagrams Analysis Services
Import Cubes or Perspectives

68 Selecting Shapes By Criteria SelectByLevel (part)
'Filter the rows to get all rows with requested level aryRowIDs = drs.GetDataRowIDs("LEVEL = " & CStr(lvl)) 'Iterate thru the returned datarecordset rows For iRow = 0 To UBound(aryRowIDs) 'Get the shapes linked to the data row Visio.ActivePage.GetShapesLinkedToDataRow _ drs.ID, _ aryRowIDs(iRow), _ aryShapeIDs For iShp = 0 To UBound(aryShapeIDs) Visio.ActiveWindow.Select _ Visio.ActivePage.Shapes.ItemFromID(aryShapeIDs(iShp)), _ Visio.visSelect Next iShp Next iRow

69 PivotDiagram Breakdown
Breakdown data into Categories Sort Merge Promote Collapse

70 PivotDiagram Breakdown
PivotDiagram is an add-on Not an API extension Only launched in code from SharePoint Services List (soon to be published MSDN article) Use code to select in various ways Aids in applying DataGraphics and extra DataRecordsets E.g. SelectSameBreakdownName sample

71 Public Constants Public Const PropMember As String = "Prop._VisDM_Member" Public Const UserSelfShape As String = "User.visDDSelfShapeID" Public Const UserParentBDShape As String = "User.visDDParentBDShape" Public Const UserParentDDShape As String = "User.visDDParentDDShape" Public Const UserDDColumn As String = "User.visDDColumnIndex" Public Const UserRecordsetID As String = "User.visDDRecordsetID" Public Const UserDDShapeType As String = "User.visDDShapeType" Public Enum ePivotShapeType Node = 1 Breakdown = 2 info = 3 Title = 4 Connector = 5 End Enum

72 SelectSameBreakdownName
... Set vsoWindow = Visio.Application.ActiveWindow If vsoWindow.Selection.Count > 0 Then Set shp = vsoWindow.Selection.PrimaryItem If IsPivotNode(shp) = True Then breakdownName = _ GetGroupNameByID(GetBreakdownID(shp)) SelectByBreakdownName breakdownName End If

73 GetGroupNameByID ... Set vsoPage = Visio.Application.ActivePage
For Each shp In vsoPage.Shapes If shp.ID = parentBDShapeID Then Set groupShape = shp parentText = groupShape.Characters.Text Exit For End If Next GetGroupNameByID = parentText

74 GetBreakdownID Public Function GetBreakdownID( _
ByVal shape As Visio.shape) As Integer If shape.CellExists(UserParentBDShape, _ Visio.VisExistsFlags.visExistsAnywhere) = 0 Then GetBreakdownID = 0 Else GetBreakdownID = _ CInt(shape.Cells(UserParentBDShape).ResultIU) End If End Function

75 IsPivotNode & isPivotShapeType
IsPivotNode = isPivotShapeType(shape, ePivotShapeType.Node) Private Function isPivotShapeType(ByVal shape As Visio.shape, _ ByVal pivotShapeType As ePivotShapeType) As Boolean If Not shape.CellExists(UserDDShapeType, _ Visio.VisExistsFlags.visExistsAnywhere) = 0 Then If shape.Cells(UserDDShapeType).ResultIU = pivotShapeType Then isPivotShapeType = True Else isPivotShapeType = False End If End Function

76 demo PivotDiagrams Custom Selections 4/13/2017 5:55 PM
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

77 Privacy Issues Can File / Remove Hidden Information
Visio.Document.RemoveHiddenInformation = True Do this before saving a document

78 Customisation DataLegends
Legends for Icon Sets & Color By Value

79 demo DataLegends 4/13/2017 5:55 PM
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

80 Certification Individual
TS Exam Microsoft Office Visio 2007, Application Development Deploying Visio Solutions Working with External Data Developing Visio Libraries Automating Visio Diagrams Publishing and Viewing Visio Diagrams

81 Certification Corporate
New Microsoft Certified Partner Specialization Information Worker Competency Data Visualization Specialization https://partner.microsoft.com/ Need 2 individuals that have passed Visio TS exam Data Visualization competency is for Information Worker Solutions Data Management Solutions is just another competency that bVisual has

82 Visio Development Resources
Visio 2007 SDK Visio 2007 Solution Development Workshop Visio Developer Portal Visio Insight blog Visio MVP web site My Visio Blog

83 Thankyou! David J Parker Microsoft MVP (Visio) http://www.bVisual.net
Book


Download ppt "4/13/2017 5:55 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered."

Similar presentations


Ads by Google