pwdsudinym-ui commented on code in PR #55339:
URL: https://github.com/apache/airflow/pull/55339#discussion_r2373909559


##########
airflow-core/src/airflow/ui/src/components/DurationChart.tsx:
##########
@@ -236,6 +236,9 @@ export const DurationChart = ({
               stacked: true,
               ticks: {
                 maxTicksLimit: 3,
+                callback: (value) => {
+                  return(dayjs(value).format(getLabelFormat(entries)))
+                }

Review Comment:
   Good catch, I didn't notice that the x-axis labels were all the same. I'm 
not sure that this is a timezone issue though. I hadn't noticed before, but my 
screenshot above has 12-31 as the time for all despite the onhover being a 
different day.
   
   I spent some time investigating this today. It seems a little more difficult 
than I thought. 
   If we use the callback function for ticks, the values currently being passed 
to the callback are `0, 1, 2, ...` which I think when converted with dayjs give 
us the same x axis label. Not using the callback function lets chartjs auto 
detect the label to show so it's not a problem on the main branch as of now.
   
   I tried to enable `type: time` on the x axis to give the chart more info 
with which to parse the label. I added the adapter `import 
"chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm";` The callback 
values did end up being the correct unix timestamps, but the bars ended up 
disappearing for some reason
   <img width="375" height="227" alt="image" 
src="https://github.com/user-attachments/assets/b316a4b4-75d1-4105-a8a4-4edead94e225";
 />
   I'm also not sure this is what we want because then the chart can have gaps 
if scaled based on time.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to