Following this thread, I’m gonna explain the problem and the solutions I’ve tried so far without any success.
First, the problem:
In workshop when using a typescript function (3 Dimensional Aggregation: IRange, string, Double) to be used in the widget Chart X/Y, we have a difference between the native view and the one using the typescript function:
We have the visualisation shifted by 2 hours which is the difference between the UTC and my timezone.
The attempted solutions:
First I tried to replace the IRange by a string output (string, string, Double) but the results was disappointing:
Then the second option was to put only timestamp in the 3 dimensional output but the output isn’t fitted: “Type ‘Timestamp’ does not satisfy the constraint ‘BucketKey’.”
Now the code: I can’t put everything here but here is what I have:
sortedBuckets.forEach(sortedBucket => {
const mappedValues = sortedBucket.value.map(item => ({
key: facilityIdToName.get(item.key) || item.key, // Map skywiseFacilityId to name
value: item.value
}));
output.push({ key: sortedBucket.key, value: mappedValues });
}
my sortedBuckets is the result of an aggregation:
const sortedBuckets = obj.groupBy(o => o.timestamp.byMonth()).segmentBy(o => o.skywiseFacilityId.topValues()).sum(o => o.value);
From my perspective I think the problem is coming from the IRange or how the workshop is reading it since for the timestamp in typescript we have:
(alias) class Timestamp
import Timestamp
Type representing an instant in time. Can be used as an input or output for a TypeScript function. Offset is always UTC+00:00 for inputs and object properties.
If you have anything else I can try, I’m open to it