| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667 |
- /**
- * Copyright (c) 2006-2018, JGraph Holdings Ltd
- */
- //**********************************************************************************************************************************************************
- //Numbered entry (vertical)
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicNumEntryVert(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dy = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicNumEntryVert, mxActor);
- mxShapeInfographicNumEntryVert.prototype.cst = {NUM_ENTRY_VERT : 'mxgraph.infographic.numberedEntryVert'};
- mxShapeInfographicNumEntryVert.prototype.customProperties = [
- {name:'dy', dispName:'Circle Size', min:0, defVal: 25}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicNumEntryVert.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dy = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var inset = 5;
- var d = Math.min(dy, w - 2 * inset, h - inset);
-
- c.ellipse(w * 0.5 - d * 0.5, 0, d, d);
- c.fillAndStroke();
-
- c.begin();
- c.moveTo(0, d * 0.5);
- c.lineTo(w * 0.5 - d * 0.5 - inset, d * 0.5);
- c.arcTo(d * 0.5 + inset, d * 0.5 + inset, 0, 0, 0, w * 0.5 + d * 0.5 + inset, d * 0.5);
- c.lineTo(w, d * 0.5);
- c.lineTo(w, h);
- c.lineTo(0, h);
- c.close();
- c.fillAndStroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicNumEntryVert.prototype.cst.NUM_ENTRY_VERT, mxShapeInfographicNumEntryVert);
- Graph.handleFactory[mxShapeInfographicNumEntryVert.prototype.cst.NUM_ENTRY_VERT] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dy'], function(bounds)
- {
- var dy = Math.max(0, Math.min(bounds.width, bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + bounds.width / 2, bounds.y + dy);
- }, function(bounds, pt)
- {
- this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height, bounds.width, pt.y - bounds.y))) / 100;
- })];
-
- return handles;
- };
- mxShapeInfographicNumEntryVert.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dy = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var inset = 5;
- var d = Math.min(dy, w - 2 * inset, h - inset);
-
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, d * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, d * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 0, d * 0.25));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, 0, d * 0.25));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Bending Arch
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicBendingArch(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.startAngle = 0.25;
- this.endAngle = 0.75;
- this.arcWidth = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicBendingArch, mxActor);
- mxShapeInfographicBendingArch.prototype.cst = {BENDING_ARCH : 'mxgraph.infographic.bendingArch'};
- mxShapeInfographicBendingArch.prototype.customProperties = [
- {name:'startAngle', dispName:'Start Angle', min:0, max:1, defVal: 0.75},
- {name:'endAngle', dispName:'End Angle', min:0, max:1, defVal: 0.25},
- {name:'arcWidth', dispName:'Arc Width', min:0, max:1, defVal: 0.25}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicBendingArch.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'startAngle', this.startAngle))));
- var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'endAngle', this.endAngle))));
- var arcWidth = 1 - Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'arcWidth', this.arcWidth))));
- var rx = w * 0.5;
- var ry = h * 0.5;
- var rx2 = rx * arcWidth;
- var ry2 = ry * arcWidth;
-
- var startX = rx + Math.sin(startAngle) * rx;
- var startY = ry - Math.cos(startAngle) * ry;
- var innerStartX = rx + Math.sin(startAngle) * rx2;
- var innerStartY = ry - Math.cos(startAngle) * ry2;
- var endX = rx + Math.sin(endAngle) * rx;
- var endY = ry - Math.cos(endAngle) * ry;
- var innerEndX = rx + Math.sin(endAngle) * rx2;
- var innerEndY = ry - Math.cos(endAngle) * ry2;
-
- var angDiff = endAngle - startAngle;
-
- if (angDiff < 0)
- {
- angDiff = angDiff + Math.PI * 2;
- }
-
- var bigArc = 0;
-
- if (angDiff > Math.PI)
- {
- bigArc = 1;
- }
- var rx3 = rx2 - 5;
- var ry3 = ry2 - 5;
- c.ellipse(w * 0.5 - rx3, h * 0.5 - ry3, 2 * rx3, 2 * ry3);
- c.fillAndStroke();
-
- c.begin();
- c.moveTo(startX, startY);
- c.arcTo(rx, ry, 0, bigArc, 1, endX, endY);
- c.lineTo(innerEndX, innerEndY);
- c.arcTo(rx2, ry2, 0, bigArc, 0, innerStartX, innerStartY);
- c.close();
- c.fillAndStroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicBendingArch.prototype.cst.BENDING_ARCH, mxShapeInfographicBendingArch);
- mxShapeInfographicBendingArch.prototype.constraints = null;
- Graph.handleFactory[mxShapeInfographicBendingArch.prototype.cst.BENDING_ARCH] = function(state)
- {
- var handles = [Graph.createHandle(state, ['startAngle'], function(bounds)
- {
- var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'startAngle', this.startAngle))));
- return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(startAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(startAngle) * bounds.height * 0.5);
- }, function(bounds, pt)
- {
- var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
- var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
-
- var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;
-
- if (res < 0)
- {
- res = 1 + res;
- }
- this.state.style['startAngle'] = res;
-
- })];
- var handle2 = Graph.createHandle(state, ['endAngle'], function(bounds)
- {
- var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'endAngle', this.endAngle))));
- return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(endAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(endAngle) * bounds.height * 0.5);
- }, function(bounds, pt)
- {
- var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
- var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
-
- var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;
-
- if (res < 0)
- {
- res = 1 + res;
- }
-
- this.state.style['endAngle'] = res;
- });
-
- handles.push(handle2);
-
- var handle3 = Graph.createHandle(state, ['arcWidth'], function(bounds)
- {
- var arcWidth = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'arcWidth', this.arcWidth))));
- return new mxPoint(bounds.x + bounds.width / 2, bounds.y + arcWidth * bounds.height * 0.5);
- }, function(bounds, pt)
- {
- this.state.style['arcWidth'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, (pt.y - bounds.y) / (bounds.height * 0.5)))) / 100;
- });
-
- handles.push(handle3);
-
- return handles;
- };
- //**********************************************************************************************************************************************************
- //Parallelogram
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicParallelogram(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 10;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicParallelogram, mxActor);
- mxShapeInfographicParallelogram.prototype.cst = {PARALLELOGRAM : 'mxgraph.infographic.parallelogram'};
- mxShapeInfographicParallelogram.prototype.customProperties = [
- {name:'dx', dispName:'Angle', min:0, defVal: 15}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicParallelogram.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dx = Math.max(0, Math.min(w * 0.5, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- c.begin();
- c.moveTo(0, h);
- c.lineTo(2 * dx, 0);
- c.lineTo(w, 0);
- c.lineTo(w - 2 * dx, h);
- c.close();
- c.fillAndStroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicParallelogram.prototype.cst.PARALLELOGRAM, mxShapeInfographicParallelogram);
- Graph.handleFactory[mxShapeInfographicParallelogram.prototype.cst.PARALLELOGRAM] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- return new mxPoint(bounds.x + dx, bounds.y + bounds.height / 2);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width / 2, pt.x - bounds.x))) / 100;
- })];
-
- return handles;
- };
- mxShapeInfographicParallelogram.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dx = Math.max(0, Math.min(w * 0.5, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var w2 = w - 2 * dx;
- constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2 * dx, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 2 * dx + w2 * 0.5, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, dx, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - 2 * dx, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, w - dx, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w2 * 0.5, h));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Ribbon Rolled
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicRibbonRolled(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 185;
- this.dy = 15;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicRibbonRolled, mxActor);
- mxShapeInfographicRibbonRolled.prototype.cst = {RIBBON_ROLLED : 'mxgraph.infographic.ribbonRolled'};
- mxShapeInfographicRibbonRolled.prototype.customProperties = [
- {name:'dx', dispName:'Roll Length', min:0, defVal: 185},
- {name:'dy', dispName:'Ribbon Width', min:0, defVal: 15}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicRibbonRolled.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, dy);
- c.lineTo(w, dy);
- c.lineTo(w, h - dy);
- c.lineTo(w - dx, h);
- c.lineTo(w - dx, h - dy);
- c.lineTo(0, h - dy);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
- c.setFillAlpha('0.2');
- c.setFillColor('#000000');
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, dy);
- c.close();
- c.moveTo(w, h - dy);
- c.lineTo(w - dx, h);
- c.lineTo(w - dx, h - dy);
- c.close();
- c.fill();
-
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, dy);
- c.lineTo(w, dy);
- c.lineTo(w, h - dy);
- c.lineTo(w - dx, h);
- c.lineTo(w - dx, h - dy);
- c.lineTo(0, h - dy);
- c.close();
- c.stroke();
-
- };
- mxCellRenderer.registerShape(mxShapeInfographicRibbonRolled.prototype.cst.RIBBON_ROLLED, mxShapeInfographicRibbonRolled);
- Graph.handleFactory[mxShapeInfographicRibbonRolled.prototype.cst.RIBBON_ROLLED] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + dx, bounds.y + dy);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
- this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, pt.y - bounds.y))) / 100;
- })];
-
- return handles;
- };
- mxShapeInfographicRibbonRolled.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var h2 = h - dy;
-
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h2));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false, null, 0, h2));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, h2));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false, null, 0, h2));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, 0, -dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Ribbon Double Folded
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicRibbonDoubleFolded(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 25;
- this.dy = 15;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicRibbonDoubleFolded, mxActor);
- mxShapeInfographicRibbonDoubleFolded.prototype.cst = {RIBBON_DOUBLE_FOLDED : 'mxgraph.infographic.ribbonDoubleFolded'};
- mxShapeInfographicRibbonDoubleFolded.prototype.customProperties = [
- {name:'dx', dispName:'Fold Length', min:0, defVal: 25},
- {name:'dy', dispName:'Ribbon Width', min:0, defVal: 15}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicRibbonDoubleFolded.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, dy);
- c.lineTo(w, dy);
- c.lineTo(w, h - dy);
- c.lineTo(w - dx, h);
- c.lineTo(w - dx, h - dy);
- c.lineTo(0, h - dy);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
- c.setFillAlpha('0.2');
- c.setFillColor('#000000');
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, h - 2 * dy);
- c.lineTo(0, h - dy);
- c.close();
- c.moveTo(w, h - dy);
- c.lineTo(w - dx, h);
- c.lineTo(w - dx, h - dy);
- c.close();
- c.fill();
-
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, dy);
- c.lineTo(w, dy);
- c.lineTo(w, h - dy);
- c.lineTo(w - dx, h);
- c.lineTo(w - dx, h - dy);
- c.lineTo(0, h - dy);
- c.close();
- c.stroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicRibbonDoubleFolded.prototype.cst.RIBBON_DOUBLE_FOLDED, mxShapeInfographicRibbonDoubleFolded);
- Graph.handleFactory[mxShapeInfographicRibbonDoubleFolded.prototype.cst.RIBBON_DOUBLE_FOLDED] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + dx, bounds.y + dy);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
- this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, pt.y - bounds.y))) / 100;
- })];
-
- return handles;
- };
- mxShapeInfographicRibbonDoubleFolded.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false, null, 0, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false, null, 0, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Ribbon Front Folded
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicRibbonFrontFolded(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 0.5;
- this.dy = 0.5;
- this.notch = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicRibbonFrontFolded, mxActor);
- mxShapeInfographicRibbonFrontFolded.prototype.cst = {RIBBON_FRONT_FOLDED : 'mxgraph.infographic.ribbonFrontFolded'};
- mxShapeInfographicRibbonFrontFolded.prototype.customProperties = [
- {name:'dx', dispName:'Fold Length', min:0, defVal: 25},
- {name:'dy', dispName:'Ribbon Width', min:0, defVal: 15},
- {name:'notch', dispName:'Notch', min:0, defVal: 15}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicRibbonFrontFolded.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var notch = Math.max(0, Math.min(w - dx, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, dy);
- c.lineTo(w, dy);
- c.lineTo(w - notch, (h - dy) / 2 + dy);
- c.lineTo(w, h);
- c.lineTo(0, h);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
- c.setFillAlpha('0.2');
- c.setFillColor('#000000');
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, h - dy);
- c.lineTo(0, h);
- c.close();
- c.fill();
-
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, dy);
- c.lineTo(w, dy);
- c.lineTo(w - notch, (h - dy) / 2 + dy);
- c.lineTo(w, h);
- c.lineTo(0, h);
- c.close();
- c.stroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicRibbonFrontFolded.prototype.cst.RIBBON_FRONT_FOLDED, mxShapeInfographicRibbonFrontFolded);
- Graph.handleFactory[mxShapeInfographicRibbonFrontFolded.prototype.cst.RIBBON_FRONT_FOLDED] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + dx, bounds.y + dy);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
- this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, pt.y - bounds.y))) / 100;
- })];
- var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
- {
- var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
- return new mxPoint(bounds.x + bounds.width - notch, bounds.y + dy + (bounds.height - dy) * 0.5);
- }, function(bounds, pt)
- {
- this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width, (bounds.width + bounds.x - pt.x)))) / 100;
- });
-
- handles.push(handle2);
- return handles;
- };
- mxShapeInfographicRibbonFrontFolded.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var notch = Math.max(0, Math.min(w - dx, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - notch, (h + dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h + dy) * 0.5));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Ribbon Back Folded
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicRibbonBackFolded(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 0.5;
- this.dy = 0.5;
- this.notch = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicRibbonBackFolded, mxActor);
- mxShapeInfographicRibbonBackFolded.prototype.cst = {RIBBON_BACK_FOLDED : 'mxgraph.infographic.ribbonBackFolded'};
- mxShapeInfographicRibbonBackFolded.prototype.customProperties = [
- {name:'dx', dispName:'Fold Length', min:0, defVal: 25},
- {name:'dy', dispName:'Ribbon Width', min:0, defVal: 15},
- {name:'notch', dispName:'Notch', min:0, defVal: 15}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicRibbonBackFolded.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var notch = Math.max(0, Math.min(w - dx, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, dy);
- c.lineTo(w, dy);
- c.lineTo(w - notch, (h - dy) / 2 + dy);
- c.lineTo(w, h);
- c.lineTo(0, h);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
- c.setFillAlpha('0.2');
- c.setFillColor('#000000');
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, dy);
- c.close();
- c.fill();
-
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, 0);
- c.lineTo(dx, dy);
- c.lineTo(w, dy);
- c.lineTo(w - notch, (h - dy) / 2 + dy);
- c.lineTo(w, h);
- c.lineTo(0, h);
- c.close();
- c.stroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicRibbonBackFolded.prototype.cst.RIBBON_BACK_FOLDED, mxShapeInfographicRibbonBackFolded);
- Graph.handleFactory[mxShapeInfographicRibbonBackFolded.prototype.cst.RIBBON_BACK_FOLDED] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + dx, bounds.y + dy);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
- this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, pt.y - bounds.y))) / 100;
- })];
- var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
- {
- var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- var notch = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
- return new mxPoint(bounds.x + bounds.width - notch, bounds.y + dy + (bounds.height - dy) * 0.5);
- }, function(bounds, pt)
- {
- this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width, (bounds.width + bounds.x - pt.x)))) / 100;
- });
-
- handles.push(handle2);
-
- return handles;
- };
- mxShapeInfographicRibbonBackFolded.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var notch = Math.max(0, Math.min(w - dx, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, 0, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - notch, (h + dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h + dy) * 0.5));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Banner
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicBanner(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 0.5;
- this.dy = 0.5;
- this.notch = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicBanner, mxActor);
- mxShapeInfographicBanner.prototype.cst = {BANNER : 'mxgraph.infographic.banner'};
- mxShapeInfographicBanner.prototype.customProperties = [
- {name:'dx', dispName:'Fold Length', min:0, defVal: 25},
- {name:'dy', dispName:'Ribbon Width', min:0, defVal: 15},
- {name:'notch', dispName:'Notch', min:0, defVal: 15}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicBanner.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dx = Math.max(0, Math.min(w / 2, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
- dx = Math.min(w / 2 - 2 * dy, dx);
-
- notch = Math.min(dx, notch);
-
- c.begin();
- c.moveTo(0, dy);
- c.lineTo(dx, dy);
- c.lineTo(dx, 0);
- c.lineTo(w - dx, 0);
- c.lineTo(w - dx, dy);
- c.lineTo(w, dy);
- c.lineTo(w - notch, (h - dy) * 0.5 + dy);
- c.lineTo(w, h);
- c.lineTo(w - dx - 2 * dy, h);
- c.lineTo(w - dx - 2 * dy, h - dy);
- c.lineTo(dx + 2 * dy, h - dy);
- c.lineTo(dx + 2 * dy, h);
- c.lineTo(0, h);
- c.lineTo(notch, (h - dy) * 0.5 + dy);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
- c.setFillAlpha('0.2');
- c.setFillColor('#000000');
- c.begin();
- c.moveTo(0,dy);
- c.lineTo(dx, dy);
- c.lineTo(dx, h - dy);
- c.lineTo(dx + 2 * dy, h);
- c.lineTo(0, h);
- c.lineTo(notch, (h - dy) * 0.5 + dy);
- c.close();
- c.moveTo(w,dy);
- c.lineTo(w - dx, dy);
- c.lineTo(w - dx, h - dy);
- c.lineTo(w - dx - 2 * dy, h);
- c.lineTo(w, h);
- c.lineTo(w - notch, (h - dy) * 0.5 + dy);
- c.close();
- c.fill();
-
- c.setFillAlpha('0.4');
- c.begin();
- c.moveTo(dx, h - dy);
- c.lineTo(dx + 2 * dy, h - dy);
- c.lineTo(dx + 2 * dy, h);
- c.close();
- c.moveTo(w - dx, h - dy);
- c.lineTo(w - dx - 2 * dy, h - dy);
- c.lineTo(w - dx - 2 * dy, h);
- c.close();
- c.fill();
- };
- mxCellRenderer.registerShape(mxShapeInfographicBanner.prototype.cst.BANNER, mxShapeInfographicBanner);
- Graph.handleFactory[mxShapeInfographicBanner.prototype.cst.BANNER] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width / 2, bounds.x + bounds.width - pt.x))) / 100;
- this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, pt.y - bounds.y))) / 100;
- })];
-
- var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
- {
- var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- var dx = Math.max(0, Math.min(bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var notch = Math.max(0, Math.min(dx, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
- return new mxPoint(bounds.x + bounds.width - notch, bounds.y + dy + (bounds.height - dy) * 0.5);
- }, function(bounds, pt)
- {
- this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width, (bounds.width + bounds.x - pt.x)))) / 100;
- });
-
- handles.push(handle2);
-
- return handles;
- };
- mxShapeInfographicBanner.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dx = Math.max(0, Math.min(w / 2, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
- dx = Math.min(w / 2 - 2 * dy, dx);
- notch = Math.min(dx, notch);
- var w2 = w - 2 * dx;
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx + w2 * 0.25, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx + w2 * 0.5, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx + w2 * 0.75, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx + w2, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx + w2, (h - dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx + w2, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx + w2 * 0.75, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx + w2 * 0.5, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx + w2 * 0.25, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, (h - dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, notch, (h + dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - notch, (h + dy) * 0.5));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Circular Callout
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicCircularCallout(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dy = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicCircularCallout, mxActor);
- mxShapeInfographicCircularCallout.prototype.cst = {CIRCULAR_CALLOUT : 'mxgraph.infographic.circularCallout'};
- mxShapeInfographicCircularCallout.prototype.customProperties = [
- {name:'dy', dispName:'Ribbon Width', min:0, defVal: 15}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicCircularCallout.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
-
- var rx = Math.max(0, Math.min(w * 0.5, w * 0.5 - dy));
- var ry = Math.max(0, Math.min(h * 0.5, h * 0.5 - dy));
-
- c.begin();
- c.moveTo(w, h * 0.5);
- c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, w * 0.5, h);
- c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, 0, h * 0.5);
- c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, w * 0.5, 0);
- c.lineTo(w, 0);
- c.close();
- c.moveTo(w * 0.5, dy);
- c.arcTo(rx, ry, 0, 0, 0, w * 0.5 - rx, h * 0.5);
- c.arcTo(rx, ry, 0, 0, 0, w * 0.5, h * 0.5 + ry);
- c.arcTo(rx, ry, 0, 0, 0, w * 0.5 + rx, h * 0.5);
- c.arcTo(rx, ry, 0, 0, 0, w * 0.5, h * 0.5 - ry);
- c.close();
- c.fillAndStroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicCircularCallout.prototype.cst.CIRCULAR_CALLOUT, mxShapeInfographicCircularCallout);
- Graph.handleFactory[mxShapeInfographicCircularCallout.prototype.cst.CIRCULAR_CALLOUT] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dy'], function(bounds)
- {
- var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + bounds.width * 0.5, bounds.y + dy);
- }, function(bounds, pt)
- {
- this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, pt.y - bounds.y))) / 100;
- })];
-
- return handles;
- };
- mxShapeInfographicCircularCallout.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var rx = Math.max(0, Math.min(w * 0.5, w * 0.5 - dy));
- var ry = Math.max(0, Math.min(h * 0.5, h * 0.5 - dy));
-
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.855), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.855), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.145), false));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Shaded triangle
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicShadedTriangle(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicShadedTriangle, mxActor);
- mxShapeInfographicShadedTriangle.prototype.cst = {SHADED_TRIANGLE : 'mxgraph.infographic.shadedTriangle'};
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicShadedTriangle.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- c.begin();
- c.moveTo(0, h);
- c.lineTo(w * 0.5, 0);
- c.lineTo(w, h);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
-
- c.setFillColor('#ffffff');
- c.setFillAlpha('0.2');
-
- c.begin();
- c.moveTo(0, h);
- c.lineTo(w * 0.5, 0);
- c.lineTo(w * 0.5, h * 0.67);
- c.close();
- c.fill();
-
- c.setFillColor('#000000');
- c.begin();
- c.moveTo(w, h);
- c.lineTo(w * 0.5, h * 0.67);
- c.lineTo(w * 0.5, 0);
- c.close();
- c.fill();
-
- c.begin();
- c.moveTo(0, h);
- c.lineTo(w * 0.5, 0);
- c.lineTo(w, h);
- c.close();
- c.stroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicShadedTriangle.prototype.cst.SHADED_TRIANGLE, mxShapeInfographicShadedTriangle);
- mxShapeInfographicShadedTriangle.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.5), false));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.5), false));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Shaded pyramid
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicShadedPyramid(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicShadedPyramid, mxActor);
- mxShapeInfographicShadedPyramid.prototype.cst = {SHADED_PYRAMID : 'mxgraph.infographic.shadedPyramid'};
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicShadedPyramid.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var h1 = Math.max(h - w * 0.3, 0);
- c.begin();
- c.moveTo(0, h1);
- c.lineTo(w * 0.5, 0);
- c.lineTo(w, h1);
- c.lineTo(w * 0.5, h);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
-
- c.setFillColor('#ffffff');
- c.setFillAlpha('0.2');
-
- c.begin();
- c.moveTo(0, h1);
- c.lineTo(w * 0.5, 0);
- c.lineTo(w * 0.5, h);
- c.close();
- c.fill();
-
- c.setFillColor('#000000');
- c.begin();
- c.moveTo(w, h1);
- c.lineTo(w * 0.5, h);
- c.lineTo(w * 0.5, 0);
- c.close();
- c.fill();
-
- c.begin();
- c.moveTo(0, h1);
- c.lineTo(w * 0.5, 0);
- c.lineTo(w, h1);
- c.lineTo(w * 0.5, h);
- c.close();
- c.stroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicShadedPyramid.prototype.cst.SHADED_PYRAMID, mxShapeInfographicShadedPyramid);
- mxShapeInfographicShadedPyramid.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var h1 = Math.max(h - w * 0.3, 0);
-
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75, h1 * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h1));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75, (h + h1) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25, (h + h1) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h1));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25, h1 * 0.5));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Pyramid step
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicPyramidStep(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicPyramidStep, mxActor);
- mxShapeInfographicPyramidStep.prototype.cst = {PYRAMID_STEP : 'mxgraph.infographic.pyramidStep'};
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicPyramidStep.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var h1 = Math.max(w * 0.1, 0);
- c.begin();
- c.moveTo(0, h1);
- c.lineTo(w * 0.5, 0);
- c.lineTo(w, h1);
- c.lineTo(w, h);
- c.lineTo(0, h);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
-
- c.setFillColor('#ffffff');
- c.setFillAlpha('0.2');
-
- c.begin();
- c.moveTo(0, h1);
- c.lineTo(w * 0.5, 0);
- c.lineTo(w * 0.5, h);
- c.lineTo(0, h);
- c.close();
- c.fill();
-
- c.setFillColor('#000000');
- c.begin();
- c.moveTo(w, h1);
- c.lineTo(w, h);
- c.lineTo(w * 0.5, h);
- c.lineTo(w * 0.5, 0);
- c.close();
- c.fill();
-
- c.begin();
- c.moveTo(0, h1);
- c.lineTo(w * 0.5, 0);
- c.lineTo(w, h1);
- c.lineTo(w, h);
- c.lineTo(0, h);
- c.close();
- c.stroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicPyramidStep.prototype.cst.PYRAMID_STEP, mxShapeInfographicPyramidStep);
- mxShapeInfographicPyramidStep.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var h1 = Math.max(w * 0.1, 0);
-
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75, h1 * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h1));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h1 + (h - h1) * 0.25));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h1 + (h - h1) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h1 + (h - h1) * 0.75));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h1 + (h - h1) * 0.75));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h1 + (h - h1) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h1 + (h - h1) * 0.25));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25, h1 * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h1));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Cylinder
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicCylinder(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicCylinder, mxActor);
- mxShapeInfographicCylinder.prototype.cst = {CYLINDER : 'mxgraph.infographic.cylinder'};
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicCylinder.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
-
- var dy = 20;
- var rx = w * 0.5;
- var ry = dy * 0.5;
-
- c.begin();
- c.moveTo(0, dy * 0.5);
- c.arcTo(rx, ry, 0, 0, 1, w, ry);
- c.lineTo(w, h - ry);
- c.arcTo(rx, ry, 0, 0, 1, 0, h - ry);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
- c.setGradient('#000000', '#ffffff', 0, 0, w, h, mxConstants.DIRECTION_EAST, 0.4, 0.4);
-
- c.begin();
- c.moveTo(0, dy * 0.5);
- c.arcTo(rx, ry, 0, 0, 0, w, ry);
- c.lineTo(w, h - ry);
- c.arcTo(rx, ry, 0, 0, 1, 0, h - ry);
- c.close();
- c.fill();
- c.begin();
- c.moveTo(0, dy * 0.5);
- c.arcTo(rx, ry, 0, 0, 1, w, ry);
- c.lineTo(w, h - ry);
- c.arcTo(rx, ry, 0, 0, 1, 0, h - ry);
- c.close();
- c.stroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicCylinder.prototype.cst.CYLINDER, mxShapeInfographicCylinder);
- mxShapeInfographicCylinder.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dy = 20;
- var rx = w * 0.5;
- var ry = dy * 0.5;
-
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dy * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dy * 0.5 + (h - dy) * 0.25));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dy * 0.5 + (h - dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dy * 0.5 + (h - dy) * 0.75));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - dy * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy * 0.5 + (h - dy) * 0.75));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy * 0.5 + (h - dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy * 0.5 + (h - dy) * 0.25));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Circular Callout 2
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicCircularCallout2(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dy = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicCircularCallout2, mxActor);
- mxShapeInfographicCircularCallout2.prototype.cst = {CIRCULAR_CALLOUT_2 : 'mxgraph.infographic.circularCallout2'};
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicCircularCallout2.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var fillColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, 'none');
- c.setFillColor(strokeColor);
- var rx = Math.max(0, Math.min(w * 0.5, h * 0.4, h * 0.5 - 7));
- c.begin();
- c.moveTo(w * 0.5 - 2, 2.15 * rx);
- c.arcTo(rx * 0.23, rx * 0.23, 0, 0, 0, w * 0.5 - rx * 0.2, rx * 1.97);
- c.arcTo(rx, rx, 0, 0, 1, w * 0.5 - rx, rx);
- c.arcTo(rx, rx, 0, 0, 1, w * 0.5, 0);
- c.arcTo(rx, rx, 0, 0, 1, w * 0.5 + rx, rx);
- c.arcTo(rx, rx, 0, 0, 1, w * 0.5 + rx * 0.2, rx * 1.97);
- c.arcTo(rx * 0.23, rx * 0.23, 0, 0, 0, w * 0.5 + 2, 2.15 * rx);
- var rxMin = Math.max(rx * 0.1, 6);
-
- if (rx * 0.04 > 4)
- {
- c.lineTo(w * 0.5 + 2, h - rx * 0.22);
- c.arcTo(rx * 0.05, rx * 0.05, 0, 0, 0, w * 0.5 + rx * 0.04, h - rx * 0.19);
- }
- else
- {
- c.lineTo(w * 0.5 + 2, h - 2 * rxMin);
- }
-
- c.arcTo(rxMin, rxMin, 0, 0, 1, w * 0.5 + rxMin, h - rxMin);
- c.arcTo(rxMin, rxMin, 0, 0, 1, w * 0.5, h);
- c.arcTo(rxMin, rxMin, 0, 0, 1, w * 0.5 - rxMin, h - rxMin);
- if (rx * 0.04 > 4)
- {
- c.arcTo(rxMin, rxMin, 0, 0, 1, w * 0.5 - rx * 0.04, h - rx * 0.19);
- c.arcTo(rxMin * 0.5, rxMin * 0.5, 0, 0, 0, w * 0.5 - 2, h - rx * 0.22);
- }
- else
- {
- c.arcTo(rxMin, rxMin, 0, 0, 1, w * 0.5 - 2, h - 2 * rxMin);
- }
-
- c.close();
- c.moveTo(w * 0.5, rx * 0.2);
- c.arcTo(rx * 0.8, rx * 0.8, 0, 0, 0, w * 0.5 - rx * 0.8, rx * 0.8);
- c.arcTo(rx * 0.8, rx * 0.8, 0, 0, 0, w * 0.5, rx * 1.8);
- c.arcTo(rx * 0.8, rx * 0.8, 0, 0, 0, w * 0.5 + rx * 0.8, rx * 0.8);
- c.arcTo(rx * 0.8, rx * 0.8, 0, 0, 0, w * 0.5, rx * 0.2);
- c.close();
- c.moveTo(w * 0.5, h - rxMin * 1.75);
- c.arcTo(rxMin * 0.75, rxMin * 0.75, 0, 0, 0, w * 0.5 - rxMin * 0.75, h - rxMin );
- c.arcTo(rxMin * 0.75, rxMin * 0.75, 0, 0, 0, w * 0.5, h - rxMin * 0.25);
- c.arcTo(rxMin * 0.75, rxMin * 0.75, 0, 0, 0, w * 0.5 + rxMin * 0.75, h - rxMin);
- c.arcTo(rxMin * 0.75, rxMin * 0.75, 0, 0, 0, w * 0.5, h - rxMin * 1.75);
- c.close();
- c.fill();
-
- c.setFillColor(fillColor);
- c.setShadow(false);
-
- c.begin();
- c.moveTo(w * 0.5, rx * 0.2);
- c.arcTo(rx * 0.8, rx * 0.8, 0, 0, 0, w * 0.5 - rx * 0.8, rx * 0.8);
- c.arcTo(rx * 0.8, rx * 0.8, 0, 0, 0, w * 0.5, rx * 1.8);
- c.arcTo(rx * 0.8, rx * 0.8, 0, 0, 0, w * 0.5 + rx * 0.8, rx * 0.8);
- c.arcTo(rx * 0.8, rx * 0.8, 0, 0, 0, w * 0.5, rx * 0.2);
- c.close();
- c.moveTo(w * 0.5, h - rxMin * 1.75);
- c.arcTo(rxMin * 0.75, rxMin * 0.75, 0, 0, 0, w * 0.5 - rxMin * 0.75, h - rxMin );
- c.arcTo(rxMin * 0.75, rxMin * 0.75, 0, 0, 0, w * 0.5, h - rxMin * 0.25);
- c.arcTo(rxMin * 0.75, rxMin * 0.75, 0, 0, 0, w * 0.5 + rxMin * 0.75, h - rxMin);
- c.arcTo(rxMin * 0.75, rxMin * 0.75, 0, 0, 0, w * 0.5, h - rxMin * 1.75);
- c.close();
- c.fill();
- };
- mxCellRenderer.registerShape(mxShapeInfographicCircularCallout2.prototype.cst.CIRCULAR_CALLOUT_2, mxShapeInfographicCircularCallout2);
- mxShapeInfographicCircularCallout2.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var rx = Math.max(0, Math.min(w * 0.5, h * 0.4, h * 0.5 - 7));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - rx, rx));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + rx, rx));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Banner Single Fold
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicBannerSingleFold(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 0.5;
- this.dy = 0.5;
- this.dx2 = 0.5;
- this.notch = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicBannerSingleFold, mxActor);
- mxShapeInfographicBannerSingleFold.prototype.cst = {BANNER_SINGLE_FOLD : 'mxgraph.infographic.bannerSingleFold'};
- mxShapeInfographicBannerSingleFold.prototype.customProperties = [
- {name:'dx', dispName: 'Fold Length', type:'float', defVal:32, min:0},
- {name:'dy', dispName: 'Banner Width', type:'float', defVal:17, min:0},
- {name:'notch', dispName: 'Notch', type:'float', defVal:15, min:0}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicBannerSingleFold.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
- dx = Math.min(w - 2 * dy, dx);
- var dx2 = Math.max(0, Math.min(w - dx - 2 * dy, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
- notch = Math.min(dx, notch);
-
- c.begin();
- c.moveTo(dx2, 0);
- c.lineTo(w - dx, 0);
- c.lineTo(w - dx, dy);
- c.lineTo(w, dy);
- c.lineTo(w - notch, (h - dy) * 0.5 + dy);
- c.lineTo(w, h);
- c.lineTo(w - dx - 2 * dy, h);
- c.lineTo(w - dx - 2 * dy, h - dy);
- c.lineTo(dx2, h - dy);
- c.lineTo(0, (h - dy) * 0.5);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
- c.setFillAlpha('0.05');
- c.setFillColor('#000000');
- c.begin();
- c.moveTo(w,dy);
- c.lineTo(w - dx, dy);
- c.lineTo(w - dx, h - dy);
- c.lineTo(w - dx - 2 * dy, h);
- c.lineTo(w, h);
- c.lineTo(w - notch, (h - dy) * 0.5 + dy);
- c.close();
- c.fill();
-
- c.setFillAlpha('0.4');
- c.begin();
- c.moveTo(w - dx, h - dy);
- c.lineTo(w - dx - 2 * dy, h - dy);
- c.lineTo(w - dx - 2 * dy, h);
- c.close();
- c.fill();
-
- c.begin();
- c.moveTo(dx2, 0);
- c.lineTo(w - dx, 0);
- c.lineTo(w - dx, dy);
- c.lineTo(w, dy);
- c.lineTo(w - notch, (h - dy) * 0.5 + dy);
- c.lineTo(w, h);
- c.lineTo(w - dx - 2 * dy, h);
- c.lineTo(w - dx - 2 * dy, h - dy);
- c.lineTo(dx2, h - dy);
- c.lineTo(0, (h - dy) * 0.5);
- c.close();
- c.stroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicBannerSingleFold.prototype.cst.BANNER_SINGLE_FOLD, mxShapeInfographicBannerSingleFold);
- Graph.handleFactory[mxShapeInfographicBannerSingleFold.prototype.cst.BANNER_SINGLE_FOLD] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dy);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width, bounds.x + bounds.width - pt.x))) / 100;
- this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, pt.y - bounds.y))) / 100;
- })];
-
- var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
- {
- var dy = Math.max(0, Math.min(bounds.height / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var notch = Math.max(0, Math.min(dx, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
- return new mxPoint(bounds.x + bounds.width - notch, bounds.y + dy + (bounds.height - dy) * 0.5);
- }, function(bounds, pt)
- {
- this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.width, (bounds.width + bounds.x - pt.x)))) / 100;
- });
-
- handles.push(handle2);
- var handle3 = Graph.createHandle(state, ['dx2'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- var dx2 = Math.max(0, Math.min(bounds.width - dx, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
- return new mxPoint(bounds.x + dx2, bounds.y + (bounds.height - dy) * 0.5);
- }, function(bounds, pt)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
-
- this.state.style['dx2'] = Math.round(100 * Math.max(0, Math.min(bounds.width - dx - 2 * dy, pt.x - bounds.x))) / 100;
- });
-
- handles.push(handle3);
-
- return handles;
- };
- mxShapeInfographicBannerSingleFold.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var notch = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
- dx = Math.min(w - 2 * dy, dx);
- var dx2 = Math.max(0, Math.min(w - dx - 2 * dy, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
- notch = Math.min(dx, notch);
- var w2 = w - dx - dx2;
-
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.25, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.5, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.75, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx * 0.25, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx * 0.5, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx * 0.75, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - notch, (h + dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx - 2 * dy, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - (dx + 2 * dy) * 0.75, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - (dx + 2 * dy) * 0.5, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - (dx + 2 * dy) * 0.25, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.25, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.5, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.75, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2, h - dy));
-
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Shaded Cube
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicShadedCube(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.isoAngle = 15;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicShadedCube, mxActor);
- mxShapeInfographicShadedCube.prototype.cst = {SHADED_CUBE : 'mxgraph.infographic.shadedCube'};
- mxShapeInfographicShadedCube.prototype.customProperties = [
- {name:'isoAngle', dispName: 'Perspective', type:'float', defVal:15, min:0}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicShadedCube.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var isoAngle = Math.max(0.01, Math.min(94, parseFloat(mxUtils.getValue(this.style, 'isoAngle', this.isoAngle)))) * Math.PI / 200 ;
- var isoH = Math.min(w * Math.tan(isoAngle), h * 0.5);
-
- c.begin();
- c.moveTo(w * 0.5, 0);
- c.lineTo(w, isoH);
- c.lineTo(w, h - isoH);
- c.lineTo(w * 0.5, h);
- c.lineTo(0, h - isoH);
- c.lineTo(0, isoH);
- c.close();
- c.fillAndStroke();
- c.setShadow(false);
- c.setFillAlpha('0.2');
- c.setFillColor('#000000');
-
- c.begin();
- c.moveTo(w * 0.5, 2 * isoH);
- c.lineTo(w, isoH);
- c.lineTo(w, h - isoH);
- c.lineTo(w * 0.5, h);
- c.close();
- c.fill();
- c.setFillColor('#ffffff');
- c.begin();
- c.moveTo(w * 0.5, 2 * isoH);
- c.lineTo(0, isoH);
- c.lineTo(0, h - isoH);
- c.lineTo(w * 0.5, h);
- c.close();
- c.fill();
- };
- mxCellRenderer.registerShape(mxShapeInfographicShadedCube.prototype.cst.SHADED_CUBE, mxShapeInfographicShadedCube);
- Graph.handleFactory[mxShapeInfographicShadedCube.prototype.cst.SHADED_CUBE] = function(state)
- {
- var handles = [Graph.createHandle(state, ['isoAngle'], function(bounds)
- {
- var isoAngle = Math.max(0.01, Math.min(94, parseFloat(mxUtils.getValue(this.state.style, 'isoAngle', this.isoAngle)))) * Math.PI / 200 ;
- var isoH = Math.min(bounds.width * Math.tan(isoAngle), bounds.height * 0.5);
- return new mxPoint(bounds.x, bounds.y + isoH);
- }, function(bounds, pt)
- {
- this.state.style['isoAngle'] = Math.round(100 * Math.max(0, Math.min(100, pt.y - bounds.y))) / 100;
- })];
-
- return handles;
- };
- mxShapeInfographicShadedCube.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var isoAngle = Math.max(0.01, Math.min(94, parseFloat(mxUtils.getValue(this.style, 'isoAngle', this.isoAngle)))) * Math.PI / 200 ;
- var isoH = Math.min(w * Math.tan(isoAngle), h * 0.5);
-
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75, isoH * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, isoH));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, isoH + (h - 2 * isoH) * 0.25));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, isoH + (h - 2 * isoH) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, isoH + (h - 2 * isoH) * 0.75));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - isoH));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75, h - isoH * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25, h - isoH * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - isoH));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - isoH));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, isoH + (h - 2 * isoH) * 0.75));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, isoH + (h - 2 * isoH) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, isoH + (h - 2 * isoH) * 0.25));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, isoH));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25, isoH * 0.5));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Partial Concentric Ellipse
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicPartConcEllipse(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.startAngle = 0.25;
- this.endAngle = 0.75;
- this.arcWidth = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicPartConcEllipse, mxActor);
- mxShapeInfographicPartConcEllipse.prototype.cst = {PART_CONC_ELLIPSE : 'mxgraph.infographic.partConcEllipse'};
- mxShapeInfographicPartConcEllipse.prototype.customProperties = [
- {name:'startAngle', dispName:'Start Angle', min:0, max:1, defVal: 0.25},
- {name:'endAngle', dispName:'End Angle', min:0, max:1, defVal: 0.1},
- {name:'arcWidth', dispName:'Arc Width', min:0, max:1, defVal: 0.5}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicPartConcEllipse.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'startAngle', this.startAngle))));
- var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'endAngle', this.endAngle))));
- var arcWidth = 1 - Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'arcWidth', this.arcWidth))));
- var rx = w * 0.5;
- var ry = h * 0.5;
- var rx2 = rx * arcWidth;
- var ry2 = ry * arcWidth;
-
- var angDiff = endAngle - startAngle;
-
- if (angDiff < 0)
- {
- angDiff = angDiff + Math.PI * 2;
- }
- else if (angDiff == Math.PI)
- {
- endAngle = endAngle + 0.00001;
- }
-
- var startX = rx + Math.sin(startAngle) * rx;
- var startY = ry - Math.cos(startAngle) * ry;
- var innerStartX = rx + Math.sin(startAngle) * rx2;
- var innerStartY = ry - Math.cos(startAngle) * ry2;
- var endX = rx + Math.sin(endAngle) * rx;
- var endY = ry - Math.cos(endAngle) * ry;
- var innerEndX = rx + Math.sin(endAngle) * rx2;
- var innerEndY = ry - Math.cos(endAngle) * ry2;
-
- var bigArc = 0;
-
- if (angDiff <= Math.PI)
- {
- bigArc = 1;
- }
-
- c.begin();
- c.moveTo(rx, 0);
- c.arcTo(rx, ry, 0, 0, 1, w, ry);
- c.arcTo(rx, ry, 0, 0, 1, rx, h);
- c.arcTo(rx, ry, 0, 0, 1, 0, ry);
- c.arcTo(rx, ry, 0, 0, 1, rx, 0);
- c.close();
- c.moveTo(rx, h * 0.5 - ry2);
- c.arcTo(rx2, ry2, 0, 0, 0, w * 0.5 - rx2, ry);
- c.arcTo(rx2, ry2, 0, 0, 0, rx, h * 0.5 + ry2);
- c.arcTo(rx2, ry2, 0, 0, 0, w * 0.5 + rx2, ry);
- c.arcTo(rx2, ry2, 0, 0, 0, rx, h * 0.5 - ry2);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
- c.setFillAlpha('0.2');
- c.setFillColor('#ffffff');
-
- c.begin();
- c.moveTo(startX, startY);
- c.arcTo(rx, ry, 0, bigArc, 0, endX, endY);
- c.lineTo(innerEndX, innerEndY);
- c.arcTo(rx2, ry2, 0, bigArc, 1, innerStartX, innerStartY);
- c.close();
- c.fill();
-
- var rx = w * 0.5;
- var ry = h * 0.5;
- var rx2 = rx * arcWidth;
- var ry2 = ry * arcWidth;
- var rx3 = rx2 + (rx - rx2) * 0.25;
- var ry3 = ry2 + (ry - ry2) * 0.25;
- c.setFillColor('#000000');
-
- c.begin();
- c.moveTo(rx, h * 0.5 - ry2);
- c.arcTo(rx2, ry2, 0, 0, 1, w * 0.5 + rx2, ry);
- c.arcTo(rx2, ry2, 0, 0, 1, rx, h * 0.5 + ry2);
- c.arcTo(rx2, ry2, 0, 0, 1, w * 0.5 - rx2, ry);
- c.arcTo(rx2, ry2, 0, 0, 1, rx, h * 0.5 - ry2);
- c.close();
- c.moveTo(rx, h * 0.5 - ry3);
- c.arcTo(rx3, ry3, 0, 0, 0, w * 0.5 - rx3, ry);
- c.arcTo(rx3, ry3, 0, 0, 0, rx, h * 0.5 + ry3);
- c.arcTo(rx3, ry3, 0, 0, 0, w * 0.5 + rx3, ry);
- c.arcTo(rx3, ry3, 0, 0, 0, rx, h * 0.5 - ry3);
- c.close();
- c.fill();
- };
- mxCellRenderer.registerShape(mxShapeInfographicPartConcEllipse.prototype.cst.PART_CONC_ELLIPSE, mxShapeInfographicPartConcEllipse);
- Graph.handleFactory[mxShapeInfographicPartConcEllipse.prototype.cst.PART_CONC_ELLIPSE] = function(state)
- {
- var handles = [Graph.createHandle(state, ['startAngle'], function(bounds)
- {
- var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'startAngle', this.startAngle))));
- return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(startAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(startAngle) * bounds.height * 0.5);
- }, function(bounds, pt)
- {
- var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
- var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
-
- var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;
-
- if (res < 0)
- {
- res = 1 + res;
- }
- this.state.style['startAngle'] = res;
-
- })];
- var handle2 = Graph.createHandle(state, ['endAngle'], function(bounds)
- {
- var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'endAngle', this.endAngle))));
- return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(endAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(endAngle) * bounds.height * 0.5);
- }, function(bounds, pt)
- {
- var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
- var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
-
- var res = 0.5 * Math.atan2(handleX, handleY) / Math.PI;
-
- if (res < 0)
- {
- res = 1 + res;
- }
-
- this.state.style['endAngle'] = res;
- });
-
- handles.push(handle2);
-
- var handle3 = Graph.createHandle(state, ['arcWidth'], function(bounds)
- {
- var arcWidth = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'arcWidth', this.arcWidth))));
- return new mxPoint(bounds.x + bounds.width / 2, bounds.y + arcWidth * bounds.height * 0.5);
- }, function(bounds, pt)
- {
- this.state.style['arcWidth'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, (pt.y - bounds.y) / (bounds.height * 0.5)))) / 100;
- });
-
- handles.push(handle3);
-
- return handles;
- };
- mxShapeInfographicPartConcEllipse.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
-
- constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.145), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.145), false));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.855), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.855), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Banner Half Fold
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicBannerHalfFold(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 0.5;
- this.dx2 = 0.5;
- this.notch = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicBannerHalfFold, mxActor);
- mxShapeInfographicBannerHalfFold.prototype.cst = {BANNER_HALF_FOLD : 'mxgraph.infographic.bannerHalfFold'};
- mxShapeInfographicBannerHalfFold.prototype.customProperties = [
- {name:'dx', dispName:'Banner Width', min:0, defVal: 40},
- {name:'dx2', dispName:'Spike Size', min:0, defVal: 20},
- {name:'notch', dispName:'Notch Size', min:0, defVal: 15}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicBannerHalfFold.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dx2 = Math.max(0, Math.min(w - dx, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
- var notch = Math.max(0, Math.min(h - dx, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
- c.begin();
- c.moveTo(dx2, 0);
- c.lineTo(w - dx, 0);
- c.lineTo(w, dx);
- c.lineTo(w, h);
- c.lineTo(w - dx * 0.5, h - notch);
- c.lineTo(w - dx, h);
- c.lineTo(w - dx, dx);
- c.lineTo(dx2, dx);
- c.lineTo(0, dx * 0.5);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
- c.setFillAlpha('0.2');
- c.setFillColor('#000000');
- c.begin();
- c.moveTo(w - dx, dx);
- c.lineTo(w, dx);
- c.lineTo(w, h);
- c.lineTo(w - dx * 0.5, h - notch);
- c.lineTo(w - dx, h);
- c.lineTo(w - dx, dx);
- c.lineTo(0, dx);
- c.close();
- c.fill();
-
- c.begin();
- c.moveTo(dx2, 0);
- c.lineTo(w - dx, 0);
- c.lineTo(w, dx);
- c.lineTo(w, h);
- c.lineTo(w - dx * 0.5, h - notch);
- c.lineTo(w - dx, h);
- c.lineTo(w - dx, dx);
- c.lineTo(dx2, dx);
- c.lineTo(0, dx * 0.5);
- c.close();
- c.stroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicBannerHalfFold.prototype.cst.BANNER_HALF_FOLD, mxShapeInfographicBannerHalfFold);
- Graph.handleFactory[mxShapeInfographicBannerHalfFold.prototype.cst.BANNER_HALF_FOLD] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- return new mxPoint(bounds.x + bounds.width - dx, bounds.y + dx);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width, bounds.x + bounds.width - pt.x))) / 100;
- })];
-
- var handle2 = Graph.createHandle(state, ['notch'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var notch = Math.max(0, Math.min(bounds.height - dx, parseFloat(mxUtils.getValue(this.state.style, 'notch', this.notch))));
- return new mxPoint(bounds.x + bounds.width - dx * 0.5, bounds.y + bounds.height - notch);
- }, function(bounds, pt)
- {
- this.state.style['notch'] = Math.round(100 * Math.max(0, Math.min(bounds.height, (bounds.height + bounds.y - pt.y)))) / 100;
- });
-
- handles.push(handle2);
-
- var handle3 = Graph.createHandle(state, ['dx2'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var dx2 = Math.max(0, Math.min(bounds.width - dx, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
- return new mxPoint(bounds.x + dx2, bounds.y + dx);
- }, function(bounds, pt)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
-
- this.state.style['dx2'] = Math.round(100 * Math.max(0, Math.min(bounds.width - dx, pt.x - bounds.x))) / 100;
- });
-
- handles.push(handle3);
-
- return handles;
- };
- mxShapeInfographicBannerHalfFold.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dx2 = Math.max(0, Math.min(w - dx, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
- var notch = Math.max(0, Math.min(h - dx, parseFloat(mxUtils.getValue(this.style, 'notch', this.notch))));
- var w2 = w - dx - dx2;
- var h2 = h - dx;
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dx * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.25, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.5, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.75, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx * 0.5, dx * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dx));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dx + h2 * 0.25));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dx + h2 * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dx + h2 * 0.75));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx * 0.5, h - notch));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, dx + h2 * 0.75));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, dx + h2 * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, dx + h2 * 0.25));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, dx));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.25, dx));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.5, dx));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 + w2 * 0.75, dx));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, dx));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Circular Dial
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicCircularDial(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dy = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicCircularDial, mxActor);
- mxShapeInfographicCircularDial.prototype.cst = {CIRCULAR_DIAL : 'mxgraph.infographic.circularDial'};
- mxShapeInfographicCircularDial.prototype.customProperties = [
- {name:'dy', dispName:'Hole Size', min:0, defVal: 15}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicCircularDial.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dy = Math.max(0, Math.min(h * 0.5 - 10, w * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
-
- var rx = Math.max(0, Math.min(w * 0.5, h * 0.5 - 10));
- var rx2 = rx - dy;
-
- c.begin();
- c.moveTo(w * 0.5 - rx, h);
- c.lineTo(w * 0.5 - rx, rx);
- c.arcTo(rx, rx, 0, 0, 1, w * 0.5, 0);
- c.arcTo(rx, rx, 0, 0, 1, w * 0.5 + rx, rx);
- c.lineTo(w * 0.5 + rx, h);
- c.close();
- c.moveTo(w * 0.5, dy);
- c.arcTo(rx2, rx2, 0, 0, 0, w * 0.5 - rx2, rx);
- c.arcTo(rx2, rx2, 0, 0, 0, w * 0.5, rx + rx2);
- c.arcTo(rx2, rx2, 0, 0, 0, w * 0.5 + rx2, rx);
- c.arcTo(rx2, rx2, 0, 0, 0, w * 0.5, dy);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
- c.setFillAlpha('0.2');
- c.setFillColor('#000000');
- c.begin();
- c.moveTo(w * 0.5 - rx, 2 * rx);
- c.lineTo(w * 0.5 + rx, 2 * rx);
- c.lineTo(w * 0.5 + rx, h);
- c.lineTo(w * 0.5 - rx, h);
- c.close();
- c.fill();
- };
- mxCellRenderer.registerShape(mxShapeInfographicCircularDial.prototype.cst.CIRCULAR_DIAL, mxShapeInfographicCircularDial);
- Graph.handleFactory[mxShapeInfographicCircularDial.prototype.cst.CIRCULAR_DIAL] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dy'], function(bounds)
- {
- var dy = Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + bounds.width * 0.5, bounds.y + dy);
- }, function(bounds, pt)
- {
- this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.y - bounds.y))) / 100;
- })];
-
- return handles;
- };
- mxShapeInfographicCircularDial.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dy = Math.max(0, Math.min(h * 0.5 - 10, w * 0.5, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var rx = Math.max(0, Math.min(w * 0.5, h * 0.5 - 10));
- var rx2 = rx - dy;
-
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - rx, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - rx, (rx + h) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - rx, rx));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - rx * 0.71, rx * 0.29));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + rx * 0.71, rx * 0.29));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + rx, rx));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + rx, (rx + h) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + rx, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 + rx * 0.5, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5 - rx * 0.5, h));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Simple ribbon
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicRibbonSimple(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.notch1 = 0.5;
- this.notch2 = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicRibbonSimple, mxActor);
- mxShapeInfographicRibbonSimple.prototype.cst = {RIBBON_SIMPLE : 'mxgraph.infographic.ribbonSimple'};
- mxShapeInfographicRibbonSimple.prototype.customProperties = [
- {name:'notch1', dispName:'Notch Size', min:0, defVal: 20},
- {name:'notch2', dispName:'Spike Size', min:0, defVal: 20}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicRibbonSimple.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var notch1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch1', this.notch2))));
- var notch2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch2', this.notch2))));
- c.begin();
- c.moveTo(0, h);
- c.lineTo(notch1, h * 0.5);
- c.lineTo(0, 0);
- c.lineTo(w - notch2, 0);
- c.lineTo(w, h * 0.5);
- c.lineTo(w - notch2, h);
- c.close();
- c.fillAndStroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicRibbonSimple.prototype.cst.RIBBON_SIMPLE, mxShapeInfographicRibbonSimple);
- Graph.handleFactory[mxShapeInfographicRibbonSimple.prototype.cst.RIBBON_SIMPLE] = function(state)
- {
- var handles = [Graph.createHandle(state, ['notch1'], function(bounds)
- {
- var notch1 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch1', this.notch1))));
- return new mxPoint(bounds.x + notch1, bounds.y + bounds.height * 0.5);
- }, function(bounds, pt)
- {
- this.state.style['notch1'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
- })];
- var handle2 = Graph.createHandle(state, ['notch2'], function(bounds)
- {
- var notch2 = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'notch2', this.notch2))));
- return new mxPoint(bounds.x + bounds.width - notch2, bounds.y);
- }, function(bounds, pt)
- {
- this.state.style['notch2'] = Math.round(100 * Math.max(0, Math.min(bounds.width, (bounds.width + bounds.x - pt.x)))) / 100;
- });
-
- handles.push(handle2);
- return handles;
- };
- mxShapeInfographicRibbonSimple.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var notch1 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch1', this.notch2))));
- var notch2 = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'notch2', this.notch2))));
- var w2 = w - notch2;
-
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w2 * 0.25, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w2 * 0.5, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w2 * 0.75, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w2, 0));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w2, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w2 * 0.75, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w2 * 0.5, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w2 * 0.25, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, notch1, h * 0.5));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Bar with callout
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicBarCallout(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 0.5;
- this.dy = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicBarCallout, mxActor);
- mxShapeInfographicBarCallout.prototype.cst = {BAR_CALLOUT : 'mxgraph.infographic.barCallout'};
- mxShapeInfographicBarCallout.prototype.customProperties = [
- {name:'dx', dispName:'Callout Position', min:0, defVal: 100},
- {name:'dy', dispName:'Callout Size', min:0, defVal: 30}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicBarCallout.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var x1 = Math.max(dx - dy * 0.35, 0);
- var x2 = Math.min(dx + dy * 0.35, w);
-
- c.begin();
- c.moveTo(0, 0);
- c.lineTo(w, 0);
- c.lineTo(w, h - dy);
- c.lineTo(x2, h - dy);
- c.lineTo(dx, h);
- c.lineTo(x1, h - dy);
- c.lineTo(0, h - dy);
- c.close();
- c.fillAndStroke();
- };
- mxCellRenderer.registerShape(mxShapeInfographicBarCallout.prototype.cst.BAR_CALLOUT, mxShapeInfographicBarCallout);
- mxShapeInfographicBarCallout.prototype.constraints = null;
- Graph.handleFactory[mxShapeInfographicBarCallout.prototype.cst.BAR_CALLOUT] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + dx, bounds.y + bounds.height - dy);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
- this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height, bounds.y + bounds.height - pt.y))) / 100;
- })];
-
- return handles;
- };
- mxShapeInfographicBarCallout.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- var x1 = Math.max(dx - dy * 0.35, 0);
- var x2 = Math.min(dx + dy * 0.35, w);
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false, null, 0, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false, null, 0, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy));
- return (constr);
- };
- //**********************************************************************************************************************************************************
- //Flag
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeInfographicFlag(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 0.5;
- this.dy = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeInfographicFlag, mxActor);
- mxShapeInfographicFlag.prototype.cst = {FLAG : 'mxgraph.infographic.flag'};
- mxShapeInfographicFlag.prototype.customProperties = [
- {name:'dx', dispName:'Pole Width', min:0, defVal: 30},
- {name:'dy', dispName:'Spike Size', min:0, defVal: 20}
- ];
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeInfographicFlag.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- c.begin();
- c.moveTo(0, 0);
- c.lineTo(w, 0);
- c.lineTo(w, h - dy);
- c.lineTo(dx, h - dy);
- c.lineTo(dx * 0.5, h);
- c.lineTo(0, h - dy);
- c.close();
- c.fillAndStroke();
-
- c.setShadow(false);
- c.setFillAlpha('0.2');
- c.setFillColor('#ffffff');
- c.begin();
- c.moveTo(0, 0);
- c.lineTo(dx, 0);
- c.lineTo(dx, h - dy);
- c.lineTo(dx * 0.5, h);
- c.lineTo(0, h - dy);
- c.close();
- c.fill();
- };
- mxCellRenderer.registerShape(mxShapeInfographicFlag.prototype.cst.FLAG, mxShapeInfographicFlag);
- Graph.handleFactory[mxShapeInfographicFlag.prototype.cst.FLAG] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + dx, bounds.y + bounds.height - dy);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
- this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height, bounds.y + bounds.height - pt.y))) / 100;
- })];
-
- return handles;
- };
- mxShapeInfographicFlag.prototype.getConstraints = function(style, w, h)
- {
- var constr = [];
- var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dy) * 0.5));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25, h - dy));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx * 0.5, h));
- constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx * 0.5, 0));
- return (constr);
- };
|