Guest User

Untitled

a guest
Apr 1st, 2018
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.01 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>OrgChart | Create Your Own Theme</title>
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  6.  
  7. <script src="/orgChart/getorgchart/getorgchart.js"></script>
  8. <link href="/orgChart/getorgchart/getorgchart.css" rel="stylesheet" />
  9.  
  10. <script src="/orgChart/getorgchart/jspdf.debug.js"></script>
  11. <script src="/orgChart/getorgchart/saveSvgAsPng.js"></script>
  12. <script src="/orgChart/getorgchart/svg_to_pdf.js"></script>
  13.  
  14. <style type="text/css">
  15. html, body {
  16. margin: 0px;
  17. padding: 0px;
  18. width: 100%;
  19. height: 100%;
  20. overflow: hidden;
  21. }
  22.  
  23. #people {
  24. width: 100%;
  25. height: 100%;
  26. }
  27.  
  28. .get-text {
  29. fill: #ffffff !important;
  30. }
  31.  
  32. .myCustomTheme-box {
  33. fill: #FF8F32;
  34. }
  35.  
  36. .reporters {
  37. fill: #0072C6;
  38. }
  39.  
  40. .reporters-text {
  41. fill: #ffffff;
  42. font-size: 20px;
  43. }
  44. </style>
  45. </head>
  46. <body>
  47. <div id="container">
  48. <div id="people"></div>
  49. </div>
  50. <p><button>Download</button></p>
  51.  
  52. <script type="text/javascript">
  53. getOrgChart.themes.myCustomTheme =
  54. {
  55. size: [500, 200],
  56. toolbarHeight: 46,
  57. textPoints: [
  58. { x: 10, y: 180, width: 490 },
  59. { x: 200, y: 40, width: 300 },
  60. { x: 210, y: 65, width: 290 },
  61. { x: 210, y: 90, width: 290 }
  62. ],
  63. textPointsNoImage: [
  64. { x: 10, y: 180, width: 490 },
  65. { x: 10, y: 40, width: 300 },
  66. { x: 10, y: 65, width: 290 },
  67. { x: 10, y: 90, width: 290 }
  68. ],
  69. expandCollapseBtnRadius: 20,
  70. defs: '<filter id="f1" x="0" y="0" width="200%" height="200%"><feOffset result="offOut" in="SourceAlpha" dx="5" dy="5" /><feGaussianBlur result="blurOut" in="offOut" stdDeviation="5" /><feBlend in="SourceGraphic" in2="blurOut" mode="normal" /></filter>',
  71. box: '<rect x="0" y="0" height="200" width="500" rx="10" ry="10" class="myCustomTheme-box" filter="url(#f1)" />',
  72. text: '<text width="[width]" class="get-text get-text-[index]" x="[x]" y="[y]">[text]</text>',
  73. image: '<clipPath id="getMonicaClip"><circle cx="105" cy="65" r="85" /></clipPath><image preserveAspectRatio="xMidYMid slice" clip-path="url(#getMonicaClip)" xlink:href="[href]" x="20" y="-20" height="170" width="170"/>',
  74. reporters: '<circle cx="290" cy="230" r="20" class="reporters"></circle><text class="reporters-text" text-anchor="middle" width="120" x="290" y="237">[reporters]</text>'
  75. };
  76.  
  77. var peopleElement = document.getElementById("people");
  78. var orgChart = new getOrgChart(peopleElement, {
  79. theme: "myCustomTheme",
  80. gridView: true,
  81. linkType: "M",
  82. orientation: getOrgChart.RO_TOP,
  83. enableEdit: true,
  84. enableDetailsView: true,
  85. enableGridView: true,
  86. //enableExportToImage: true,
  87. renderNodeEvent: renderNodHandler,
  88. enablePrint: true,
  89. scale: 0.5,
  90. primaryFields: ["name", "title", "phone", "mail"],
  91. photoFields: ["image"],
  92. dataSource: [
  93. { id: 1, parentId: null, name: "Amber McKenzie", title: "CEO", phone: "678-772-470", mail: "lemmons@jourrapide.com", adress: "Atlanta, GA 30303", image: "/orgChart/getorgchart/images/f-11.jpg" },
  94. { id: 2, parentId: 1, name: "Ava Field", title: "Paper goods machine setter", phone: "937-912-4971", mail: "anderson@jourrapide.com", image: "/orgChart/getorgchart/images/f-10.jpg" },
  95. { id: 3, parentId: 1, name: "Evie Johnson", title: "Employer relations representative", phone: "314-722-6164", mail: "thornton@armyspy.com", image: "/orgChart/getorgchart/images/f-9.jpg" },
  96. { id: 4, parentId: 1, name: "Paul Shetler", title: "Teaching assistant", phone: "330-263-6439", mail: "shetler@rhyta.com", image: "/orgChart/getorgchart/images/f-5.jpg" },
  97. { id: 5, parentId: 2, name: "Rebecca Francis", title: "Welding machine setter", phone: "408-460-0589", image: "/orgChart/getorgchart/images/f-4.jpg" },
  98. { id: 6, parentId: 2, name: "Rebecca Randall", title: "Optometrist", phone: "801-920-9842", mail: "JasonWGoodman@armyspy.com", image: "/orgChart/getorgchart/images/f-8.jpg" },
  99. { id: 7, parentId: 3, name: "Spencer May", title: "System operator", phone: "Conservation scientist", mail: "hodges@teleworm.us", image: "/orgChart/getorgchart/images/f-7.jpg" },
  100. { id: 8, parentId: 6, name: "Max Ford", title: "Budget manager", phone: "989-474-8325", mail: "hunter@teleworm.us", image: "/orgChart/getorgchart/images/f-6.jpg" },
  101. { id: 9, parentId: 7, name: "Riley Bray", title: "Structural metal fabricator", phone: "479-359-2159", image: "/orgChart/getorgchart/images/f-3.jpg" },
  102. { id: 10, parentId: 7, name: "Callum Whitehouse", title: "Radar controller", phone: "847-474-8775", image: "/orgChart/getorgchart/images/f-2.jpg" }
  103. ]
  104. });
  105.  
  106. function renderNodHandler(sender, args) {
  107. for (var i = 0; i < args.content.length; i++) {
  108. if (args.content[i].indexOf("[reporters]") != -1) {
  109. args.content[i] = args.content[i].replace("[reporters]", args.node.children.length);
  110. }
  111. }
  112. }
  113.  
  114. document.querySelector("button").addEventListener("click", function () {
  115. svg_to_pdf(document.querySelector("svg"), function (pdf) {
  116. download_pdf('SVG.pdf', pdf.output('dataurlstring'));
  117. });
  118. });
  119. </script>
  120. </body>
  121. </html>
Add Comment
Please, Sign In to add comment