Datetime format problems, when aggregating values over timestamp

Hi everyone,

I am aggregating different values by month in my data. Afterwards, I use the aggregated data in a highchart where I encounter some problems with date time formats. However, this only occurs when I filter my data frame on the date before I aggregate - no filter no problem.

Without the filter, the x-Axis looks like this:

With the filter, the x-Axis looks like this:

It only happens when I select a date range within one month. Thus, if I select dates from Nov. 1st 2020 to Dec. 3rd 2020 its fine. If I select dates from Nov. 1st to Nov. 30th I experience the issues.

Does anyone have any experience with this or has an idea how to tackle this?

Thanks in advance :slight_smile:

Is this only happening when there is only one single data point visualized?

If yes, try adding dateTimeLableFormats to your xAxis configuration:

  "dateTimeLabelFormats": {
    "millisecond": "%H:%M:%S.%L",
    "second": "%H:%M:%S",
    "minute": "%H:%M",
    "hour": "%H:%M",
    "day": "%e. %b",
    "week": "%e. %b",
    "month": "%b '%y",
    "year": "%Y"
  },

Since there’s no time interval but only one single instance of time when there’s one value, Highcharts uses the most fine grained format - in this case millisecond. If you always want day to be the most fine grained interval, use %e. %b for all formats smaller than day, too.

Your config of choice in this case would look similar to this:

  "dateTimeLabelFormats": {
    "millisecond": "%e. %b",
    "second": "%e. %b",
    "minute": "%e. %b",
    "hour": "%e. %b",
    "day": "%e. %b",
    "week": "%e. %b",
    "month": "%b '%y",
    "year": "%Y"
  },

Note, that this can get confusing when there has to be a “zoom-in” functionality.

2 Likes

Perfect, that solved the issue! Thanks :slight_smile: