@iotready/nextjs-components-library 1.0.0-preview13 → 1.0.0-preview14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -314,7 +314,6 @@ const TrendChart = ({ deviceId, measures1, measures2, enableDatePicker, handleGe
|
|
314
314
|
pointHoverBackgroundColor: 'rgba(52, 125, 236, 0.5)',
|
315
315
|
change: !measure.polltime,
|
316
316
|
stepped: measure.stepped,
|
317
|
-
fill: false,
|
318
317
|
yAxisID: measure.source === 'measures1' ? 'y1' : 'y2'
|
319
318
|
};
|
320
319
|
});
|
package/package.json
CHANGED
package/server-actions/influx.js
CHANGED
@@ -88,7 +88,13 @@ export async function getInfluxDataV1(influxConfig, field, timeStart, timeEnd, d
|
|
88
88
|
.unix(timeStart)
|
89
89
|
.toISOString()}' AND time <= '${moment
|
90
90
|
.unix(timeEnd)
|
91
|
-
.toISOString()}' GROUP BY time(${timeGroup})
|
91
|
+
.toISOString()}' GROUP BY time(${timeGroup})`;
|
92
|
+
if (fill) {
|
93
|
+
query += ` fill(none)`;
|
94
|
+
}
|
95
|
+
else {
|
96
|
+
query += ` fill(null)`;
|
97
|
+
}
|
92
98
|
}
|
93
99
|
if (fill) {
|
94
100
|
// Query to get the last data point before timeStart
|
@@ -131,21 +137,23 @@ export async function getInfluxDataV1(influxConfig, field, timeStart, timeEnd, d
|
|
131
137
|
series.name = field; // Force the series name to be the field name
|
132
138
|
});
|
133
139
|
// 1000000 REMOVED AND ADDED TO MOVE THE POINT AWAY IN THE CHART
|
134
|
-
if (
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
+
if (fill) {
|
141
|
+
if (preStartValue !== null && preStartValue !== undefined) {
|
142
|
+
// Insert the pre-start value at the beginning of the dataset
|
143
|
+
data.results[0].series[0].values.unshift([
|
144
|
+
timeStart - 1000000,
|
145
|
+
preStartValue
|
146
|
+
]);
|
147
|
+
}
|
148
|
+
// Set the last point as the timeEnd and last value of the dataset
|
149
|
+
const lastSeries = data.results[0].series[0];
|
150
|
+
const lastValue = lastSeries?.values &&
|
151
|
+
lastSeries.values.length > 0 &&
|
152
|
+
lastSeries.values.slice(-1)[0].length > 1
|
153
|
+
? lastSeries.values.slice(-1)[0][1]
|
154
|
+
: null;
|
155
|
+
data.results[0].series[0].values.push([timeEnd + 1000000, lastValue]);
|
140
156
|
}
|
141
|
-
// Set the last point as the timeEnd and last value of the dataset
|
142
|
-
const lastSeries = data.results[0].series[0];
|
143
|
-
const lastValue = lastSeries?.values &&
|
144
|
-
lastSeries.values.length > 0 &&
|
145
|
-
lastSeries.values.slice(-1)[0].length > 1
|
146
|
-
? lastSeries.values.slice(-1)[0][1]
|
147
|
-
: null;
|
148
|
-
data.results[0].series[0].values.push([timeEnd + 1000000, lastValue]);
|
149
157
|
return data;
|
150
158
|
}
|
151
159
|
export async function exportDataV1(influxConfig, field, timeStart, timeEnd, deviceID) {
|