Skip to content

Commit 53b4220

Browse files
committed
re Merge tag 'beta5'
2 parents 17ee212 + 0875881 commit 53b4220

File tree

5 files changed

+131
-102
lines changed

5 files changed

+131
-102
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
</div>
5454
<div id="Footer">
5555
<img alt="LogBoard logo" src="./assets/LogBoardLOGO.svg" height="60%" />
56-
© 2020 copyright. all rights reserved
56+
© 2020 copyright. all rights reserved v0.1.5
5757
{{storageUserId}}
5858
</div>
5959
</div>

src/components/LogChart.vue

Lines changed: 69 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
:chart-data="datacollection"
1818
:options="{responsive: true, maintainAspectRatio: false}"
1919
></line-chart>-->
20-
20+
<!-- {{datacollection}} -->
2121
<line-chart @on-receive="update" :chart-data="datacollection" :options="options"></line-chart>
2222

2323
<!-- <button @click="fillData()">Randomize</button> -->
@@ -36,33 +36,33 @@ var testThumbnailSets = [];
3636
export default {
3737
name: "LogChart",
3838
props: {
39-
msg: String
39+
msg: String,
4040
},
4141
// props: ['dataCollection'],
4242
4343
components: {
44-
LineChart
44+
LineChart,
4545
},
4646
watch: {
47-
storageChartLabels: function() {
47+
storageChartLabels: function () {
4848
console.log("storageChartLabels change", this.storageChartLabels);
4949
this.fillData();
5050
},
51-
storageChartDatasets: function() {
51+
storageChartDatasets: function () {
5252
this.fillData();
5353
console.log("storageChartDatasets change", this.storageChartDatasets);
5454
},
55-
storageThumbnailSets: function() {
55+
storageThumbnailSets: function () {
5656
// this.fillData();
5757
console.log("storageThumbnailSets change", this.storageThumbnailSets);
5858
},
59-
storageIDSets: function() {
59+
storageIDSets: function () {
6060
// this.fillData();
6161
console.log("storageIDSets change", this.storageIDSets);
6262
},
63-
raw_data: function() {
63+
raw_data: function () {
6464
console.log("raw_data change", this.raw_data);
65-
}
65+
},
6666
},
6767
computed: {
6868
storageChartLabels() {
@@ -76,7 +76,7 @@ export default {
7676
},
7777
storageIDSets() {
7878
return this.$store.state.storeDataID;
79-
}
79+
},
8080
// raw_data() {
8181
// return this.raw_data;
8282
// }
@@ -97,7 +97,7 @@ export default {
9797
"#FF03B8",
9898
"#f87979",
9999
"#117979",
100-
"#f1F979"
100+
"#f1F979",
101101
],
102102
message: "PhotoDiary",
103103
options: {
@@ -127,21 +127,21 @@ export default {
127127
// },
128128
point: {
129129
pointStyle: "cross",
130-
radius: 15
130+
radius: 15,
131131
},
132132
133133
scales: {
134134
yAxes: [
135135
{
136136
stacked: false, //折線圖可以配置為 疊放 通過更改y軸上的設置來啟用面積圖。 堆疊式 區域圖可用於顯示一個數據趨勢如何由許多較小的部分組成。
137137
ticks: {
138-
beginAtZero: true
138+
beginAtZero: true,
139139
},
140140
gridLines: {
141141
display: true,
142-
color: "rgba(255,99,132,0.2)"
143-
}
144-
}
142+
color: "rgba(255,99,132,0.2)",
143+
},
144+
},
145145
],
146146
xAxes: [
147147
{
@@ -150,20 +150,20 @@ export default {
150150
// beginAtZero: true,
151151
},
152152
gridLines: {
153-
display: true
154-
}
155-
}
156-
]
153+
display: true,
154+
},
155+
},
156+
],
157157
},
158158
legend: {
159-
display: true
159+
display: true,
160160
},
161161
tooltips: {
162162
enabled: false,
163163
// enabled: true,
164164
mode: "index",
165165
position: "nearest",
166-
custom: customTooltips
166+
custom: customTooltips,
167167
},
168168
169169
// tooltips: {
@@ -204,8 +204,8 @@ export default {
204204
title: {
205205
display: true,
206206
text: "logboard-frontend",
207-
position: "bottom"
208-
}
207+
position: "bottom",
208+
},
209209
// scales: {
210210
// yAxes: [
211211
// {
@@ -224,25 +224,25 @@ export default {
224224
"2020-07-23T00:46:01Z",
225225
"2020-07-23T01:28:41Z",
226226
"2020-07-23T02:33:02Z",
227-
"2020-07-23T03:00:00Z"
227+
"2020-07-23T03:00:00Z",
228228
],
229229
vital_signs: {
230230
SBP: [73.42, 197.19, 175.44, 89.01],
231231
DBP: [95.44, 76.64, 29.55, 60.39],
232232
heartbeat: [180.03, 72.71, 181.61, 74.78],
233233
bloodSugar: [767.96, 276.46, 957.19, 434.79],
234234
weight: [88.41, 20.49, 235.23, 111.76],
235-
urineVolume: [1579.75, 1037.58, 646.84, 275.07]
235+
urineVolume: [1579.75, 1037.58, 646.84, 275.07],
236236
},
237-
symptoms: []
237+
symptoms: [],
238238
},
239239
240240
// myStyles: {
241241
// height: "300px",
242242
// width: "100%",
243243
// position: "relative"
244244
// }
245-
raw_data: []
245+
raw_data: [],
246246
};
247247
},
248248
mounted() {
@@ -263,15 +263,15 @@ export default {
263263
this.$store.commit("ChangDisplayPopUp", {
264264
display: true,
265265
index: array[0]._index,
266-
idList: this.storageIDSets[array[0]._index]
266+
idList: this.storageIDSets[array[0]._index],
267267
});
268268
269269
console.log("我被點了", event, array[0]._index);
270270
this.selectedData = array[0]._index;
271271
this.$emit("on-receive", {
272272
index: item._index,
273273
backgroundColor: item._view.backgroundColor,
274-
value: this.values[item._index]
274+
value: this.values[item._index],
275275
});
276276
} else {
277277
console.log("You selected the background!");
@@ -285,15 +285,15 @@ export default {
285285
this.$store.commit("ChangDisplayPopUp", {
286286
display: true,
287287
index: event[0]._index,
288-
idList: this.storageIDSets[event[0]._index]
288+
idList: this.storageIDSets[event[0]._index],
289289
});
290290
291291
console.log("我被點了", point, event[0]._index);
292292
this.selectedData = event[0]._index;
293293
this.$emit("on-receive", {
294294
index: item._index,
295295
backgroundColor: item._view.backgroundColor,
296-
value: this.values[item._index]
296+
value: this.values[item._index],
297297
});
298298
// this.$store.commit("updateUserId", this.$route.params.id);
299299
}, ////捕捉點擊
@@ -307,9 +307,9 @@ export default {
307307
},
308308
setting(color, data, name) {
309309
let temp = [];
310-
data.map(index => {
310+
data.map((index) => {
311311
if (index == null) {
312-
temp.push("nan");
312+
temp.push(null);
313313
} else {
314314
temp.push(index);
315315
}
@@ -333,7 +333,7 @@ export default {
333333
fill: false,
334334
lineTension: 0,
335335
spanGaps: true,
336-
data: db
336+
data: db,
337337
// label: name,
338338
// // backgroundColor: "#00000000",
339339
// borderColor: "#AF0F0F",
@@ -398,18 +398,37 @@ export default {
398398
// );
399399
},
400400
normalLines(data) {
401+
console.log("normalLines_input", data);
402+
401403
let MAX = Math.max(...data);
402404
let MIN = Math.min(...data);
405+
let output = [];
403406
let r = MAX - MIN;
407+
console.log(
408+
"normalLines_cale",
409+
r,
410+
MAX,
411+
MIN,
412+
Math.max(...data),
413+
Math.min(...data)
414+
);
415+
404416
let t = r / 100;
405-
let output = [];
406417
console.log("normalLines", r, t, output, data.length);
407-
data.map(index => {
408-
if (index == "nan") {
418+
data.map((index) => {
419+
if (index == null) {
409420
output.push("nan");
410421
} else {
422+
if ((r == 0) | (MAX == MIN)) {
423+
output.push(index);
424+
}
411425
let temp = index - MIN;
412426
console.log("normalLines", index, temp, temp / t);
427+
// if (r == 0) {
428+
// output.push(100);
429+
// } else {
430+
// output.push(temp / t);
431+
// }
413432
output.push(temp / t);
414433
}
415434
});
@@ -419,15 +438,15 @@ export default {
419438
fillData() {
420439
(this.datacollection = {
421440
labels: this.storageChartLabels,
422-
datasets: this.setMaker()
441+
datasets: this.setMaker(),
423442
}),
424443
{ responsive: true, maintainAspectRatio: false };
425444
this.$store.commit("ChangisLoading", false);
426445
},
427446
getRandomInt() {
428447
return Math.floor(Math.random() * (50 - 5 + 1)) + 5;
429-
}
430-
}
448+
},
449+
},
431450
// computed: {
432451
// // myStyles() {
433452
// // return {
@@ -440,11 +459,11 @@ export default {
440459
// }
441460
};
442461
443-
var rawData = function(raw) {
462+
var rawData = function (raw) {
444463
return raw;
445464
};
446465
447-
const customTooltips = function(tooltip) {
466+
const customTooltips = function (tooltip) {
448467
// Tooltip Element
449468
let tooltipEl = document.getElementById("chartjs-tooltip");
450469
if (!tooltipEl) {
@@ -491,7 +510,7 @@ const customTooltips = function(tooltip) {
491510
`;
492511
let innerHtml = "<thead>";
493512
let titleID = null; ///預計要取得的ID
494-
titleLines.forEach(function(title) {
513+
titleLines.forEach(function (title) {
495514
titleID = testtorageLabels.indexOf(title); ///取得的ID
496515
innerHtml +=
497516
"<tr><th style='text-align: left; ' >" +
@@ -500,14 +519,13 @@ const customTooltips = function(tooltip) {
500519
// src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"
501520
// alt="Grapefruit slice atop a pile of other slices">` +
502521
// "</th></tr>";
503-
title
504-
+
522+
title +
505523
// "| id:" +
506524
// testIDSets[titleID];
507-
// ` <img class="fit-picture"
508-
// src="img/LogBoardLOGO.56c0f5e3.svg
509-
// alt="bar">` +
510-
("</th></tr>");
525+
// ` <img class="fit-picture"
526+
// src="img/LogBoardLOGO.56c0f5e3.svg
527+
// alt="bar">` +
528+
"</th></tr>";
511529
});
512530
innerHtml +=
513531
"</thead><tbody><tr><td style='text-align: left; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF; '>Symptom</td></tr>";
@@ -516,7 +534,7 @@ const customTooltips = function(tooltip) {
516534
console.log("HTML testRawData", testRawData);
517535
console.log("HTML testRawData", testRawData[0]);
518536
519-
bodyLines.forEach(function(body, i) {
537+
bodyLines.forEach(function (body, i) {
520538
const colors = tooltip.labelColors[i];
521539
let style = "background:" + colors.backgroundColor;
522540
style += "; border-color:" + colors.borderColor;

0 commit comments

Comments
 (0)