相关文章推荐
风流的足球  ·  如何将图像转换为zpl代码,以便使用斑马打印 ...·  1 年前    · 
潇洒的猴子  ·  GitHub热榜登顶:开源代码解释器,可装任 ...·  1 年前    · 
叛逆的警车  ·  WPF ...·  2 年前    · 
坏坏的羽毛球  ·  调用DIV+CSS实现模拟表格对角线-汇编div·  2 年前    · 
大力的围巾  ·  陆奇最新演讲高清PPT下载;AI ...·  2 年前    · 
Code  ›  Highcharts DateTime format on X-axis | OutSystems
https://www.outsystems.com/forums/discussion/72634/highcharts-datetime-format-on-x-axis/
干练的甜瓜
2 年前
  • OutSystems.com
  • My Platform
  • Community
  • Support
OutSystems Logo
    • Guided Paths
    • Build an App
    • Training Planner
    • Courses
    • Developer Schools
    • Boot Camps
    • Certifications
    • Tech Talks
    • Overview
    • ODC
    • O11
  • Forums
  • Forge
    • Jobs
    • Ideas
    • Members
    • User Groups
  • Downloads
Log in
Sign Up
Community
/
Forums
/
Questions
2021-07-06 10-00-38
Bradley Lansink
Rank: #895
190 Views
4 Comments
Solved
Highcharts DateTime format on X-axis
Question
Reactive
Charts
Service Studio
Application Type
Reactive
Service Studio Version
11.11.12 (Build 47321)

Hello everyone,

I've got a question regarding the highcharts implementation in Oustystems.

I am trying to implement a chart using DateTime on the X-axis as seen below.

I would like to format the time so that only the years are shown so: [2017,2018,2019,2020,2021]

The data used look like this:

It seems like highcharts does not like the dateformat of outsystems and it somehow needs to be converted.

Is there any information available about the interaction between highcharts and Outsystems?

Thanks in advance! Let me know if more information is needed

0
0
16 Aug 2021
Copy link to comment
2018-10-29 08-31-03
João Marques
MVP
Rank: #24
Solution

Hi Bradley,


You will need to add formatting to the AdvancedFormat , something like in this post where a similar problem was raised and issued.


You can format the date using the following formats to build the date you need:


Currently these formats are supported:
    * %a: Short weekday, like 'Mon'.
    * %A: Long weekday, like 'Monday'.
    * %d: Two digit day of the month, 01 to 31.
    * %e: Day of the month, 1 through 31.
    * %b: Short month, like 'Jan'.
    * %B: Long month, like 'January'.
    * %m: Two digit month number, 01 through 12.
    * %y: Two digits year, like 09 for 2009.
    * %Y: Four digits year, like 2009.
    * %H: Two digits hours in 24h format, 00 through 23.
    * %I: Two digits hours in 12h format, 00 through 11.
    * %l (Lower case L): Hours in 12h format, 1 through 11.
    * %M: Two digits minutes, 00 through 59.
    * %p: Upper case AM or PM.
    * %P: Lower case AM or PM.
    * %S: Two digits seconds, 00 through 59


Kind Regards,
João
0
0
16 Aug 2021
Copy link to comment
2022-01-13 08-29-52
Saravanan Santhanam
Rank: #439

Hi Bradley,

Please refer below link for various formatting options available for high charts. In your case try to apply the formatting in X-axis JSON.

https://api.highcharts.com/highcharts/xAxis.dateTimeLabelFormats

Regards,

Saravanan Santhanam.


1
0
16 Aug 2021
Copy link to comment
2021-09-06 15-09-53
Dorine Boudry
MVP
Rank: #38

Hi Bradley,

besides the question of how you would format datetime, what do you mean when you only want to show the year ?  Do you only want 1 datapoint per year, or do you want many datapoints per year, but all of them only showing the year value ???

If you only want one datapoint per year, you'll have to run an aggregation function on your aggregate or SQL widget.  In that case, you can just add a calculated column for the year, group by that column and then whatever aggregation function (min ? max ? average? ) that you want on your value.  So in that case, no hassle with datetime formatting at all.

Dorine

0
0
16 Aug 2021
Copy link to comment
2021-07-06 10-00-38
Bradley Lansink
Rank: #895

Thanks for the replies!

I got it partially working. I was able to format the date to years only using the following snippet:

" xAxis: {
        type: 'datetime',
      title: {
        text: 'Date Range'        
      labels: {
        formatter: function() {
          return Highcharts.dateFormat('%e', this.value);
    }"

The next step would be to only show one year of each. This is the result at the moment:

I would like to get something like this:

I think it has something to do with the tickAmount, but Im not quite sure.

Thanks in advance!

0
0
17 Aug 2021
Copy link to comment
Log in to Answer
Log in to Answer Log in to Follow
OutSystems © - All Rights Reserved
55 Thomson Place
2nd Floor
Boston, MA 02210
Tel: +1 617 837 6840
More office locations
Legal
Website Terms of Use
Cookie Policy
Repository Terms of Use
Notice and Takedown Policy
Tools
IPP
Loading...
 
推荐文章
风流的足球  ·  如何将图像转换为zpl代码,以便使用斑马打印机打印?-腾讯云开发者社区-腾讯云
1 年前
潇洒的猴子  ·  GitHub热榜登顶:开源代码解释器,可装任意Python库,本地运行_腾讯新闻
1 年前
叛逆的警车  ·  WPF 教程(wpf架构)-腾讯云开发者社区-腾讯云
2 年前
坏坏的羽毛球  ·  调用DIV+CSS实现模拟表格对角线-汇编div
2 年前
大力的围巾  ·  陆奇最新演讲高清PPT下载;AI 绘画20+工具体验汇总;我愿称MOSS为全球开源界最强;思否AIGC黑客马拉松北京站 | ShowMeAI日报 - 掘金
2 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
Code - 代码工具平台
© 2024 ~ 沪ICP备11025650号