Struggling with data representation

Greetings,

I am currently facing a challenge in representing a series of data with apex charts.

The issue arises during data reading, as measurements are taken every 15 minutes, but only one data submission per hour occurs, encompassing all 4 measurements.
In the graph, the 4 points corresponding to these measurements overlap, as the x-axis used as a reference is the entry date into the platform.

1st column: automatic thinger.io timestamp
2nd column: date of the measurement
3rd column: utc date of the measurement
4rd column: timestamp/moment of measurement

In order to address this issue, I have considered the possibility of using a dual axis.

However, I have doubts about how to implement this or if it’s feasible.
How could this second axis be incorporated into the data series?
I haven’t found information in the Apex Charts documentation on “series: series,” (shown in line 2)

var options = {
    series: series,
    chart: {
        type: 'area',
        dropShadow: {
          enabled: true,
          top: 0,
          left: 0,
          blur: 3,
          opacity: 0.2
        }
    },
    dataLabels: {
        enabled: false
    },
    stroke: {
        curve: 'smooth'
    },
    xaxis: {
        type: 'datetime',
        labels: {
            datetimeUTC: false
        },
        tooltip: {
            enabled: false
        }
    },
    yaxis: {
        "labels": {
            "formatter": function (val) {
                return val.toFixed(2);
            }
        }
    },
    tooltip: {
        x: {
            format: 'dd/MM/yyyy HH:mm:ss'
        }
    }
};

I have tried various approaches following the Apex documentation, but so far, I have not been successful.

I appreciate any guidance or suggestions on how to tackle this problem.

Thank you in advance!

Hi,
The devices may set the timestamp, check the following post →

On the other hand the recommendation is to send always the whole dataset, it is not a good practice to send 3 values each 15 mins and 4 each hour, this may cause unwanted behaviour.

Hi @ega,

Thank you for the rapid response.
I have no other choice than getting those values once an hour. I’m only receiving them from an external API and integrating them into thinger.io.

I have tried what @alvarolb said in the repplied post:

A Unix Timestamp is just a way to describe a point in time. Thinger.io use them to store the date/time of any given bucket entry. It is used always as an UTC time, so, we can later convert it to different timezones in the representation (i.e. dashboards). In the buckets section, what you see is a conversion from this timestamp to a ISO String representation, which is much more user-friendly.

So, what thinger does in any data being written to the bucket, is to check if it contains the ts key. It it is present, then, it does nothing and insert the provided timestamp (it must be unix timestamp in milliseconds). If the value is not present, then, it injects the current timestamp taken from the server.

Hope it helps!

So, I changed the timestamp key to ts. And tried sending the data again to the bucket. As result:

Sadly, both Apex charts and Time series still representing the data using the server timestamp and no from the ts key. As shown:

Hi there,

Is there something I’m not taking into account, or could it be a bug?

Hi @SRG

I believe you are sending the timestamp field as a string instead of a number:

{
  "ts": "1702908621842"
}

Instead of:

{
  "ts": 1702908621842
}

Only with this last example will the data bucket receive your desired timestamp for the data point

1 Like

Hi there,

As you said, the problem was the ts key format, it was a string.

Always the little details…

Thanks for the quick reply and help! @jaimebs @ega