66
Views
11
Comments
Solved
How to get rid of time tick in highcharts when using date?
Application Type
Reactive
Service Studio Version
11.53.12 (Build 61157)
Platform Version
11.18.1 (Build 37828)

We are using the line chart from OutsystemsUI, and we are getting strange behavior when using a date as the label. Below is what it currently looks like: 

I am not sure why the points do not correlate exactly with the date or why 12:00 is being added between the dates. Here is my advanced format json: 

"yAxis: {    softMin: " + 0 + ",    softMax: " + 10 + "},xAxis: {    startOnTick: true,    endOnTick: true},series: [{    name: 'Sleep Length',    marker: {        enabled: true,        symbol: 'circle',        radius: 8    },    color: 'green',    lineWidth: 4,    type: 'line'}, {    name: 'Planned Sleep Length',    marker: {        enabled: true,        symbol: 'circle',        radius: 8    },    color: 'black',    lineWidth: 4,    type: 'line'}]"

Here is my data point list as a json:

[{"Label":"2023-02-28","Value":11,"DataSeriesName":"Sleep Length","Color":"Green"},{"Label":"2023-02-28","Value":0,"DataSeriesName":"Planned Sleep Length","Color":"Black"},{"Label":"2023-03-01","Value":9,"DataSeriesName":"Sleep Length","Color":"Green"},{"Label":"2023-03-01","Value":0,"DataSeriesName":"Planned Sleep Length","Color":"Black"}]
2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

ok,

I can cofirm that adding that tickinterval to your oml yields the desired result for me, so I think any residual problems you have are related to your version of Outsystems UI, i.e. this is an old bug in the charts that has been solved in later versions.

You are on 2.6.7, I'm on 2.14

this is what the only thing I've changed to your OML :

and this is what I see when testing :

Dorine

UserImage.jpg
Matthew Vines
Solution

Along with Kilian's answer of adding "tickInterval: 24 * 3600 * 1000" to the advanced format xAxis which gets rid of the 12:00, it appears the points get shifted in OutSystemsCharts Version 1.3.7. Upon downloading Kilian's oml, I updated the dependencies, and the same issue occurred. Updating components takes days worth of testing, so we will likely ignore the issue until we are ready to update.

2024-11-25 22-05-29
Sergio Aznar Guallar

Hi Matthew,

It is so strange, could you confirm the date variable mapped in the chart is a date type instead of a date time type?


Kind regards,

Sergio


UserImage.jpg
Matthew Vines

Data type being mapped from:

Data type being mapped to:

Mapping process:

UserImage.jpg
Matthew Vines

Quick update: I forgot to mention this earlier, but this issue is in both reactive and mobile. I first noticed it because I was copying UI from our reactive app to our mobile app.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Matthew Vines ,

Can you share an oml ?

Also, i have see some strange chart behaviour in the past around date labels.  As far as I can remember correctly, it was caused in the outsystems component, not in highcharts itself.

Might be worth trying to trick OS chart into thinking it's a text, not a date. (someting like adding a space)  if not as a real solution, to at least confirm that's the problem

Dorine 

UserImage.jpg
Matthew Vines

It still detects the date with a space, but that was a good idea. I will try to play around with more formatting to see if I can trick it. I have attached an oml file.

TestHighchartsLabelBug.oml
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Matthew,

First, to get rid of the "12:00", add this to the AdvancedFormat.XAxisJSON:

"tickInterval: 24 * 3600 * 1000"

This will set a tick interval of 1 day, which is what you want.

Secondly, it seems that for some reason your markers are in between the ticks. I have no idea what causes that, a quick test of my own didn't show that (see attachment).

One last remark: you shouldn't explicitly set the colour of the data points, but instead only on the series. Otherwise, if you change the series colour, the data points will still have the "old" colour.

TestChart.oml
UserImage.jpg
Matthew Vines

I provided an oml file to Dorine above if you would like to view it. Your solution works to get rid of the 12:00. Additionally, if you add startOnTick: true and endOnTick: true on the xAxis format, it shows all the dates in the range, but the line is still offset. The difference between our oml is the use of advanced format yAxis and series, so that is likely the cause. I will give updates if I find the issue.

UserImage.jpg
Matthew Vines

I don't think it gets any simpler than this. I am not sure how you were able to get it working in that screenshot.

2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

ok,

I can cofirm that adding that tickinterval to your oml yields the desired result for me, so I think any residual problems you have are related to your version of Outsystems UI, i.e. this is an old bug in the charts that has been solved in later versions.

You are on 2.6.7, I'm on 2.14

this is what the only thing I've changed to your OML :

and this is what I see when testing :

Dorine

UserImage.jpg
Matthew Vines
Solution

Along with Kilian's answer of adding "tickInterval: 24 * 3600 * 1000" to the advanced format xAxis which gets rid of the 12:00, it appears the points get shifted in OutSystemsCharts Version 1.3.7. Upon downloading Kilian's oml, I updated the dependencies, and the same issue occurred. Updating components takes days worth of testing, so we will likely ignore the issue until we are ready to update.

2023-06-15 18-30-12
FRANK JOHNNY GANGUILHET

Thanks for the post and the solution!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.