简体   繁体   English

APEX 图表上的小时:分钟格式是不可能的

[英]Hour:Minute format on an APEX chart is not possible

I use Oracle APEX (v22.1) and on a page I created a (line) chart, but I have the following problem for the visualization of the graphic:我使用 Oracle APEX (v22.1) 并在一个页面上创建了一个(折线图)图表,但我在图形可视化方面遇到以下问题:

On the y-axis it is not possible to show the values in the format 'hh:mi' and I need a help for this.在 y 轴上,无法以“hh:mi”格式显示值,我需要帮助。

Details for the axis:轴的详细信息:

  • x-axis: A date column represented as a string: to_char(time2, 'YYYY-MM') x 轴:日期列表示为字符串:to_char(time2, 'YYYY-MM')
  • y-axis: Two date columns and the average of the difference will be calculated: AVG(time2 - time1); y 轴:两个日期列,将计算差值的平均值:AVG(time2 - time1); the date time2 is the same as the date in the x-axis.日期时间 2 与 x 轴中的日期相同。

So I have the following SQL query for the visualization of the series:所以我对系列的可视化有以下 SQL 查询:

SELECT DISTINCT to_char(time2, 'YYYY-MM') AS YEAR_MONTH --x-axis, 
AVG(time2 - time1) AS AVERAGE_VALUE --y-axis
FROM users
GROUP BY to_char(time2, 'YYYY-MM')
ORDER BY to_char(time2, 'YYYY-MM')

I have another problem to solve it in another way: I am not familiar with JavaScript, if the solution is only possible in this way.我还有一个问题要用另一种方式解决:我不熟悉JavaScript,如果只能通过这种方式解决的话。 Because I started new with APEX, but I have seen in different tutorials that you can use JS.因为我是从 APEX 开始的新手,但我在不同的教程中看到您可以使用 JS。 So, when JS is the only solution, I would be happy to get a short description what I must do on the page.所以,当 JS 是唯一的解决方案时,我很乐意得到一个简短的描述,我必须在页面上做什么。 (I don't know if this point is important for this case: The values time1 and time2 are updated daily.) (我不知道这一点对于这种情况是否重要:值 time1 和 time2 每天更新。)

  • On the attributes of the chart I enabled the 'Time Axis Type' under Settings在图表的属性上,我在设置下启用了“时间轴类型”
  • On the y-axis I change the format to "Time - Short" and I tried with different pattern like ##:## but in this case you see for every value and also on the y-axis the value '01:00' although the line chart was represented in the right way.在 y 轴上,我将格式更改为“Time - Short”,并尝试使用不同的模式,例如 ##:## 但在这种情况下,您会看到每个值以及 y 轴上的值“01:00”尽管折线图以正确的方式表示。 But when I change the format to Decimal the values are shown correct as the line chart.但是当我将格式更改为 Decimal 时,值显示为正确的折线图。
  • I also tried it with the EXTRACT function for the value like 'EXTRACT(HOUR FROM AVG(time2 - time1))||我还用 EXTRACT function 尝试了它的值,例如 'EXTRACT(HOUR FROM AVG(time2 - time1))|| ':' || ':' || EXTRACT(MINUTE FROM AVG(time2 - time1))' but in this case I get an error message EXTRACT(MINUTE FROM AVG(time2 - time1))' 但在这种情况下我收到一条错误消息

So where is my mistake or is it more difficult to solve this?那么我的错误在哪里或者更难解决这个问题?

ROUND(TRUNC(avg(time2 - time1)/60) + mod(avg(time2 - time1),60)/100, 2) AS Y ROUND(TRUNC(avg(time2 - time1)/60) + mod(avg(time2 - time1),60)/100, 2) 为 Y

will get close to what you want, you can set Y Axis minimum 0 maximum 24将接近您想要的,您可以设置 Y 轴最小值 0 最大值 24

then 12.23 means 12 hour and 23 minutes.那么 12.23 表示 12 小时 23 分钟。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM