121
Views
3
Comments
Column Chart DateTimeLabelFormat in HighChartsJSON
Question
Application Type
Reactive

Hey!

I have a column chart in which each column is a stacked bar by day. I was trying to format my xaxis labels (which come in as a date in the form of YYYY-MM-DD) and have it be presented as '%e. %b' or "Jun. 15" for example.


The Highcharts API says that this is the default value for date time formatting, but it shows up as the YYYY-MM-DD format on my column chart. 


So, I added a xAxisJSON

And the values are still in the YYYY-MM-DD format. Any suggestions?

Thanks,

Ethan Stone


UserImage.jpg
Ethan Stone

Just some more information. Without any JSON formatting at all, my line chart shows up in that format "Jun. 15".


So just for science, I added an identical JSON but added %m at the end of my formatting.


And it worked exactly as expected. 

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

Hi Ethan,

Interesting, I suspect that maybe the logic in OS wrapper around the higcharts library might be getting in your way, or something.

I'll try and replicate

Dorine

PS : Just a tip in general for higcharts problems : try to accomplish the same in a JSFiddle for comparison and/or troubleshooting.  That way, at least you know you are trying to apply the right configuration or not.

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

euhm,

so my suspicion is that either highcharts itself, or OS Charts, treats labels of a column chart as categories by default, not as datetime.  

But, I'm now stuck trying to make a demo oml demonstrating this, seems I can't even recreate your succes at changing the label format of the line chart.  I'm giving up, seems I'm doing same thing like you, but no result.   See attached oml, he is clearly picking up my configuration of chart and axis title, but not the label format.

There are often changes to the charts library, and not always for the better, so maybe reason is difference in charts version between my and your environment, don't know...

Dorine

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