forked from seisiuneer/abctools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualscript-sdk.js
More file actions
3008 lines (2645 loc) · 77.4 KB
/
Copy pathvisualscript-sdk.js
File metadata and controls
3008 lines (2645 loc) · 77.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//Copyright (c) ©1994-2023 SmartDraw, LLC. All rights reserved.
//This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
//VisualScript SDK 2.0 Classes
///////////////////// Defines ////////////////////
VS = {};
VS.Version = 20;
VS.DefaultMaxShapes = 200;
VS.ShapeConnectorTypes =
{
Flowchart: "Flowchart",
DecisionTree: "Decisiontree",
Mindmap: "Mindmap",
OrgChart: "Orgchart",
Hierarchy: "Hierarchy",
};
VS.ShapeContainerArrangement =
{
Row: "Row",
Column: "Column",
Matrix: "Square",
Kanban: "Kanban",
Sparse: "Sparse",
Kanban_Row: "Kanban_Row",
Sparse_Row: "Sparse_Row",
};
VS.ShapeContainerAllowedTypes =
{
All: 0,
AllowOnlyContainers: 1,
AllowOnlyNonContainers: 2,
};
VS.ShapeTypes =
{
Rectangle:"Rect",
RoundedRectangle: "RRect",
Oval: "Oval",
Circle: "Circle",
Square: "Square",
Diamond: "Diamond",
};
VS.DataColumnTypes =
{
Text: "string",
Int: "int",
Float: "float",
Bool: "bool",
Date: "date",
Header: "header",
JSON: "json",
};
VS.TextAlignH =
{
Left: "left",
Right: "right",
Center: "center",
};
VS.TextAlignV =
{
Top: "top",
Bottom: "bottom",
Middle: "middle",
};
VS.TextGrow = {
Proportional:"Proportional",
Horizontal: "Horizontal",
Vertical: "Vertical",
};
VS.LabelPosition =
{
Above: "above",
Below: "below",
Inside: "inside",
};
VS.LinePatterns =
{
Solid: "Solid",
Dotted: "Dotted",
Dashed: "Dashed",
};
VS.Arrowheads =
{
None: 0,
Filled: 1,
LineArrow: 2,
Fancy: 3,
FilledCircle: 4,
EmptyCircle: 5,
FilledSquare: 6,
EmptySquare: 7,
CrowsFoot: 8,
BackSlash: 9,
FilledCrowsFoot: 10,
Diamond: 11,
ZeroToMany: 12,
OneToMany: 13,
ZeroToOne: 14,
OneToOne: 15,
OneToZero: 16,
CenterFilled: 17,
CenterLineArrow: 18,
CenterFancy: 19,
Double: 20,
DimensionFilled: 21,
DimensionPlain: 22,
DimensionLine: 23,
Metafile: 24,
ArcDown: 25,
ArcUp: 26,
HalfUp: 27,
HalfDown: 28,
CenterCross: 29,
HalfLineUp: 30,
HalfLineDown: 31,
ForwardSlash: 32,
OpenFilled: 33,
OpenCrowsFoot: 34,
OpenDiamond: 35,
Cross: 36,
IndicatorDown: 37,
IndicatorUp: 38,
RoundEnd: 39
};
VS.NoteIcons =
{
Note: "Note",
Info: "Info",
};
VS.ReturnLineTypes =
{
Standard: "Standard",
Curved: "Curved",
Straight: "Straight",
};
VS.Directions =
{
Left: "Left",
Right: "Right",
Top: "Top",
Bottom: "Bottom",
Up: "Up",
Down:"Down",
};
VS.CellFlags =
{
IconPhotoCell: 1
};
VS.ConnectorArrangement =
{
Row: "Row",
Stagger: "Stagger",
Column: "Column",
LeftColumn: "LeftColumn",
TwoColumn: "TwoColumn",
};
VS.Templates =
{
Mindmap:"Mindmap",
Flowchart:"Flowchart",
Orgchart:"Orgchart",
Hierarchy:"Hierarchy",
Decisiontree:"Decisiontree",
Gantt:"Gantt",
DatabaseERD:"DatabaseERD",
Classdiagram:"Classdiagram",
Sitemap:"Sitemap",
Timeline: "Timeline",
AWS: "AWS",
Azure: "Azure",
LineDrawUML: "LineDrawUML",
WhiteBoarding: "WhiteBoarding",
PIBoard: "PIBoard",
ProductRoadmap: "ProductRoadmap",
EpicDependencies: "EpicDependencies",
BlockingIssue: "BlockingIssue",
};
VS.GanttChartHolidays =
{
None: "None",
USA: "USA",
UK: "UK",
Australia: "Australia",
Canada: "Canada",
};
VS.GanttChartColumnNames =
{
Row: "Row",
Task: "Task",
Start: "Start",
StartTime: "StartTime",
Length: "Length",
End: "End",
EndTime: "EndTime",
Parent: "Parent",
Master: "Master",
Person: "Person",
PercentComplete: "PercentComplete",
Department: "Department",
Cost: "Cost",
Custom: "Custom",
DateGrid:"DateGrid",
};
VS.Timeline_Arrangements =
{
Row1: "Row-1",
Grid1: "Grid-1",
GridBlock1: "Grid-Block1",
GridSwimlane1: "Grid-Swimlane1",
};
VS.TimelineUnits =
{
HundredYear: 100, // 100 years in days
FiftyYear: 50, // 50 years in days
TenYear: 10, // Ten years in days
FiveYear: 5, // Five years in days
TwoYear: 2, // Two years in days
Year: 365, // One year in days
Quarter: 92, // one quarter
Month: 31, // one month
Week: 7, // one week
Day: 1, // one day
TwelveHour: -12, // 12 hours
SixHour: -6, // six hours
FourHour: -4, // four hours
TwoHour: -2, // two hours
Hour: -1, // hour
};
VS.Timeline_EventTypes =
{
Bubble: "Bubble",
BubbleVertical: "Bubble-Vertical",
BubbleTextOnly: "TextOnly",
GridBullet: "Grid-Bullet",
GridBar: "Grid-Bar",
GridBlock: "Grid-Block",
GridSwimlane: "Grid-Swimlane",
};
VS.Timeline_BubbleEventPositions =
{
Above: "above",
AboveCenter: "above-center",
Below: "below",
BelowCenter: "below-center",
Alternate: "alternate",
AlternateCenter: "alternate-center",
};
VS.Timeline_RowTypes =
{
EventRow: "event-row",
LabelRow: "label-row",
};
VS.Timeline_RowIndexes =
{
Year: "year",
Date: "date",
Event: "event",
};
VS.Gauge_Types =
{
RadialDetail: "RadialGauge",
RadialDetailTop: "RadialGaugeTop",
RadialSimpleTop: "RadialSimpleTop",
RadialSimpleLeft: "RadialSimpleLeft",
RadialSimpleBottom: "RadialSimpleBottom",
RadialSimpleRight: "RadialSimpleRight",
RadialSimpleFull: "RadialSimpleFull",
RadialRangeTop: "RadialRangeTop",
RadialRangeLeft: "RadialRangeLeft",
RadialRangeBottom: "RadialRangeBottom",
RadialRangeRight: "RadialRangeRight",
RadialRangeFull: "RadialRangeFull",
LinearDetailHorizontal: "LinearGauge",
LinearDetailRampHorizontal: "LinearDetailRampHorizontal",
LinearSimpleHorizontal: "LinearSimpleHorizontal",
LinearSimpleRampHorizontal: "LinearSimpleRampHorizontal",
LinearRangeHorizontal: "LinearRangeHorizontal",
LinearRangeRampHorizontal: "LinearRangeRampHorizontal",
LinearDetailVertical: "LinearGaugeVertical",
LinearDetailRampVertical: "LinearDetailRampVertical",
LinearSimpleVertical: "LinearSimpleVertical",
LinearSimpleRampVertical: "LinearSimpleRampVertical",
LinearRangeVertical: "LinearRangeVertical",
LinearRangeRampVertical: "LinearRangeRampVertical",
};
VS.RadialGauge_Properties =
{
Min: "min",
Max:"max",
Val: "val",
MinAngle: "minAngle",
MaxAngle: "maxAngle",
MinTickMax: "minTickMax",
MajTickMax: "majTickMax",
MinTickLen: "minTickLen",
MajTickLen: "majTickLen",
MinTickColor: "minTickColor",
MajTickColor: "majTickColor",
UnitLabel: "unitLabel",
NoUnits: "noUnits",
CenterColor: "centerColor",
CenterRadius: "centerRadius",
IndicatorColor: "indicatorColor",
PartialArcType: "partialArcType",
HollowCenter: "hollowCenter",
RangeIndicators: "rangeIndicators",
FilledRange: "filledRange",
TickLabelFreq: "tickLabelFreq",
LabelFontSize: "labelFontSize",
UnitFontSize: "unitFontSize",
Radius: "radius",
};
VS.LinearGauge_Properties =
{
Min: "min",
Max: "max",
Val: "val",
BarWidth: "barWidth",
Orientation: "orientation",
MinTickMax: "minTickMax",
MajTickMax: "majTickMax",
MinTickLen: "minTickLen",
MajTickLen: "majTickLen",
MinTickColor: "minTickColor",
MajTickColor: "majTickColor",
IndicatorColor: "indicatorColor",
IndicatorType: "indicatorType",
RangeIndicators: "rangeIndicators",
IndicatorType: "indicatorType",
RangeWidthScale: "rangeWidthScale",
TickLabelFreq: "tickLabelFreq",
TickLocation: "tickLocation",
LabelLocation: "labelLocation",
LabelFontSize: "labelFontSize",
UnitFontSize: "unitFontSize",
UnitLabel: "unitLabel",
UnitPosition: "unitPosition",
NoUnits: "noUnits",
};
VS.Graph_Types =
{
LineChart: "LineChart",
AreaChart: "AreaChart",
PieChart: "PieChart",
DonutChart: "Donut",
BarChart: "BarChart",
BarChartStacked: "BarChartStacked",
BarChartHorizontal: "BarChartHorizontal",
BarChartStackedHorizontal: "BarChartStackedHorizontal",
SankeyChart: "SankeyChart",
SankeyChartColored: "SankeyChartColored",
SankeyChartLeft: "SankeyChartLeft",
SankeyChartRight: "SankeyChartRight",
};
VS.LineChart_Properties =
{
GraphAreaWidth:"graphAreaWidth", //width of the core graph area(minus axis, legend and title)
GraphAreaHeight:"graphAreaHeight", //height of the core graph area(minus axis, legend and title)
LegendPos: "legendPos", //data set legend positioning
LegendShape: "legendShape", //legend color shape (round or square)
UnitLabel:"unitLabel", //y axis units label that is displayed at the top of the y axis
TickLen:"tickLen", //axis tick lengths
TickWidth:"tickWidth", //line thickness of the ticks
GraphLineWidth:"graphLineWidth", //line thickness of the graph data lines
YTickCount:"yTickCount", //# of ticks on the y axis
YMinZero:"yMinZero", //if true, sets the min value of the yAxis to 0, otherwise, min value is computed from the data
YRuleLines:"yRuleLines", //if true, displays ruling lines behind the graph, aligned with the y axis ticks
YAxisHide:"yAxisHide", //if true, hides the main(vertical) part of the y axis(ticks and tick labels will still be shown unless yTickCount = 0)
XAxisStep: "xAxisStep", //the step count for the x axis labels(and ticks).Defaults to 1, meaning no labels are skipped.Note: the step will be increased if there is not enough room for the x axis labels.
XLabelBehavior: "xLabelBehavior", //x-axis label behavior: 'wrap', 'vertical', 'none'
XLabelMaxLen: "xLabelMaxLen", //max # chars for x-axis label. If exceeds max length, text will be truncated and ellipsed
YFormatter:"yFormatter", //D3-based format string for the yAxis labels(see https://github.com/d3/d3-format for full documentation. Default is "s")
DataSetColors:"dataSetColors", //comma - separated list of colors that define the data set colors
LabelFontSize:"labelFontSize", //font size of the axis, unit and legend text
Title: "title", //title text
TitlePos:"titlePos", //title position
TitleColor:"titleColor", //title text color(defaults to textColor)
TitleFontSize: "titleFontSize", //title font size
DisplayType: "displayType", //"line" or "area"
};
VS.PieChart_Properties =
{
ChartRadius: "chartRadius", //radius of the core pie graph area (minus labels, legend and title)
InnerRadius: "innerRadius", //inner radius of the pie chart (a non-zero value creates a donut-type pie chart)
LegendPos: "legendPos", //data set legend positioning
DisplayDivider: "displayDivider", //If true, display a divider between pie wedges.
DataSetColors: "dataSetColors", //comma-separated list of colors that define the data set colors
LabelFontSize: "labelFontSize", //font size of the axis, unit and legend text
LabelColor:"labelColor", //color of data labels when displayed outside of chart area as callouts(defaults to textColor)
AltLabelColor: "altLabelColor", //color of data labels when displayed inside of chart area(defaults to labelColor)
DataSetColors: "dataSetColors", //comma - separated list of colors that define the data set colors
LabelPos: "labelPos", //location of data labels
LabelFormat: "labelFormat", //defines how the data labels are displayed
ShowDataLabels: "showDataLabels", //Boolean.If true, prepend data title to the data.
LabelLineLength:"labelLineLength", //length of data callout lines when displayed as outside.
Title: "title", //title text
TitlePos: "titlePos", //title position
TitleColor: "titleColor", //title text color(defaults to textColor)
TitleFontSize: "titleFontSize", //title font size
};
VS.BarChart_Properties =
{
GraphAreaWidth: "graphAreaWidth", //width of the core graph area(minus axis, legend and title)
GraphAreaHeight: "graphAreaHeight", //height of the core graph area(minus axis, legend and title)
LegendPos: "legendPos", //data set legend positioning
LegendShape: "legendShape", //legend color shape (round or square)
UnitLabel: "unitLabel", //y axis units label that is displayed at the top of the y axis
TickLen: "tickLen", //axis tick lengths
TickWidth: "tickWidth", //line thickness of the ticks
YTickCount: "yTickCount", //# of ticks on the y axis
YMinZero: "yMinZero", //if true, sets the min value of the yAxis to 0, otherwise, min value is computed from the data
YRuleLines: "yRuleLines", //if true, displays ruling lines behind the graph, aligned with the y axis ticks
YAxisHide: "yAxisHide", //if true, hides the main(vertical) part of the y axis(ticks and tick labels will still be shown unless yTickCount = 0)
XAxisStep: "xAxisStep", //the step count for the x axis labels(and ticks).Defaults to 1, meaning no labels are skipped.Note: the step will be increased if there is not enough room for the x axis labels.
XLabelBehavior: "xLabelBehavior", //x-axis label behavior: 'wrap', 'vertical', 'none'
XLabelMaxLen: "xLabelMaxLen", //max # chars for x-axis label. If exceeds max length, text will be truncated and ellipsed
YFormatter: "yFormatter", //D3-based format string for the yAxis labels(see https://github.com/d3/d3-format for full documentation. Default is "s")
DataSetColors: "dataSetColors", //comma - separated list of colors that define the data set colors
LabelFontSize: "labelFontSize", //font size of the axis, unit and legend text
Title: "title", //title text
TitlePos: "titlePos", //title position
TitleColor: "titleColor", //title text color(defaults to textColor)
TitleFontSize: "titleFontSize", //title font size
BarGroupType: "barGroupType", //"group" or "stack"
BarOrient: "barOrient", //"vert" or "horiz"
};
VS.SankeyChart_Properties =
{
GraphAreaWidth: "graphAreaWidth", //width of the core graph area(minus title)
GraphAreaHeight: "graphAreaHeight", //height of the core graph area(minus title)
NodeAlign: "nodeAlign", //chart layout alignment ('left', 'right', 'center', 'justify')
NodeWidth: "nodeWidth", //width of node boxes
NodePadding: "nodePadding", //space between nodes
LabelPadding: "labelPadding", //offset of label from node
LabelFontSize: "labelFontSize", //font size of node label
DefLinkColor: "defLinkColor", //default link color
LinkOpacity: "linkOpacity", //link transparency
UnitLabel: "unitLabel", //unit string to append to values in tooltips
BlendNodeColorsForLinks: "blendNodeColorsForLinks", //if true, creates a gradient between the 2 linked nodes, using the node colors, otherwise uses the DefLinkColor
DataSetColors: "dataSetColors", //comma - separated list of colors that define the data set colors
Title: "title", //title text
TitlePos: "titlePos", //title position
TitleColor: "titleColor", //title text color(defaults to textColor)
TitleFontSize: "titleFontSize", //title font size
};
////////////////// Base Object /////////////////////////
VS.BaseObject = function ()
{
this.Properties = {};
return (this);
};
/**
* @method BaseObject.SetLabel
* @param {string} Label - the text label
*/
VS.BaseObject.prototype.SetLabel = function (Label)
{
this.Properties.Label = Label;
return (this);
};
/**
* @method BaseObject.SetTextTruncate
* @param {int} nchar - number of characters to show
*/
VS.BaseObject.prototype.SetTextTruncate = function (nchar)
{
this.Properties.Truncate = nchar;
return (this);
};
/**
* @method BaseObject.SetTextSize
* @param {string} size - the text size
*/
VS.BaseObject.prototype.SetTextSize = function (size)
{
this.Properties.TextSize = size;
return (this);
};
/**
* @method BaseObject.SetTextFont
* @param {string} font - the text font
*/
VS.BaseObject.prototype.SetTextFont = function (font)
{
this.Properties.TextFont = font;
return (this);
};
/**
* @method BaseObject.SetTextBold
* @param {bool} state - true or false
*/
VS.BaseObject.prototype.SetTextBold = function (state)
{
this.Properties.TextBold = state;
return (this);
};
/**
* @method BaseObject.SetTextItalic
* @param {bool} state - true or false
*/
VS.BaseObject.prototype.SetTextItalic = function (state)
{
this.Properties.TextItalic = state;
return (this);
};
/**
* @method BaseObject.SetTextUnderline
* @param {bool} state - true or false
*/
VS.BaseObject.prototype.SetTextUnderline = function (state)
{
this.Properties.TextUnderline = state;
return (this);
};
/**
* @method BaseObject.SetTextHyperlink
* @param {str} url - the url
*/
VS.BaseObject.prototype.SetTextHyperlink = function (url)
{
this.Properties.TextHyperlink = { url: url };
return (this);
};
/**
* @method BaseObject.SetHyperlink
* @param {str} url - the url
*/
VS.BaseObject.prototype.SetHyperlink = function (url)
{
this.Properties.Hyperlink = { url: url };
return (this);
};
/**
* @method BaseObject.SetImage
* @param {str} url - the url
*/
VS.BaseObject.prototype.SetImage = function (url)
{
this.Properties.Image = { url: url };
return (this);
};
/**
* @method BaseObject.SetTextColor
* @param {str} color - "#NNNNNN"
*/
VS.BaseObject.prototype.SetTextColor = function (color)
{
this.Properties.TextColor = color;
return (this);
};
/**
* @method BaseObject.SetFillColor
* @param {str} color - "#NNNNNN"
*/
VS.BaseObject.prototype.SetFillColor = function (color)
{
this.Properties.FillColor = color;
return (this);
};
/**
* @method BaseObject.SetLineColor
* @param {str} color - "#NNNNNN"
*/
VS.BaseObject.prototype.SetLineColor = function (color)
{
this.Properties.LineColor = color;
return (this);
};
/**
* @method BaseObject.SetLineThickness
* @param {int} thickness - in 1/100
*/
VS.BaseObject.prototype.SetLineThickness = function (thickness)
{
this.Properties.LineThick = thickness;
return (this);
};
/**
* @method BaseObject.SetBorderThickness
* @param {int} thickness - in 1/100
*/
VS.BaseObject.prototype.SetBorderThickness = function (thickness)
{
this.Properties.BorderThick = thickness;
return (this);
};
/**
* @method BaseObject.SetLinePattern
* @param {str) pattern
*/
VS.BaseObject.prototype.SetLinePattern = function (pattern)
{
this.Properties.LinePattern = pattern;
return (this);
};
/**
* @method BaseObject.SetStartArrow
* @param {int) arrowid
*/
VS.BaseObject.prototype.SetStartArrow = function (arrowid)
{
this.Properties.StartArrow = arrowid;
return (this);
};
/**
* @method BaseObject.SetEndArrow
* @param {int) arrowid
*/
VS.BaseObject.prototype.SetEndArrow = function (arrowid)
{
this.Properties.EndArrow = arrowid;
return (this);
};
/**
* @method BaseObject.SetObjectType
* @param {int) objecttype
*/
VS.BaseObject.prototype.SetObjectType = function (objecttype)
{
this.Properties.objecttype = objecttype;
return (this);
};
/**
* @method BaseObject.SetNote- add a note
* @param {str} - note
*/
VS.BaseObject.prototype.SetNote = function (note)
{
this.Properties.Note = note;
return (this);
};
/**
* @method BaseObject.SetNoteIcon- set the icon for a note
* @param {int} - iconid
*/
VS.BaseObject.prototype.SetNoteIcon = function (iconid)
{
this.Properties.NoteIcon = iconid;
return (this);
};
/**
* @method BaseObject.SetTextAlignH- set the horizontal justification
* @param {str} - just - left,right center
*/
VS.BaseObject.prototype.SetTextAlignH = function (just)
{
this.Properties.TextAlignH = just;
return (this);
};
/**
* @method BaseObject.SetTextAlignV- set the vertical justification
* @param {str} - vjust - top,bottom middle
*/
VS.BaseObject.prototype.SetTextAlignV = function (vjust)
{
this.Properties.TextAlignV = vjust;
return (this);
};
/**
* @method BaseObject.ReturnProperties - return an object that is not a function for stringifying
*/
VS.BaseObject.prototype.ReturnProperties = function ()
{
return (this.Properties);
}
/**
* @method BaseObject.AddExpandedView - add an expanded view to a shape or cell
*/
VS.BaseObject.prototype.AddExpandedView = function ()
{
var ExpandedView = new VS.Document();
this.ExpandedView = ExpandedView;
this.Properties.ExpandedView = ExpandedView.Properties;
return (ExpandedView);
}
//////////////////////// Shape /////////////////////////////
/// SDON Shape Object derived from the base object
VS.Shape = function ()
{
var retObj = VS.BaseObject.apply(this);
return (retObj);
};
VS.Shape.prototype = new VS.BaseObject();
VS.Shape.prototype.constructor = VS.Shape;
/**
* @method Shape.SetID- set the id
* @param {int} - ID - id for the shape (for returns)
*/
VS.Shape.prototype.SetID = function (ID)
{
this.Properties.ID = ID;
return (this);
};
/**
* @method Shape.SetShapeType- set the id
* @param {str} - ShapeType - a standard shape type or a custom one
* @param {bool} - Fixed - optional parameter for rrect - used a fixed radius
* @param {int} - CornerSize - optional size of the fixed radius corner in pixels (5-20)
*/
VS.Shape.prototype.SetShapeType = function (ShapeType,Fixed,CornerSize)
{
this.Properties.ShapeType = ShapeType;
if (ShapeType === VS.ShapeTypes.RoundedRectangle)
{
if (Fixed === true)
{
if (CornerSize == null) CornerSize = 5;
if (CornerSize < 5) CornerSize = 5;
if (CornerSize > 20) CornerSize = 20;
this.Properties.RRect_Fixed = Fixed;
this.Properties.RRect_ShapeParam = CornerSize/100;
}
}
return (this);
};
/**
* @method Shape.SetLineLabel- set the id
* @param {str} - Label - the label on a connector attached to a shape
*/
VS.Shape.prototype.SetLineLabel = function (Label)
{
this.Properties.LineLabel = Label;
return (this);
};
/**
* @method Shape.SetTextMargin- set the text margin on a shape
* @param {int} - value - margin in 1/100
*/
VS.Shape.prototype.SetTextMargin = function (value)
{
this.Properties.TextMargin = value;
return (this);
};
/**
* @method Shape.SetTextGrow- set the text margin on a shape
* @param {int} - value - margin in 1/100
*/
VS.Shape.prototype.SetTextGrow = function (value)
{
this.Properties.TextGrow = value;
return (this);
};
/**
* @method Shape.SetTextPosition- set the text position to be above, below or inside the shape
* @param {int} - value - the position
*/
VS.Shape.prototype.SetTextPosition = function (value)
{
switch (value)
{
case VS.LabelPosition.Above:
//this.Properties.TextFlags = SDJS.ListManager.TextFlags.SED_TF_AttachA; // RLM - temp replacement. SDJS.ListManager not defined
this.Properties.TextFlags = 8;
break;
case VS.LabelPosition.Below:
//this.Properties.TextFlags = SDJS.ListManager.TextFlags.SED_TF_AttachA; // RLM - temp replacement. SDJS.ListManager not defined
this.Properties.TextFlags = 4;
break;
default:
this.Properties.TextFlags = 0;
break;
}
return (this);
};
/**
* @method Shape.SetMinWidth- set the min width for a shape
* @param {int} - width
*/
VS.Shape.prototype.SetMinWidth = function (width)
{
this.Properties.MinWidth = width;
return (this);
};
/**
* @method Shape.SetMinHeight- set the min height for a shape
* @param {int} - height
*/
VS.Shape.prototype.SetMinHeight = function (height)
{
this.Properties.MinHeight = height;
return (this);
};
/**
* @method Shape.Hide- set the hide boolean true (for shapecontainers)
*/
VS.Shape.prototype.Hide = function ()
{
this.Properties.Hide = true;
return (this);
};
/**
* @method Shape.SetAttachPoint- set attach point for an icon shape
* @param {int} - x (0- 30000)
* @param {int} - y (0- 30000)
*/
VS.Shape.prototype.SetAttachPoint = function (x,y)
{
if (this.Properties.AttachPoint == null)
{
this.Properties.AttachPoint = {};
}
this.Properties.AttachPoint.x = x;
this.Properties.AttachPoint.y = y;
return (this);
};
/**
* @method Shape.SetConnectPoint- set connect point for an icon shape
* @param {int} - x (0- 30000)
* @param {int} - y (0- 30000)
*/
VS.Shape.prototype.SetConnectPoint = function (x, y)
{
if (this.Properties.Connect == null)
{
this.Properties.Connect = {};
}
this.Properties.Connect.x = x;
this.Properties.Connect.y = y;
return (this);
};
/**
* @method Shape.SetShapeDataRow- set data for a shape from a document level defined table
* @param {int} - TableID - id of the data table
* @param {int} - RowID - id of the row in the data table
*/
VS.Shape.prototype.SetShapeDataRow = function (TableID,RowID)
{
this.Properties.Data = { TableID: TableID, RowID: RowID };
return (this);
};
/**
* @method Shape.AddShapeDataRow- add a data row and assign it to the shape
* @param {VS.Document} - Document - the VS.Document
* @param {int} - TableID - id of the data table
*/
VS.Shape.prototype.AddShapeDataRow = function (Document,TableID)
{
//get the data table
var theDataTable = Document.GetDataTable(TableID);
var theDataRow = theDataTable.AddDataRow();
this.Properties.Data = { TableID: TableID, RowID: theDataRow.Properties.RowID };
return (theDataRow);
};
/**
* @method Shape.AddShapeConnector - add a shape connector and return it
* @param {str} - ShapeConnectorType - the type of shape connector
*/
VS.Shape.prototype.AddShapeConnector = function (ShapeConnectorType)
{
var S = VS.ShapeConnectorTypes;
//only allow a limited number of shape connectors
switch (this.ShapeConnectorType)
{
case S.OrgChart:
case S.Hierarchy:
case S.DecisionTree:
//we already have one
return (this.ShapeConnector[0]);
break;
case S.Mindmap:
if (this.ShapeConnector && this.ShapeConnector.length >= 2)
{
return (this.ShapeConnector[0]);
}
break;
}
switch (ShapeConnectorType)
{
case S.OrgChart:
case S.Hierarchy:
case S.DecisionTree:
case S.Mindmap:
case S.Flowchart:
break;
default:
ShapeConnectorType = S.Hierarchy;
break;
}
var ShapeConnector = new VS.ShapeConnector(ShapeConnectorType);
this.Properties.ShapeConnectorType = ShapeConnectorType;
if (this.Properties.ShapeList === undefined)
{
this.Properties.ShapeList = [];
this.ShapeConnector = [];
}
this.Properties.ShapeList.push(ShapeConnector.Properties);
this.ShapeConnector.push(ShapeConnector);
return (ShapeConnector);
};
/**
* @method Shape.AddShapeContainer - add a shape container and return it
* @param {str} - ContainerArrangement - row, col or matrix
*/
VS.Shape.prototype.AddShapeContainer = function (ContainerArrangement)
{
if (this.ShapeContainer !== undefined) return (this.ShapeContainer);
var ShapeContainer = new VS.ShapeContainer(ContainerArrangement);
this.Properties.ShapeArray = ShapeContainer.Properties;
this.ShapeContainer = ShapeContainer;
return (ShapeContainer);
};
/**
* @method Shape.AddIconShape - add an iconshape and return it
*/
VS.Shape.prototype.AddIconShape = function ()
{
var IconSize = 50;
if (this.Properties.IconShapes === undefined)
{
this.Properties.IconShapes = [];
this.IconShapes = [];