mxMockupGraphics.js 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235
  1. /**
  2. * $Id: mxMockupGraphics.js,v 1.5 2013/05/22 12:28:49 mate Exp $
  3. * Copyright (c) 2006-2010, JGraph Ltd
  4. */
  5. //**********************************************************************************************************************************************************
  6. //Bar Chart
  7. //**********************************************************************************************************************************************************
  8. /**
  9. * Extends mxShape.
  10. */
  11. function mxShapeMockupBarChart(bounds, fill, stroke, strokewidth)
  12. {
  13. mxShape.call(this);
  14. this.bounds = bounds;
  15. this.fill = fill;
  16. this.stroke = stroke;
  17. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  18. };
  19. /**
  20. * Extends mxShape.
  21. */
  22. mxUtils.extend(mxShapeMockupBarChart, mxShape);
  23. mxShapeMockupBarChart.prototype.cst = {
  24. STROKE_COLOR2 : 'strokeColor2',
  25. STROKE_COLOR3 : 'strokeColor3',
  26. FILL_COLOR2 : 'fillColor2',
  27. FILL_COLOR3 : 'fillColor3',
  28. SHAPE_BAR_CHART : 'mxgraph.mockup.graphics.barChart'
  29. };
  30. mxShapeMockupBarChart.prototype.customProperties = [
  31. {name: 'strokeColor2', dispName: 'Stroke2 Color', type: 'color'},
  32. {name: 'strokeColor3', dispName: 'Stroke3 Color', type: 'color'},
  33. {name: 'fillColor2', dispName: 'Fill2 Color', type: 'color'},
  34. {name: 'fillColor3', dispName: 'Fill3 Color', type: 'color'}
  35. ];
  36. /**
  37. * Function: paintVertexShape
  38. *
  39. * Paints the vertex shape.
  40. */
  41. mxShapeMockupBarChart.prototype.paintVertexShape = function(c, x, y, w, h)
  42. {
  43. c.translate(x, y);
  44. this.background(c, x, y, w, h);
  45. var bgFill = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
  46. if (bgFill !== 'none')
  47. {
  48. c.setShadow(false);
  49. }
  50. this.bars(c, x, y, w, h);
  51. };
  52. mxShapeMockupBarChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  53. {
  54. c.rect(0, 0, w, h);
  55. c.fillAndStroke();
  56. };
  57. mxShapeMockupBarChart.prototype.bars = function(c, x, y, w, h)
  58. {
  59. var barStroke = mxUtils.getValue(this.style, mxShapeMockupBarChart.prototype.cst.STROKE_COLOR2, 'none');
  60. var coordStroke = mxUtils.getValue(this.style, mxShapeMockupBarChart.prototype.cst.STROKE_COLOR3, '#666666');
  61. var barFill1 = mxUtils.getValue(this.style, mxShapeMockupBarChart.prototype.cst.FILL_COLOR2, '#008cff');
  62. var barFill2 = mxUtils.getValue(this.style, mxShapeMockupBarChart.prototype.cst.FILL_COLOR3, '#dddddd');
  63. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  64. c.setStrokeColor(barStroke);
  65. c.setFillColor(barFill1);
  66. c.rect(0, h * 0.2, w * 0.75, h * 0.05);
  67. c.fillAndStroke();
  68. c.rect(0, h * 0.45, w * 0.6, h * 0.05);
  69. c.fillAndStroke();
  70. c.rect(0, h * 0.7, w * 0.95, h * 0.05);
  71. c.fillAndStroke();
  72. c.setFillColor(barFill2);
  73. c.rect(0, h * 0.25, w * 0.85, h * 0.05);
  74. c.fillAndStroke();
  75. c.rect(0, h * 0.5, w * 0.65, h * 0.05);
  76. c.fillAndStroke();
  77. c.rect(0, h * 0.75, w * 0.8, h * 0.05);
  78. c.fillAndStroke();
  79. c.setStrokeWidth(strokeWidth * 2);
  80. c.setStrokeColor(coordStroke);
  81. c.setShadow(false);
  82. c.begin();
  83. c.moveTo(0,0);
  84. c.lineTo(0, h);
  85. c.lineTo(w, h);
  86. c.stroke();
  87. };
  88. mxCellRenderer.registerShape(mxShapeMockupBarChart.prototype.cst.SHAPE_BAR_CHART, mxShapeMockupBarChart);
  89. //**********************************************************************************************************************************************************
  90. //Column Chart
  91. //**********************************************************************************************************************************************************
  92. /**
  93. * Extends mxShape.
  94. */
  95. function mxShapeMockupColumnChart(bounds, fill, stroke, strokewidth)
  96. {
  97. mxShape.call(this);
  98. this.bounds = bounds;
  99. this.fill = fill;
  100. this.stroke = stroke;
  101. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  102. };
  103. /**
  104. * Extends mxShape.
  105. */
  106. mxUtils.extend(mxShapeMockupColumnChart, mxShape);
  107. mxShapeMockupColumnChart.prototype.cst = {
  108. STROKE_COLOR2 : 'strokeColor2',
  109. STROKE_COLOR3 : 'strokeColor3',
  110. FILL_COLOR2 : 'fillColor2',
  111. FILL_COLOR3 : 'fillColor3',
  112. SHAPE_COLUMN_CHART : 'mxgraph.mockup.graphics.columnChart'
  113. };
  114. mxShapeMockupColumnChart.prototype.customProperties = [
  115. {name: 'strokeColor2', dispName: 'Bar Stroke Color', type: 'color'},
  116. {name: 'strokeColor3', dispName: 'Coord System Color', type: 'color'},
  117. {name: 'fillColor2', dispName: 'Bar1 Color', type: 'color'},
  118. {name: 'fillColor3', dispName: 'Bar2 Color', type: 'color'}
  119. ];
  120. /**
  121. * Function: paintVertexShape
  122. *
  123. * Paints the vertex shape.
  124. */
  125. mxShapeMockupColumnChart.prototype.paintVertexShape = function(c, x, y, w, h)
  126. {
  127. c.translate(x, y);
  128. this.background(c, x, y, w, h);
  129. var bgFill = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
  130. if (bgFill !== 'none')
  131. {
  132. c.setShadow(false);
  133. }
  134. this.bars(c, x, y, w, h);
  135. };
  136. mxShapeMockupColumnChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  137. {
  138. c.rect(0, 0, w, h);
  139. c.fillAndStroke();
  140. };
  141. mxShapeMockupColumnChart.prototype.bars = function(c, x, y, w, h)
  142. {
  143. var barStroke = mxUtils.getValue(this.style, mxShapeMockupColumnChart.prototype.cst.STROKE_COLOR2, 'none');
  144. var coordStroke = mxUtils.getValue(this.style, mxShapeMockupColumnChart.prototype.cst.STROKE_COLOR3, '#666666');
  145. var barFill1 = mxUtils.getValue(this.style, mxShapeMockupColumnChart.prototype.cst.FILL_COLOR2, '#008cff');
  146. var barFill2 = mxUtils.getValue(this.style, mxShapeMockupColumnChart.prototype.cst.FILL_COLOR3, '#dddddd');
  147. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  148. c.setStrokeColor(barStroke);
  149. c.setFillColor(barFill1);
  150. c.rect(w * 0.2, h * 0.25, w * 0.05, h * 0.75);
  151. c.fillAndStroke();
  152. c.rect(w * 0.45, h * 0.4, w * 0.05, h * 0.6);
  153. c.fillAndStroke();
  154. c.rect(w * 0.7, h * 0.05, w * 0.05, h * 0.95);
  155. c.fillAndStroke();
  156. c.setFillColor(barFill2);
  157. c.rect(w * 0.25, h * 0.15, w * 0.05, h * 0.85);
  158. c.fillAndStroke();
  159. c.rect(w * 0.5, h * 0.35, w * 0.05, h * 0.65);
  160. c.fillAndStroke();
  161. c.rect(w * 0.75, h * 0.2, w * 0.05, h * 0.8);
  162. c.fillAndStroke();
  163. c.setStrokeWidth(strokeWidth * 2);
  164. c.setStrokeColor(coordStroke);
  165. c.setShadow(false);
  166. c.begin();
  167. c.moveTo(0,0);
  168. c.lineTo(0, h);
  169. c.lineTo(w, h);
  170. c.stroke();
  171. };
  172. mxCellRenderer.registerShape(mxShapeMockupColumnChart.prototype.cst.SHAPE_COLUMN_CHART, mxShapeMockupColumnChart);
  173. //**********************************************************************************************************************************************************
  174. //Line Chart
  175. //**********************************************************************************************************************************************************
  176. /**
  177. * Extends mxShape.
  178. */
  179. function mxShapeMockupLineChart(bounds, fill, stroke, strokewidth)
  180. {
  181. mxShape.call(this);
  182. this.bounds = bounds;
  183. this.fill = fill;
  184. this.stroke = stroke;
  185. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  186. };
  187. /**
  188. * Extends mxShape.
  189. */
  190. mxUtils.extend(mxShapeMockupLineChart, mxShape);
  191. mxShapeMockupLineChart.prototype.cst = {
  192. STROKE_COLOR2 : 'strokeColor2',
  193. STROKE_COLOR3 : 'strokeColor3',
  194. STROKE_COLOR4 : 'strokeColor4',
  195. SHAPE_LINE_CHART : 'mxgraph.mockup.graphics.lineChart'
  196. };
  197. mxShapeMockupLineChart.prototype.customProperties = [
  198. {name: 'strokeColor2', dispName: 'Coord. System Color', type: 'color'},
  199. {name: 'strokeColor3', dispName: 'Line1 Color', type: 'color'},
  200. {name: 'strokeColor4', dispName: 'Line2 Color', type: 'color'},
  201. ];
  202. /**
  203. * Function: paintVertexShape
  204. *
  205. * Paints the vertex shape.
  206. */
  207. mxShapeMockupLineChart.prototype.paintVertexShape = function(c, x, y, w, h)
  208. {
  209. c.translate(x, y);
  210. this.background(c, x, y, w, h);
  211. var bgFill = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
  212. if (bgFill !== 'none')
  213. {
  214. c.setShadow(false);
  215. }
  216. this.bars(c, x, y, w, h);
  217. };
  218. mxShapeMockupLineChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  219. {
  220. c.rect(0, 0, w, h);
  221. c.fillAndStroke();
  222. };
  223. mxShapeMockupLineChart.prototype.bars = function(c, x, y, w, h)
  224. {
  225. var coordStroke = mxUtils.getValue(this.style, mxShapeMockupLineChart.prototype.cst.STROKE_COLOR2, '#666666');
  226. var line1Stroke = mxUtils.getValue(this.style, mxShapeMockupLineChart.prototype.cst.STROKE_COLOR3, '#008cff');
  227. var line2Stroke = mxUtils.getValue(this.style, mxShapeMockupLineChart.prototype.cst.STROKE_COLOR4, '#dddddd');
  228. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  229. c.setStrokeWidth(strokeWidth * 2);
  230. c.setStrokeColor(line2Stroke);
  231. c.begin();
  232. c.moveTo(0, h);
  233. c.lineTo(w * 0.3, h * 0.5);
  234. c.lineTo(w * 0.6, h * 0.74);
  235. c.lineTo(w * 0.9, h * 0.24);
  236. c.stroke();
  237. c.setStrokeColor(line1Stroke);
  238. c.begin();
  239. c.moveTo(0, h);
  240. c.lineTo(w * 0.3, h * 0.65);
  241. c.lineTo(w * 0.6, h * 0.6);
  242. c.lineTo(w * 0.9, h * 0.35);
  243. c.stroke();
  244. c.setStrokeColor(coordStroke);
  245. c.setShadow(false);
  246. c.begin();
  247. c.moveTo(0,0);
  248. c.lineTo(0, h);
  249. c.lineTo(w, h);
  250. c.stroke();
  251. };
  252. mxCellRenderer.registerShape(mxShapeMockupLineChart.prototype.cst.SHAPE_LINE_CHART, mxShapeMockupLineChart);
  253. //**********************************************************************************************************************************************************
  254. //Pie Chart
  255. //**********************************************************************************************************************************************************
  256. /**
  257. * Extends mxShape.
  258. */
  259. function mxShapeMockupPieChart(bounds, fill, stroke, strokewidth)
  260. {
  261. mxShape.call(this);
  262. this.bounds = bounds;
  263. this.fill = fill;
  264. this.stroke = stroke;
  265. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  266. };
  267. /**
  268. * Extends mxShape.
  269. */
  270. mxUtils.extend(mxShapeMockupPieChart, mxShape);
  271. mxShapeMockupPieChart.prototype.cst = {
  272. PARTS : 'parts',
  273. PART_COLORS : 'partColors',
  274. SHAPE_PIE_CHART : 'mxgraph.mockup.graphics.pieChart'
  275. };
  276. mxShapeMockupPieChart.prototype.customProperties = [
  277. {name: 'partsCount', dispName: 'partsCount', type: 'int', defVal: 4, dependentProps: ['partColors', 'parts']},
  278. {name: 'partColors', dispName: 'Part Colors', type: 'staticArr', subType: 'color', sizeProperty: 'partsCount', subDefVal: '#FFFFFF'},
  279. {name: 'parts', dispName: 'Part Sizes', type: 'staticArr', subType: 'int', sizeProperty: 'partsCount', subDefVal: '10'},
  280. ];
  281. /**
  282. * Function: paintVertexShape
  283. *
  284. * Paints the vertex shape.
  285. */
  286. mxShapeMockupPieChart.prototype.paintVertexShape = function(c, x, y, w, h)
  287. {
  288. c.translate(x, y);
  289. this.background(c, x, y, w, h);
  290. c.setShadow(false);
  291. this.foreground(c, x, y, w, h);
  292. };
  293. mxShapeMockupPieChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  294. {
  295. c.ellipse(0, 0, w, h);
  296. c.fillAndStroke();
  297. };
  298. mxShapeMockupPieChart.prototype.foreground = function(c, x, y, w, h)
  299. {
  300. var parts = mxUtils.getValue(this.style, mxShapeMockupPieChart.prototype.cst.PARTS, '10,20,30').toString().split(',');
  301. var partNum = parts.length;
  302. var partColors = mxUtils.getValue(this.style, mxShapeMockupPieChart.prototype.cst.PART_COLORS, '#333333,#666666,#999999').toString().split(',');
  303. var total = 0;
  304. for (var i = 0; i < partNum; i++)
  305. {
  306. total = total + parseInt(parts[i], 10);
  307. }
  308. for (var i = 0; i < partNum; i++)
  309. {
  310. if (partColors.length > i)
  311. {
  312. c.setFillColor(partColors[i]);
  313. }
  314. else
  315. {
  316. c.setFillColor('#ff0000');
  317. }
  318. var beginPerc = 0;
  319. var endPerc = 0;
  320. var currPerc = parseInt(parts[i], 10) / total;
  321. if (currPerc === 0.5)
  322. {
  323. currPerc = 0.501;
  324. }
  325. for (var j = 0; j < i; j++)
  326. {
  327. beginPerc = beginPerc + parseInt(parts[j], 10) / total;
  328. }
  329. endPerc = currPerc + beginPerc;
  330. var startAngle = 2 * Math.PI * beginPerc;
  331. var endAngle = 2 * Math.PI * endPerc;
  332. var x1 = w * 0.5 - w * Math.sin(startAngle) * 0.5;
  333. var y1 = h * 0.5 - h * Math.cos(startAngle) * 0.5;
  334. var x2 = w * 0.5 - w * Math.sin(endAngle) * 0.5;
  335. var y2 = h * 0.5 - h * Math.cos(endAngle) * 0.5;
  336. var largeArc = 1;
  337. var sweep = 1;
  338. if (endPerc - beginPerc < 0.5)
  339. {
  340. largeArc = 0;
  341. }
  342. c.begin();
  343. c.moveTo(w * 0.5, h * 0.5);
  344. c.lineTo(x2, y2);
  345. c.arcTo(w * 0.5, h * 0.5, 0, largeArc, 1, x1, y1);
  346. c.close();
  347. c.fillAndStroke();
  348. }
  349. };
  350. mxCellRenderer.registerShape(mxShapeMockupPieChart.prototype.cst.SHAPE_PIE_CHART, mxShapeMockupPieChart);
  351. //**********************************************************************************************************************************************************
  352. //Icon Grid (LEGACY)
  353. //**********************************************************************************************************************************************************
  354. /**
  355. * Extends mxShape.
  356. */
  357. function mxShapeMockupIconGrid(bounds, fill, stroke, strokewidth)
  358. {
  359. mxShape.call(this);
  360. this.bounds = bounds;
  361. this.fill = fill;
  362. this.stroke = stroke;
  363. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  364. };
  365. /**
  366. * Extends mxShape.
  367. */
  368. mxUtils.extend(mxShapeMockupIconGrid, mxShape);
  369. mxShapeMockupIconGrid.prototype.cst = {
  370. GRID_SIZE : 'gridSize',
  371. SHAPE_ICON_GRID : 'mxgraph.mockup.graphics.iconGrid'
  372. };
  373. /**
  374. * Function: paintVertexShape
  375. *
  376. * Paints the vertex shape.
  377. */
  378. mxShapeMockupIconGrid.prototype.paintVertexShape = function(c, x, y, w, h)
  379. {
  380. c.translate(x, y);
  381. var gridSize = mxUtils.getValue(this.style, mxShapeMockupIconGrid.prototype.cst.GRID_SIZE, '3,3').toString().split(',');
  382. this.background(c, w, h, gridSize);
  383. c.setShadow(false);
  384. this.foreground(c, w, h, gridSize);
  385. };
  386. mxShapeMockupIconGrid.prototype.background = function(c, w, h, gridSize)
  387. {
  388. var boxSizeX = w / (parseInt(gridSize[0],10) + (gridSize[0]-1) * 0.5);
  389. var boxSizeY = h / (parseInt(gridSize[1],10) + (gridSize[1]-1) * 0.5);
  390. for (var i = 0; i < gridSize[0]; i++)
  391. {
  392. for (var j = 0; j < gridSize[1]; j++)
  393. {
  394. c.rect(boxSizeX * 1.5 * i, boxSizeY * 1.5 * j, boxSizeX, boxSizeY);
  395. c.fillAndStroke();
  396. }
  397. }
  398. };
  399. mxShapeMockupIconGrid.prototype.foreground = function(c, w, h, gridSize)
  400. {
  401. var boxSizeX = w / (parseInt(gridSize[0],10) + (gridSize[0]-1) * 0.5);
  402. var boxSizeY = h / (parseInt(gridSize[1],10) + (gridSize[1]-1) * 0.5);
  403. for (var i = 0; i < gridSize[0]; i++)
  404. {
  405. for (var j = 0; j < gridSize[1]; j++)
  406. {
  407. c.begin();
  408. c.moveTo(boxSizeX * 1.5 * i, boxSizeY * 1.5 * j);
  409. c.lineTo(boxSizeX * 1.5 * i + boxSizeX, boxSizeY * 1.5 * j + boxSizeY);
  410. c.moveTo(boxSizeX * 1.5 * i + boxSizeX, boxSizeY * 1.5 * j);
  411. c.lineTo(boxSizeX * 1.5 * i, boxSizeY * 1.5 * j + boxSizeY);
  412. c.stroke();
  413. }
  414. }
  415. };
  416. mxCellRenderer.registerShape(mxShapeMockupIconGrid.prototype.cst.SHAPE_ICON_GRID, mxShapeMockupIconGrid);
  417. //**********************************************************************************************************************************************************
  418. //Bubble Chart
  419. //**********************************************************************************************************************************************************
  420. /**
  421. * Extends mxShape.
  422. */
  423. function mxShapeMockupBubbleChart(bounds, fill, stroke, strokewidth)
  424. {
  425. mxShape.call(this);
  426. this.bounds = bounds;
  427. this.fill = fill;
  428. this.stroke = stroke;
  429. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  430. };
  431. /**
  432. * Extends mxShape.
  433. */
  434. mxUtils.extend(mxShapeMockupBubbleChart, mxShape);
  435. mxShapeMockupBubbleChart.prototype.cst = {
  436. STROKE_COLOR2 : 'strokeColor2',
  437. STROKE_COLOR3 : 'strokeColor3',
  438. FILL_COLOR2 : 'fillColor2',
  439. FILL_COLOR3 : 'fillColor3',
  440. SHAPE_BUBBLE_CHART : 'mxgraph.mockup.graphics.bubbleChart'
  441. };
  442. mxShapeMockupBubbleChart.prototype.customProperties = [
  443. {name: 'strokeColor2', dispName: 'Bubble Stroke Color', type: 'color'},
  444. {name: 'strokeColor3', dispName: 'Coord. System Color', type: 'color'},
  445. {name: 'fillColor2', dispName: 'Bubble1 Color', type: 'color'},
  446. {name: 'fillColor3', dispName: 'Bubble2 Color', type: 'color'}
  447. ];
  448. /**
  449. * Function: paintVertexShape
  450. *
  451. * Paints the vertex shape.
  452. */
  453. mxShapeMockupBubbleChart.prototype.paintVertexShape = function(c, x, y, w, h)
  454. {
  455. c.translate(x, y);
  456. this.background(c, x, y, w, h);
  457. var bgFill = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
  458. if (bgFill !== 'none')
  459. {
  460. c.setShadow(false);
  461. }
  462. this.bars(c, x, y, w, h);
  463. };
  464. mxShapeMockupBubbleChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  465. {
  466. c.rect(0, 0, w, h);
  467. c.fillAndStroke();
  468. };
  469. mxShapeMockupBubbleChart.prototype.bars = function(c, x, y, w, h)
  470. {
  471. var barStroke = mxUtils.getValue(this.style, mxShapeMockupBubbleChart.prototype.cst.STROKE_COLOR2, 'none');
  472. var coordStroke = mxUtils.getValue(this.style, mxShapeMockupBubbleChart.prototype.cst.STROKE_COLOR3, '#666666');
  473. var barFill1 = mxUtils.getValue(this.style, mxShapeMockupBubbleChart.prototype.cst.FILL_COLOR2, '#008cff');
  474. var barFill2 = mxUtils.getValue(this.style, mxShapeMockupBubbleChart.prototype.cst.FILL_COLOR3, '#dddddd');
  475. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  476. c.setStrokeColor(barStroke);
  477. c.setFillColor(barFill1);
  478. var cx = w * 0.4;
  479. var cy = h * 0.45;
  480. var r = Math.min(h, w) * 0.14;
  481. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  482. c.fillAndStroke();
  483. cx = w * 0.1;
  484. cy = h * 0.8;
  485. r = Math.min(h, w) * 0.1;
  486. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  487. c.fillAndStroke();
  488. cx = w * 0.7;
  489. cy = h * 0.7;
  490. r = Math.min(h, w) * 0.22;
  491. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  492. c.fillAndStroke();
  493. c.setFillColor(barFill2);
  494. cx = w * 0.15;
  495. cy = h * 0.25;
  496. r = Math.min(h, w) * 0.19;
  497. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  498. c.fillAndStroke();
  499. cx = w * 0.48;
  500. cy = h * 0.7;
  501. r = Math.min(h, w) * 0.12;
  502. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  503. c.fillAndStroke();
  504. cx = w * 0.74;
  505. cy = h * 0.17;
  506. r = Math.min(h, w) * 0.1;
  507. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  508. c.fillAndStroke();
  509. c.setStrokeWidth(strokeWidth * 2);
  510. c.setStrokeColor(coordStroke);
  511. c.setShadow(false);
  512. c.begin();
  513. c.moveTo(0,0);
  514. c.lineTo(0, h);
  515. c.lineTo(w, h);
  516. c.stroke();
  517. };
  518. mxCellRenderer.registerShape(mxShapeMockupBubbleChart.prototype.cst.SHAPE_BUBBLE_CHART, mxShapeMockupBubbleChart);
  519. //**********************************************************************************************************************************************************
  520. //Gauge
  521. //**********************************************************************************************************************************************************
  522. /**
  523. * Extends mxShape.
  524. */
  525. function mxShapeMockupGauge(bounds, fill, stroke, strokewidth)
  526. {
  527. mxShape.call(this);
  528. this.bounds = bounds;
  529. this.fill = fill;
  530. this.stroke = stroke;
  531. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  532. this.gaugePos = 25;
  533. };
  534. /**
  535. * Extends mxShape.
  536. */
  537. mxUtils.extend(mxShapeMockupGauge, mxShape);
  538. mxShapeMockupGauge.prototype.cst = {
  539. SCALE_COLORS : 'scaleColors',
  540. GAUGE_LABELS : 'gaugeLabels',
  541. NEEDLE_COLOR : 'needleColor',
  542. TEXT_COLOR : 'textColor',
  543. TEXT_SIZE : 'textSize',
  544. GAUGE_POS : 'gaugePos',
  545. SHAPE_GAUGE : 'mxgraph.mockup.graphics.gauge'
  546. };
  547. mxShapeMockupGauge.prototype.customProperties = [
  548. {name: 'scaleColors', dispName: 'Scale Colors', type: 'string'},
  549. {name: 'needleColor', dispName: 'Needle Color', type: 'color'},
  550. {name: 'gaugePos', dispName: 'Needle Position', type: 'float', min:0, max:100, defVal:25}
  551. ];
  552. /**
  553. * Function: paintVertexShape
  554. *
  555. * Paints the vertex shape.
  556. */
  557. mxShapeMockupGauge.prototype.paintVertexShape = function(c, x, y, w, h)
  558. {
  559. c.translate(x, y);
  560. this.background(c, w, h);
  561. c.setShadow(false);
  562. this.foreground(c, w, h);
  563. };
  564. mxShapeMockupGauge.prototype.background = function(c, w, h)
  565. {
  566. c.ellipse(0, 0, w, h);
  567. c.fillAndStroke();
  568. };
  569. mxShapeMockupGauge.prototype.foreground = function(c, w, h)
  570. {
  571. var gaugePos = mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.GAUGE_POS, '0');
  572. var scaleColors = decodeURIComponent(mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.SCALE_COLORS, '#888888,#aaaaaa,#444444').toString()).split(',');
  573. var gaugeLabels = mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.GAUGE_LABELS, 'CPU[%],0,100').toString().split(',');
  574. var needleColor = mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.NEEDLE_COLOR, '#008cff');
  575. var fillColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  576. var textColor = mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.TEXT_COLOR, '#666666');
  577. var textSize = mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.TEXT_SIZE, '12');
  578. gaugePos = Math.max(0, gaugePos);
  579. gaugePos = Math.min(100, gaugePos);
  580. c.setFillColor(scaleColors[1]);
  581. c.begin();
  582. c.moveTo(w * 0.05, h * 0.5);
  583. c.arcTo(w * 0.4, h * 0.4, 0, 0, 1, w * 0.95, h * 0.5);
  584. c.lineTo(w, h * 0.5);
  585. c.arcTo(w * 0.5, h * 0.5, 0, 0, 0, 0, h * 0.5);
  586. c.close();
  587. c.fill();
  588. c.setFillColor(scaleColors[0]);
  589. c.begin();
  590. c.moveTo(w * 0.05, h * 0.5);
  591. c.arcTo(w * 0.45, h * 0.45, 0, 0, 0, w * 0.182, h * 0.818);
  592. c.lineTo(w * 0.146, h * 0.854);
  593. c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, 0, h * 0.5);
  594. c.close();
  595. c.fill();
  596. c.setFillColor(scaleColors[2]);
  597. c.begin();
  598. c.moveTo(w, h * 0.5);
  599. c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, w * 0.854, h * 0.854);
  600. c.lineTo(w * 0.818, h * 0.818);
  601. c.arcTo(w * 0.45, h * 0.45, 0, 0, 0, w * 0.95, h * 0.5);
  602. c.close();
  603. c.fill();
  604. c.setFontSize(textSize);
  605. c.setFontColor(textColor);
  606. c.text(w * 0.5, h * 0.3, 0, 0, gaugeLabels[0], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  607. c.text(w * 0.2, h * 0.85, 0, 0, gaugeLabels[1], mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  608. c.text(w * 0.8, h * 0.85, 0, 0, gaugeLabels[2], mxConstants.ALIGN_RIGHT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  609. var needlePos = (0.75 * (2 * Math.PI * parseFloat(gaugePos) / 100) + 1.25 * Math.PI);
  610. var x1 = w * 0.5 + w * 0.38 * Math.sin(needlePos);
  611. var y1 = h * 0.5 - h * 0.38 * Math.cos(needlePos);
  612. var x2 = 0;
  613. var y2 = 0;
  614. c.setFillColor(needleColor);
  615. c.begin();
  616. c.moveTo(x1, y1);
  617. x1 = w * 0.5 + w * 0.05 * Math.cos(needlePos);
  618. y1 = h * 0.5 + h * 0.05 * Math.sin(needlePos);
  619. c.lineTo(x1, y1);
  620. x2 = w * 0.5 + w * (-0.05) * Math.sin(needlePos);
  621. y2 = h * 0.5 - h * (-0.05) * Math.cos(needlePos);
  622. c.arcTo(w * 0.05, h * 0.05, 0, 0, 1, x2, y2);
  623. x1 = x2;
  624. y1 = y2;
  625. x2 = w * 0.5 - w * 0.05 * Math.cos(needlePos);
  626. y2 = h * 0.5 - h * 0.05 * Math.sin(needlePos);
  627. c.arcTo(w * 0.05, h * 0.05, 0, 0, 1, x2, y2);
  628. c.close();
  629. c.fill();
  630. c.setFillColor(fillColor);
  631. c.begin();
  632. c.moveTo(w * 0.49, h * 0.49);
  633. c.lineTo(w * 0.51, h * 0.49);
  634. c.lineTo(w * 0.51, h * 0.51);
  635. c.lineTo(w * 0.49, h * 0.51);
  636. c.close();
  637. c.fill();
  638. c.begin();
  639. c.ellipse(0, 0, w, h);
  640. c.stroke();
  641. c.begin();
  642. c.moveTo(w * 0.146, h * 0.854);
  643. c.lineTo(w * 0.219, h * 0.781);
  644. c.moveTo(w * 0.854, h * 0.854);
  645. c.lineTo(w * 0.781, h * 0.781);
  646. c.stroke();
  647. };
  648. mxCellRenderer.registerShape(mxShapeMockupGauge.prototype.cst.SHAPE_GAUGE, mxShapeMockupGauge);
  649. Graph.handleFactory[mxShapeMockupGauge.prototype.cst.SHAPE_GAUGE] = function(state)
  650. {
  651. var handles = [Graph.createHandle(state, ['gaugePos'], function(bounds)
  652. {
  653. var gaugePos = Math.max(0, Math.min(100, parseFloat(mxUtils.getValue(this.state.style, 'gaugePos', this.gaugePos))));
  654. return new mxPoint(bounds.x + bounds.width * 0.2 + gaugePos * 0.6 * bounds.width / 100, bounds.y + bounds.height * 0.8);
  655. }, function(bounds, pt)
  656. {
  657. this.state.style['gaugePos'] = Math.round(1000 * Math.max(0, Math.min(100, (pt.x - bounds.x) * 100 / bounds.width))) / 1000;
  658. })];
  659. return handles;
  660. }
  661. //**********************************************************************************************************************************************************
  662. //Plot Chart
  663. //**********************************************************************************************************************************************************
  664. /**
  665. * Extends mxShape.
  666. */
  667. function mxShapeMockupPlotChart(bounds, fill, stroke, strokewidth)
  668. {
  669. mxShape.call(this);
  670. this.bounds = bounds;
  671. this.fill = fill;
  672. this.stroke = stroke;
  673. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  674. };
  675. /**
  676. * Extends mxShape.
  677. */
  678. mxUtils.extend(mxShapeMockupPlotChart, mxShape);
  679. mxShapeMockupPlotChart.prototype.cst = {
  680. STROKE_COLOR2 : 'strokeColor2',
  681. STROKE_COLOR3 : 'strokeColor3',
  682. SHAPES_COLORS : 'fillColor2',
  683. SHAPE_PLOT_CHART : 'mxgraph.mockup.graphics.plotChart'
  684. };
  685. mxShapeMockupPlotChart.prototype.customProperties = [
  686. {name: 'strokeColor2', dispName: 'Bubble Stroke Color', type: 'color'},
  687. {name: 'strokeColor3', dispName: 'Coord. System Color', type: 'color'},
  688. {name: 'fillColor2', dispName: 'Shapes Color', type: 'string'}
  689. ];
  690. /**
  691. * Function: paintVertexShape
  692. *
  693. * Paints the vertex shape.
  694. */
  695. mxShapeMockupPlotChart.prototype.paintVertexShape = function(c, x, y, w, h)
  696. {
  697. c.translate(x, y);
  698. this.background(c, x, y, w, h);
  699. var bgFill = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
  700. if (bgFill !== 'none')
  701. {
  702. c.setShadow(false);
  703. }
  704. this.foreground(c, x, y, w, h);
  705. };
  706. mxShapeMockupPlotChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  707. {
  708. c.rect(0, 0, w, h);
  709. c.fillAndStroke();
  710. };
  711. mxShapeMockupPlotChart.prototype.foreground = function(c, x, y, w, h)
  712. {
  713. var shapeStroke = mxUtils.getValue(this.style, mxShapeMockupPlotChart.prototype.cst.STROKE_COLOR2, '#dddddd');
  714. var coordStroke = mxUtils.getValue(this.style, mxShapeMockupPlotChart.prototype.cst.STROKE_COLOR3, '#666666');
  715. var shapesColors = decodeURIComponent(mxUtils.getValue(this.style, mxShapeMockupPlotChart.prototype.cst.SHAPES_COLORS, '#00aaff,#0044ff,#008cff').toString()).split(',');
  716. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  717. var shapeSize = Math.min(w, h) * 0.03;
  718. c.setStrokeColor(shapeStroke);
  719. c.setFillColor(shapesColors[0]);
  720. var cx = w * 0.2;
  721. var cy = h * 0.8;
  722. c.begin();
  723. c.moveTo(cx - shapeSize * 0.5, cy - shapeSize * 0.5);
  724. c.lineTo(cx + shapeSize * 0.5, cy - shapeSize * 0.5);
  725. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  726. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  727. c.close();
  728. c.fillAndStroke();
  729. cx = w * 0.3;
  730. cy = h * 0.65;
  731. c.begin();
  732. c.moveTo(cx - shapeSize * 0.5, cy - shapeSize * 0.5);
  733. c.lineTo(cx + shapeSize * 0.5, cy - shapeSize * 0.5);
  734. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  735. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  736. c.close();
  737. c.fillAndStroke();
  738. cx = w * 0.6;
  739. cy = h * 0.44;
  740. c.begin();
  741. c.moveTo(cx - shapeSize * 0.5, cy - shapeSize * 0.5);
  742. c.lineTo(cx + shapeSize * 0.5, cy - shapeSize * 0.5);
  743. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  744. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  745. c.close();
  746. c.fillAndStroke();
  747. cx = w * 0.85;
  748. cy = h * 0.9;
  749. c.begin();
  750. c.moveTo(cx - shapeSize * 0.5, cy - shapeSize * 0.5);
  751. c.lineTo(cx + shapeSize * 0.5, cy - shapeSize * 0.5);
  752. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  753. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  754. c.close();
  755. c.fillAndStroke();
  756. c.setFillColor(shapesColors[1]);
  757. cx = w * 0.08;
  758. cy = h * 0.65;
  759. c.begin();
  760. c.moveTo(cx, cy - shapeSize * 0.5);
  761. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  762. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  763. c.close();
  764. c.fillAndStroke();
  765. cx = w * 0.58;
  766. cy = h * 0.85;
  767. c.begin();
  768. c.moveTo(cx, cy - shapeSize * 0.5);
  769. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  770. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  771. c.close();
  772. c.fillAndStroke();
  773. cx = w * 0.72;
  774. cy = h * 0.92;
  775. c.begin();
  776. c.moveTo(cx, cy - shapeSize * 0.5);
  777. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  778. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  779. c.close();
  780. c.fillAndStroke();
  781. c.setFillColor(shapesColors[2]);
  782. cx = w * 0.32;
  783. cy = h * 0.28;
  784. c.begin();
  785. c.moveTo(cx, cy - shapeSize * 0.75);
  786. c.lineTo(cx + shapeSize * 0.75, cy);
  787. c.lineTo(cx, cy + shapeSize * 0.75);
  788. c.lineTo(cx - shapeSize * 0.75, cy);
  789. c.close();
  790. c.fillAndStroke();
  791. cx = w * 0.92;
  792. cy = h * 0.45;
  793. c.begin();
  794. c.moveTo(cx, cy - shapeSize * 0.75);
  795. c.lineTo(cx + shapeSize * 0.75, cy);
  796. c.lineTo(cx, cy + shapeSize * 0.75);
  797. c.lineTo(cx - shapeSize * 0.75, cy);
  798. c.close();
  799. c.fillAndStroke();
  800. cx = w * 0.81;
  801. cy = h * 0.37;
  802. c.begin();
  803. c.moveTo(cx, cy - shapeSize * 0.75);
  804. c.lineTo(cx + shapeSize * 0.75, cy);
  805. c.lineTo(cx, cy + shapeSize * 0.75);
  806. c.lineTo(cx - shapeSize * 0.75, cy);
  807. c.close();
  808. c.fillAndStroke();
  809. cx = w * 0.51;
  810. cy = h * 0.7;
  811. c.begin();
  812. c.moveTo(cx, cy - shapeSize * 0.75);
  813. c.lineTo(cx + shapeSize * 0.75, cy);
  814. c.lineTo(cx, cy + shapeSize * 0.75);
  815. c.lineTo(cx - shapeSize * 0.75, cy);
  816. c.close();
  817. c.fillAndStroke();
  818. c.setStrokeWidth(strokeWidth * 2);
  819. c.setStrokeColor(coordStroke);
  820. c.setShadow(false);
  821. c.begin();
  822. c.moveTo(0,0);
  823. c.lineTo(0, h);
  824. c.lineTo(w, h);
  825. c.stroke();
  826. };
  827. mxCellRenderer.registerShape(mxShapeMockupPlotChart.prototype.cst.SHAPE_PLOT_CHART, mxShapeMockupPlotChart);
  828. //**********************************************************************************************************************************************************
  829. //Gantt Chart
  830. //**********************************************************************************************************************************************************
  831. /**
  832. * Extends mxShape.
  833. */
  834. function mxShapeMockupGanttChart(bounds, fill, stroke, strokewidth)
  835. {
  836. mxShape.call(this);
  837. this.bounds = bounds;
  838. this.fill = fill;
  839. this.stroke = stroke;
  840. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  841. };
  842. /**
  843. * Extends mxShape.
  844. */
  845. mxUtils.extend(mxShapeMockupGanttChart, mxShape);
  846. mxShapeMockupGanttChart.prototype.cst = {
  847. STROKE_COLOR2 : 'strokeColor2',
  848. STROKE_COLOR3 : 'strokeColor3',
  849. SHAPES_COLORS : 'fillColor2',
  850. TEXT_COLOR : 'textColor',
  851. TEXT_SIZE : 'textSize',
  852. SHAPE_GANTT_CHART : 'mxgraph.mockup.graphics.ganttChart'
  853. };
  854. /**
  855. * Function: paintVertexShape
  856. *
  857. * Paints the vertex shape.
  858. */
  859. mxShapeMockupGanttChart.prototype.paintVertexShape = function(c, x, y, w, h)
  860. {
  861. c.translate(x, y);
  862. this.background(c, x, y, w, h);
  863. c.setShadow(false);
  864. this.foreground(c, x, y, w, h);
  865. };
  866. mxShapeMockupGanttChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  867. {
  868. c.rect(0, 0, w, h);
  869. c.fillAndStroke();
  870. };
  871. mxShapeMockupGanttChart.prototype.foreground = function(c, x, y, w, h)
  872. {
  873. var shapesColors = decodeURIComponent(mxUtils.getValue(this.style, mxShapeMockupGanttChart.prototype.cst.SHAPES_COLORS, '#888888,#bbbbbb').toString()).split(',');
  874. var textColor = mxUtils.getValue(this.style, mxShapeMockupGanttChart.prototype.cst.TEXT_COLOR, '#666666');
  875. var textSize = mxUtils.getValue(this.style, mxShapeMockupGanttChart.prototype.cst.TEXT_SIZE, '#12');
  876. c.begin();
  877. c.moveTo(0, h * 0.13);
  878. c.lineTo(w, h * 0.13);
  879. c.moveTo(w * 0.4, 0);
  880. c.lineTo(w * 0.4, h);
  881. c.moveTo(w * 0.4, h * 0.065);
  882. c.lineTo(w, h * 0.065);
  883. c.moveTo(w * 0.03, 0);
  884. c.lineTo(w * 0.03, h * 0.13);
  885. c.moveTo(w * 0.1, 0);
  886. c.lineTo(w * 0.1, h * 0.13);
  887. c.moveTo(w * 0.315, 0);
  888. c.lineTo(w * 0.315, h * 0.13);
  889. c.moveTo(w * 0.45, h * 0.065);
  890. c.lineTo(w * 0.45, h * 0.13);
  891. c.moveTo(w * 0.5, h * 0.065);
  892. c.lineTo(w * 0.5, h);
  893. c.moveTo(w * 0.55, h * 0.065);
  894. c.lineTo(w * 0.55, h * 0.13);
  895. c.moveTo(w * 0.6, h * 0.065);
  896. c.lineTo(w * 0.6, h);
  897. c.moveTo(w * 0.65, h * 0.065);
  898. c.lineTo(w * 0.65, h * 0.13);
  899. c.moveTo(w * 0.7, h * 0.065);
  900. c.lineTo(w * 0.7, h);
  901. c.moveTo(w * 0.75, 0);
  902. c.lineTo(w * 0.75, h * 0.13);
  903. c.moveTo(w * 0.8, h * 0.065);
  904. c.lineTo(w * 0.8, h);
  905. c.moveTo(w * 0.85, h * 0.065);
  906. c.lineTo(w * 0.85, h * 0.13);
  907. c.moveTo(w * 0.9, h * 0.065);
  908. c.lineTo(w * 0.9, h);
  909. c.moveTo(w * 0.95, h * 0.065);
  910. c.lineTo(w * 0.95, h * 0.13);
  911. c.stroke();
  912. c.setFillColor(shapesColors[0]);
  913. c.begin();
  914. c.moveTo(w * 0.41, h * 0.15);
  915. c.lineTo(w * 0.64, h * 0.15);
  916. c.lineTo(w * 0.64, h * 0.18);
  917. c.lineTo(w * 0.625, h * 0.21);
  918. c.lineTo(w * 0.61, h * 0.18);
  919. c.lineTo(w * 0.44, h * 0.18);
  920. c.lineTo(w * 0.425, h * 0.21);
  921. c.lineTo(w * 0.41, h * 0.18);
  922. c.close();
  923. c.moveTo(w * 0.41, h * 0.24);
  924. c.lineTo(w * 0.49, h * 0.24);
  925. c.lineTo(w * 0.49, h * 0.275);
  926. c.lineTo(w * 0.41, h * 0.275);
  927. c.close();
  928. c.moveTo(w * 0.46, h * 0.31);
  929. c.lineTo(w * 0.64, h * 0.31);
  930. c.lineTo(w * 0.64, h * 0.345);
  931. c.lineTo(w * 0.46, h * 0.345);
  932. c.close();
  933. c.moveTo(w * 0.56, h * 0.39);
  934. c.lineTo(w * 0.69, h * 0.39);
  935. c.lineTo(w * 0.69, h * 0.425);
  936. c.lineTo(w * 0.56, h * 0.425);
  937. c.close();
  938. c.fill();
  939. c.setFillColor(shapesColors[1]);
  940. c.begin();
  941. c.moveTo(w * 0.46, h * 0.32);
  942. c.lineTo(w * 0.58, h * 0.32);
  943. c.lineTo(w * 0.58, h * 0.335);
  944. c.lineTo(w * 0.46, h * 0.335);
  945. c.close();
  946. c.fill();
  947. };
  948. mxCellRenderer.registerShape(mxShapeMockupGanttChart.prototype.cst.SHAPE_GANTT_CHART, mxShapeMockupGanttChart);
  949. //**********************************************************************************************************************************************************
  950. //Simple Icon
  951. //**********************************************************************************************************************************************************
  952. /**
  953. * Extends mxShape.
  954. */
  955. function mxShapeMockupSimpleIcon(bounds, fill, stroke, strokewidth)
  956. {
  957. mxShape.call(this);
  958. this.bounds = bounds;
  959. this.fill = fill;
  960. this.stroke = stroke;
  961. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  962. };
  963. /**
  964. * Extends mxShape.
  965. */
  966. mxUtils.extend(mxShapeMockupSimpleIcon, mxShape);
  967. mxShapeMockupSimpleIcon.prototype.cst = {
  968. SIMPLE_ICON : 'mxgraph.mockup.graphics.simpleIcon'
  969. };
  970. /**
  971. * Function: paintVertexShape
  972. *
  973. * Paints the vertex shape.
  974. */
  975. mxShapeMockupSimpleIcon.prototype.paintVertexShape = function(c, x, y, w, h)
  976. {
  977. c.translate(x, y);
  978. c.rect(0, 0, w, h);
  979. c.fillAndStroke();
  980. c.begin();
  981. c.moveTo(0, 0);
  982. c.lineTo(w, h);
  983. c.moveTo(0, h);
  984. c.lineTo(w, 0);
  985. c.stroke();
  986. };
  987. mxCellRenderer.registerShape(mxShapeMockupSimpleIcon.prototype.cst.SIMPLE_ICON, mxShapeMockupSimpleIcon);
  988. //**********************************************************************************************************************************************************
  989. //Anchor (a dummy shape without visuals used for anchoring)
  990. //**********************************************************************************************************************************************************
  991. /**
  992. * Extends mxShape.
  993. */
  994. function mxShapeMockupGraphicsAnchor(bounds, fill, stroke, strokewidth)
  995. {
  996. mxShape.call(this);
  997. this.bounds = bounds;
  998. };
  999. /**
  1000. * Extends mxShape.
  1001. */
  1002. mxUtils.extend(mxShapeMockupGraphicsAnchor, mxShape);
  1003. mxShapeMockupGraphicsAnchor.prototype.cst = {
  1004. ANCHOR : 'mxgraph.mockup.graphics.anchor'
  1005. };
  1006. /**
  1007. * Function: paintVertexShape
  1008. *
  1009. * Paints the vertex shape.
  1010. */
  1011. mxShapeMockupGraphicsAnchor.prototype.paintVertexShape = function(c, x, y, w, h)
  1012. {
  1013. };
  1014. mxCellRenderer.registerShape(mxShapeMockupGraphicsAnchor.prototype.cst.ANCHOR, mxShapeMockupGraphicsAnchor);
  1015. //**********************************************************************************************************************************************************
  1016. //Rounded rectangle (adjustable rounding)
  1017. //**********************************************************************************************************************************************************
  1018. /**
  1019. * Extends mxShape.
  1020. */
  1021. function mxShapeMockupGraphicsRRect(bounds, fill, stroke, strokewidth)
  1022. {
  1023. mxShape.call(this);
  1024. this.bounds = bounds;
  1025. this.fill = fill;
  1026. this.stroke = stroke;
  1027. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1028. };
  1029. /**
  1030. * Extends mxShape.
  1031. */
  1032. mxUtils.extend(mxShapeMockupGraphicsRRect, mxShape);
  1033. mxShapeMockupGraphicsRRect.prototype.cst = {
  1034. RRECT : 'mxgraph.mockup.graphics.rrect',
  1035. R_SIZE : 'rSize'
  1036. };
  1037. mxShapeMockupGraphicsRRect.prototype.customProperties = [
  1038. {name: 'rSize', dispName: 'Arc Size', type: 'float', min:0, defVal:10},
  1039. ];
  1040. /**
  1041. * Function: paintVertexShape
  1042. *
  1043. * Paints the vertex shape.
  1044. */
  1045. mxShapeMockupGraphicsRRect.prototype.paintVertexShape = function(c, x, y, w, h)
  1046. {
  1047. c.translate(x, y);
  1048. var rSize = parseInt(mxUtils.getValue(this.style, mxShapeMockupGraphicsRRect.prototype.cst.R_SIZE, '10'));
  1049. c.roundrect(0, 0, w, h, rSize);
  1050. c.fillAndStroke();
  1051. };
  1052. mxCellRenderer.registerShape(mxShapeMockupGraphicsRRect.prototype.cst.RRECT, mxShapeMockupGraphicsRRect);