-
Notifications
You must be signed in to change notification settings - Fork 258
Expand file tree
/
Copy pathdata.ts
More file actions
1106 lines (963 loc) · 28.6 KB
/
data.ts
File metadata and controls
1106 lines (963 loc) · 28.6 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
import { Moment } from "moment";
export enum SearchType {
Tag,
Frontmatter,
FrontmatterExists,
FrontmatterList, // new :)
Wiki,
WikiLink,
WikiDisplay,
Text,
dvField,
Table,
FileMeta,
Task,
TaskDone,
TaskNotDone,
}
export enum GraphType {
Line,
Bar,
Pie,
Radar,
Summary,
Table,
Month,
Heatmap,
Bullet,
Unknown,
}
export enum ValueType {
Number,
Int,
Date,
Time,
DateTime,
String,
}
export enum ThresholdType {
GreaterThan = "greaterthan",
LessThan = "lessthan"
}
export type TextValueMap = {
[key: string]: number;
};
export class DataPoint {
date: Moment;
value: number;
constructor(date: Moment, value: number) {
this.date = date;
this.value = value;
}
}
export class Query {
private type: SearchType | null;
private target: string;
private parentTarget: string | null;
private separator: string; // multiple value separator
private id: number;
private accessor: number;
private accessor1: number;
private accessor2: number;
private numTargets: number;
valueType: ValueType;
usedAsXDataset: boolean;
constructor(id: number, searchType: SearchType, searchTarget: string) {
this.type = searchType;
this.target = searchTarget;
this.separator = ""; // separator to separate multiple values
this.id = id;
this.accessor = -1;
this.accessor1 = -1;
this.accessor2 = -1;
this.valueType = ValueType.Number;
this.usedAsXDataset = false;
this.numTargets = 0;
if (searchType === SearchType.Table) {
// searchTarget --> {{filePath}}[{{table}}][{{column}}]
let strRegex =
"\\[(?<accessor>[0-9]+)\\]\\[(?<accessor1>[0-9]+)\\](\\[(?<accessor2>[0-9]+)\\])?";
let regex = new RegExp(strRegex, "gm");
let match;
while ((match = regex.exec(searchTarget))) {
if (typeof match.groups.accessor !== "undefined") {
let accessor = parseFloat(match.groups.accessor);
if (Number.isNumber(accessor)) {
if (typeof match.groups.accessor1 !== "undefined") {
let accessor1 = parseFloat(match.groups.accessor1);
if (Number.isNumber(accessor1)) {
let accessor2;
if (
typeof match.groups.accessor2 !==
"undefined"
) {
accessor2 = parseFloat(
match.groups.accessor2
);
}
this.accessor = accessor;
this.accessor1 = accessor1;
if (Number.isNumber(accessor2)) {
this.accessor2 = accessor2;
}
this.parentTarget = searchTarget.replace(
regex,
""
);
}
break;
}
}
}
}
} else {
let strRegex = "\\[(?<accessor>[0-9]+)\\]";
let regex = new RegExp(strRegex, "gm");
let match;
while ((match = regex.exec(searchTarget))) {
if (typeof match.groups.accessor !== "undefined") {
let accessor = parseFloat(match.groups.accessor);
if (Number.isNumber(accessor)) {
this.accessor = accessor;
this.parentTarget = searchTarget.replace(regex, "");
}
break;
}
}
}
}
public equalTo(other: Query): boolean {
if (this.type === other.type && this.target === other.target) {
return true;
}
return false;
}
public getType() {
return this.type;
}
public getTarget() {
return this.target;
}
public getParentTarget() {
return this.parentTarget;
}
public getId() {
return this.id;
}
public getAccessor(index = 0) {
switch (index) {
case 0:
return this.accessor;
case 1:
return this.accessor1;
case 2:
return this.accessor2;
}
return null;
}
public setSeparator(sep: string) {
this.separator = sep;
}
public getSeparator(isForFrontmatterTags: boolean = false) {
if (this.separator === "") {
if (isForFrontmatterTags) {
return ",";
}
return "/";
}
return this.separator;
}
public addNumTargets(num: number = 1) {
this.numTargets = this.numTargets + num;
}
public getNumTargets() {
return this.numTargets;
}
}
export interface QueryValuePair {
query: Query;
value: number;
}
export class Dataset implements IterableIterator<DataPoint> {
// Array of DataPoints
private name: string;
private query: Query;
private values: number[];
private parent: Datasets;
private id: number;
private yMin: number;
private yMax: number;
private startDate: Moment;
private endDate: Moment;
private numTargets: number;
private lineInfo: LineInfo;
private barInfo: BarInfo;
private isTmpDataset: boolean;
valueType: ValueType;
private currentIndex = 0; // IterableIterator
constructor(parent: Datasets, query: Query) {
this.name = "untitled";
this.query = query;
this.values = [];
this.parent = parent;
this.id = -1;
this.yMin = null;
this.yMax = null;
this.startDate = null;
this.endDate = null;
this.numTargets = 0;
this.lineInfo = null;
this.barInfo = null;
this.isTmpDataset = false;
this.valueType = query?.valueType;
for (let ind = 0; ind < parent.getDates().length; ind++) {
this.values.push(null);
}
}
public cloneToTmpDataset() {
if (!this.isTmpDataset) {
let tmpDataset = new Dataset(this.parent, null);
tmpDataset.name = "tmp";
tmpDataset.values = [...this.values];
tmpDataset.yMin = this.yMin;
tmpDataset.yMax = this.yMax;
tmpDataset.startDate = this.startDate.clone();
tmpDataset.endDate = this.endDate.clone();
tmpDataset.numTargets = this.numTargets;
tmpDataset.isTmpDataset = true;
tmpDataset.valueType = this.valueType;
return tmpDataset;
}
return this; // already tmp dataset
}
public getName() {
return this.name;
}
public setName(name: string) {
this.name = name;
}
public getId() {
return this.id;
}
public setId(id: number) {
this.id = id;
}
public addNumTargets(num: number) {
this.numTargets = this.numTargets + num;
}
public getNumTargets() {
return this.numTargets;
}
public getValue(date: Moment, dayShift: number = 0) {
let ind = this.parent.getIndexOfDate(date) + Math.floor(dayShift);
if (ind >= 0 && ind < this.values.length) {
return this.values[ind];
}
return null;
}
public setValue(date: Moment, value: number) {
let ind = this.parent.getIndexOfDate(date);
// console.log(ind);
if (ind >= 0 && ind < this.values.length) {
// Set value
this.values[ind] = value;
// Update yMin and yMax
if (this.yMin === null || value < this.yMin) {
this.yMin = value;
}
if (this.yMax === null || value > this.yMax) {
this.yMax = value;
}
// Update startDate and endDate
if (this.startDate === null || date < this.startDate) {
this.startDate = date.clone();
}
if (this.endDate === null || date > this.endDate) {
this.endDate = date.clone();
}
}
}
public recalculateMinMax() {
this.yMin = Math.min(...this.values);
this.yMax = Math.max(...this.values);
}
public getYMin() {
return this.yMin;
}
public getYMax() {
return this.yMax;
}
public getStartDate() {
return this.startDate;
}
public getEndDate() {
return this.endDate;
}
public shift(shiftAmount: number, doLargerthan: number) {
let anyShifted = false;
for (let ind = 0; ind < this.values.length; ind++) {
if (this.values[ind] !== null) {
if (doLargerthan === null) {
this.values[ind] = this.values[ind] + shiftAmount;
anyShifted = true;
} else {
if (this.values[ind] >= doLargerthan) {
this.values[ind] = this.values[ind] + shiftAmount;
anyShifted = true;
}
}
}
}
if (anyShifted) {
this.yMin = this.yMin + shiftAmount;
this.yMax = this.yMax + shiftAmount;
}
}
public setPenalty(penalty: number) {
for (let ind = 0; ind < this.values.length; ind++) {
if (this.values[ind] === null) {
this.values[ind] = penalty;
if (penalty < this.yMin) {
this.yMin = penalty;
}
if (penalty > this.yMax) {
this.yMax = penalty;
}
}
}
}
public getQuery(): Query {
return this.query;
}
public accumulateValues() {
let accumValue = 0.0;
for (let ind = 0; ind < this.values.length; ind++) {
if (this.values[ind] !== null) {
accumValue += this.values[ind];
}
this.values[ind] = accumValue;
if (accumValue < this.yMin) {
this.yMin = accumValue;
}
if (accumValue > this.yMax) {
this.yMax = accumValue;
}
}
}
public shiftByDataset(shiftDataset: Dataset) {
// Assume all datasets are of the same length
for (let ind = 0; ind < this.values.length; ind++) {
let currentValue = this.values[ind];
if (shiftDataset.values[ind] !== null && currentValue !== null) {
currentValue += shiftDataset.values[ind];
} else if (shiftDataset.values[ind] !== null) {
currentValue = shiftDataset.values[ind];
}
this.values[ind] = currentValue;
if (currentValue < this.yMin) {
this.yMin = currentValue;
}
if (currentValue > this.yMax) {
this.yMax = currentValue;
}
}
}
public getValues() {
return this.values;
}
public getLength() {
return this.values.length;
}
public getLengthNotNull() {
let countNotNull = 0;
for (let ind = 0; ind < this.values.length; ind++) {
if (this.values[ind] !== null) {
countNotNull++;
}
}
return countNotNull;
}
next(): IteratorResult<DataPoint> {
if (this.currentIndex < this.values.length) {
let ind = this.currentIndex++;
let dataPoint = new DataPoint(
this.parent.getDates()[ind],
this.values[ind]
);
return {
done: false,
value: dataPoint,
};
} else {
this.currentIndex = 0;
return {
done: true,
value: null,
};
}
}
[Symbol.iterator](): IterableIterator<DataPoint> {
return this;
}
}
export class Datasets implements IterableIterator<Dataset> {
// Iterable of Dataset
private dates: Moment[];
private datasets: Dataset[];
private currentIndex = 0; // IterableIterator
constructor(startDate: Moment, endDate: Moment) {
this.dates = [];
this.datasets = [];
let cData = startDate.creationData();
// console.log(cData);
const dateFormat = cData.format.toString();
for (
let curDate = startDate.clone();
curDate <= endDate;
curDate.add(1, "days")
) {
let newDate = window.moment(
curDate.format(dateFormat),
dateFormat,
true
);
this.dates.push(newDate);
}
// console.log(this.dates);
}
public createDataset(query: Query, renderInfo: RenderInfo) {
let dataset = new Dataset(this, query);
dataset.setId(query.getId());
if (renderInfo) {
dataset.setName(renderInfo.datasetName[query.getId()]);
}
this.datasets.push(dataset);
return dataset;
}
public getIndexOfDate(date: Moment) {
let cData = date.creationData();
const dateFormat = cData.format.toString();
for (let ind = 0; ind < this.dates.length; ind++) {
if (
this.dates[ind].format(dateFormat) === date.format(dateFormat)
) {
return ind;
}
}
return -1;
}
public getDatasetByQuery(query: Query) {
for (let dataset of this.datasets) {
if (dataset.getQuery().equalTo(query)) {
return dataset;
}
}
return null;
}
public getDatasetById(id: number) {
for (let dataset of this.datasets) {
if (dataset.getId() === id) {
return dataset;
}
}
return null;
}
public getXDatasetIds() {
let ids: Array<number> = [];
for (let dataset of this.datasets) {
if (dataset.getQuery().usedAsXDataset) {
let id = dataset.getQuery().getId();
if (!ids.includes(id) && id !== -1) {
ids.push(id);
}
}
}
return ids;
}
public getDates() {
return this.dates;
}
public getNames() {
let names = [];
for (let dataset of this.datasets) {
names.push(dataset.getName());
}
return names;
}
next(): IteratorResult<Dataset> {
if (this.currentIndex < this.datasets.length) {
return {
done: false,
value: this.datasets[this.currentIndex++],
};
} else {
this.currentIndex = 0;
return {
done: true,
value: null,
};
}
}
[Symbol.iterator](): IterableIterator<Dataset> {
return this;
}
}
export class RenderInfo {
// Input
queries: Query[];
xDataset: number[];
folder: string;
file: string[];
specifiedFilesOnly: boolean;
fileContainsLinkedFiles: string[];
fileMultiplierAfterLink: string;
dateFormat: string;
dateFormatPrefix: string;
dateFormatSuffix: string;
startDate: Moment | null;
endDate: Moment | null;
datasetName: string[];
constValue: number[];
ignoreAttachedValue: boolean[];
ignoreZeroValue: boolean[];
accum: boolean[];
stack: boolean;
penalty: number[];
valueShift: number[];
shiftOnlyValueLargerThan: number[];
valueType: string[]; // number/float, int, string, boolean, date, time, datetime
textValueMap: TextValueMap;
dataAreaSize: Size;
margin: Margin;
fixedScale: number;
fitPanelWidth: boolean;
aspectRatio: AspectRatio;
output: any[];
line: LineInfo[];
bar: BarInfo[];
pie: PieInfo[];
summary: SummaryInfo[];
month: MonthInfo[];
heatmap: HeatmapInfo[];
bullet: BulletInfo[];
customDataset: CustomDatasetInfo[];
public datasets: Datasets | null;
constructor(queries: Query[]) {
this.queries = queries;
this.xDataset = []; // use file name
this.folder = "/";
this.file = []; // extra files to use
this.specifiedFilesOnly = false; // if true, use files specified only
this.fileContainsLinkedFiles = [];
this.fileMultiplierAfterLink = ""; // regex pattern to extract multiplier after link
this.dateFormat = "YYYY-MM-DD";
this.dateFormatPrefix = "";
this.dateFormatSuffix = "";
this.startDate = null;
this.endDate = null;
this.datasetName = []; // untitled
this.constValue = [1.0];
this.ignoreAttachedValue = []; // false
this.ignoreZeroValue = []; // false
this.accum = []; // false, accum values start from zero over days
this.stack = false;
this.penalty = []; // null, use this value instead of null value
this.valueShift = [];
this.shiftOnlyValueLargerThan = [];
this.valueType = [];
this.textValueMap = {};
this.dataAreaSize = new Size(300, 300);
this.aspectRatio = new AspectRatio(1, 1);
this.margin = new Margin(10, 10, 10, 10); // top, right, bottom, left
this.fixedScale = 1.0;
this.fitPanelWidth = false;
this.output = [];
this.line = [];
this.bar = [];
this.pie = [];
this.summary = [];
this.month = [];
this.heatmap = [];
this.bullet = [];
this.customDataset = [];
this.datasets = null;
}
public getQueryById(id: number) {
for (let query of this.queries) {
if (query.getId() === id) {
return query;
}
}
}
}
export class CustomDatasetInfo {
id: number;
name: string;
xData: string[];
yData: string[];
constructor() {
this.id = -1;
this.name = "";
this.xData = [];
this.yData = [];
}
}
export interface IGraph {
GetGraphType(): GraphType;
}
export interface ILegend {
showLegend: boolean;
legendPosition: string;
legendOrientation: string;
legendBgColor: string;
legendBorderColor: string;
}
export class CommonChartInfo implements IGraph, ILegend {
title: string;
xAxisLabel: string;
xAxisColor: string;
xAxisLabelColor: string;
yAxisLabel: string[];
yAxisColor: string[];
yAxisLabelColor: string[];
yAxisUnit: string[];
xAxisTickInterval: string;
yAxisTickInterval: string[];
xAxisTickLabelFormat: string;
yAxisTickLabelFormat: string[];
yMin: number[];
yMax: number[];
reverseYAxis: boolean[];
allowInspectData: boolean;
// ILegend
showLegend: boolean;
legendPosition: string;
legendOrientation: string;
legendBgColor: string;
legendBorderColor: string;
constructor() {
this.title = "";
this.xAxisLabel = "Date";
this.xAxisColor = "";
this.xAxisLabelColor = "";
this.yAxisLabel = []; // "Value", 2 elements
this.yAxisColor = []; // "", 2 elements
this.yAxisLabelColor = []; // "", 2 elements
this.yAxisUnit = []; // "", 2 elements
this.xAxisTickInterval = null; // the string will be converted to Duration (a month is not nesscesary to 30 days)
this.yAxisTickInterval = []; // null, 2 elements
this.xAxisTickLabelFormat = null;
this.yAxisTickLabelFormat = []; // null, 2 elements
this.yMin = []; // null, 2 elements
this.yMax = []; // null, 2 elements
this.reverseYAxis = []; // false, 2 elements
this.allowInspectData = true;
// ILegend
this.showLegend = false;
this.legendPosition = ""; // top, bottom, left, right
this.legendOrientation = ""; // horizontal, vertical
this.legendBgColor = "";
this.legendBorderColor = "";
}
public GetGraphType() {
return GraphType.Unknown;
}
}
export class LineInfo extends CommonChartInfo {
lineColor: string[];
lineWidth: number[];
showLine: boolean[];
showPoint: boolean[];
pointColor: string[];
pointBorderColor: string[];
pointBorderWidth: number[];
pointSize: number[];
fillGap: boolean[];
yAxisLocation: string[];
constructor() {
super();
this.lineColor = []; // ""
this.lineWidth = []; // 1.5
this.showLine = []; // true
this.showPoint = []; // true
this.pointColor = []; // #69b3a2
this.pointBorderColor = [];
this.pointBorderWidth = []; // 0.0
this.pointSize = []; // 3.0
this.fillGap = []; // false
this.yAxisLocation = []; // left, for each target
}
public GetGraphType() {
return GraphType.Line;
}
}
export class BarInfo extends CommonChartInfo {
barColor: string[];
yAxisLocation: string[];
xAxisPadding: string;
constructor() {
super();
this.barColor = []; // #69b3a2
this.yAxisLocation = []; // left, for each target
this.xAxisPadding = null; // the string will be converted to Duration (a month is not nesscesary to 30 days)
}
public GetGraphType() {
return GraphType.Bar;
}
}
export class PieInfo implements IGraph, ILegend {
title: string;
data: string[];
dataColor: string[];
dataName: string[];
label: string[];
hideLabelLessThan: number;
showExtLabelOnlyIfNoLabel: boolean;
extLabel: string[];
ratioInnerRadius: number;
// ILegend
showLegend: boolean;
legendPosition: string;
legendOrientation: string;
legendBgColor: string;
legendBorderColor: string;
constructor() {
this.title = "";
this.data = [];
this.dataColor = [];
this.dataName = [];
this.label = [];
this.hideLabelLessThan = 0.03;
this.extLabel = [];
this.showExtLabelOnlyIfNoLabel = false;
this.ratioInnerRadius = 0.0;
// ILegend
this.showLegend = false;
this.legendPosition = ""; // top, bottom, left, right
this.legendOrientation = ""; // horizontal, vertical
this.legendBgColor = "";
this.legendBorderColor = "";
}
public GetGraphType() {
return GraphType.Pie;
}
}
export class SummaryInfo implements IGraph {
template: string;
style: string;
constructor() {
this.template = "";
this.style = "";
}
public GetGraphType() {
return GraphType.Summary;
}
}
export class MonthInfo implements IGraph {
mode: string;
dataset: number[];
startWeekOn: string;
threshold: number[];
thresholdType: string[];
yMin: number[];
yMax: number[];
color: string;
dimNotInMonth: boolean;
initMonth: string; // YYYY-MM
showSelectedValue: boolean;
// header
headerYearColor: string;
headerMonthColor: string;
dividingLineColor: string;
// circles and rings
showCircle: boolean;
showStreak: boolean;
showTodayRing: boolean;
showSelectedRing: boolean;
circleColor: string;
circleColorByValue: boolean;
circleColorByStreak: boolean;
todayRingColor: string;
selectedRingColor: string;
// annotations
showAnnotation: boolean;
annotation: string[];
showAnnotationOfAllTargets: boolean;
// internal
selectedDate: string;
selectedDataset: number;
constructor() {
this.mode = "circle"; // circle, annotation
this.dataset = [];
this.startWeekOn = "Sun";
this.threshold = []; // if value > threshold, will show dot
this.thresholdType = [];
this.yMin = [];
this.yMax = [];
this.color = null;
this.dimNotInMonth = true;
this.initMonth = "";
this.showSelectedValue = true;
// header
this.headerYearColor = null;
this.headerMonthColor = null;
this.dividingLineColor = null;
// circles and rings
this.showCircle = true;
this.showStreak = true; // a streak connects neigbor dots
this.showTodayRing = true;
this.showSelectedRing = true;
this.circleColor = null;
this.circleColorByValue = false;
this.circleColorByStreak = false;
this.todayRingColor = ""; // white
this.selectedRingColor = "firebrick";
// annotations
this.showAnnotation = true;
this.annotation = []; // annotation for each dataset, accept expression thus value
this.showAnnotationOfAllTargets = true;
// internal
this.selectedDate = ""; // selected date
this.selectedDataset = null; // selected index of dataset
}
public GetGraphType() {
return GraphType.Month;
}
}
export class HeatmapInfo implements IGraph {
dataset: string;
startWeekOn: string;
orientation: string;
yMin: number;
yMax: number;
color: string;
constructor() {
this.dataset = "0";
this.startWeekOn = "Sun";
this.orientation = "vertical";
this.yMin = null;
this.yMax = null;
this.color = null;
}
public GetGraphType() {
return GraphType.Heatmap;
}
}
export class BulletInfo implements IGraph {
title: string;
dataset: string;
orientation: string;
value: string;
valueUnit: string;
valueColor: string;
range: number[];
rangeColor: string[];
showMarker: boolean;
markerValue: number;
markerColor: string;
constructor() {
this.title = "";
this.dataset = "0"; // dataset id or name
this.orientation = "horizontal"; // or vertical
this.value = ""; // Can possess template varialbe
this.valueUnit = "";
this.valueColor = "#69b3a2";
this.range = [];
this.rangeColor = [];
this.showMarker = false;
this.markerValue = 0;
this.markerColor = "";
}
public GetGraphType() {
return GraphType.Bullet;
}