You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/12/03 00:59:37 UTC
[GitHub] [airflow] hwooson12 opened a new pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
hwooson12 opened a new pull request #20002:
URL: https://github.com/apache/airflow/pull/20002
This PR adds a new date and time format for x axis where all `nvd3.lineChart` classes are initialized in order to see time of execution_date as well as date.

closes: #19955
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] bbovenzi merged pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
Posted by GitBox <gi...@apache.org>.
bbovenzi merged pull request #20002:
URL: https://github.com/apache/airflow/pull/20002
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] bbovenzi commented on a change in pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
Posted by GitBox <gi...@apache.org>.
bbovenzi commented on a change in pull request #20002:
URL: https://github.com/apache/airflow/pull/20002#discussion_r765020600
##########
File path: airflow/www/views.py
##########
@@ -136,6 +136,11 @@
PAGE_SIZE = conf.getint('webserver', 'page_size')
FILTER_TAGS_COOKIE = 'tags_filter'
FILTER_STATUS_COOKIE = 'dag_status_filter'
+LINECHART_X_AXIS_TICKFORMAT = (
+ "function (d, i) { let xLabel;"
+ "if (i === undefined) {xLabel = d3.time.format('%H:%M, %d %b %Y')(new Date(parseInt(d)));"
+ "} else {xLabel = d3.time.format('%H:%M')(new Date(parseInt(d)));} return xLabel;}"
Review comment:
```suggestion
"} else {xLabel = d3.time.format('%H:%M, %d %b')(new Date(parseInt(d)));} return xLabel;}"
```
I think we can get away with everything but the year. Showing only the hh:mm is really confusing if the chart is over the course of weeks or months.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] hwooson12 commented on pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
Posted by GitBox <gi...@apache.org>.
hwooson12 commented on pull request #20002:
URL: https://github.com/apache/airflow/pull/20002#issuecomment-985281955
The original format in version 1.7 was like below.

BTW, I am digging into how to break the label into multiple lines. It's wrapped from d3 API so I guess it is going to be more to fix.
> I think hour:minute should be placed before (i.e. above) the date, if we break the label into multiple lines
I agree with it. If you find how to do it or have some thoughts on it, please leave a comment below!
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] hwooson12 commented on pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
Posted by GitBox <gi...@apache.org>.
hwooson12 commented on pull request #20002:
URL: https://github.com/apache/airflow/pull/20002#issuecomment-986343911
I realized it's not that simple to break the x-axis labels into multiple lines. It might need to fix the external library like nvd3. The only thing I can modify to change the format is a javascript function for `tickFormat` callback of d3 which returns real formatted date and time as string. So what I suggest is below.

If the format `%H:%M, %d %b %Y` is not that readable because they are too close, only time is shown on x-axis except for the beginning and the end. And both date and time can be seen on mouseover as you can see the screenshot above.
I wonder what you think about the suggestion?
@bbovenzi @uranusjr
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #20002:
URL: https://github.com/apache/airflow/pull/20002#issuecomment-995926585
Awesome work, congrats on your first merged pull request!
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] github-actions[bot] commented on pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #20002:
URL: https://github.com/apache/airflow/pull/20002#issuecomment-989909697
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] uranusjr commented on pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
Posted by GitBox <gi...@apache.org>.
uranusjr commented on pull request #20002:
URL: https://github.com/apache/airflow/pull/20002#issuecomment-985277474
I think hour:minute should be placed _before_ (i.e. above) the date, if we break the label into multiple lines
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] hwooson12 commented on a change in pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
Posted by GitBox <gi...@apache.org>.
hwooson12 commented on a change in pull request #20002:
URL: https://github.com/apache/airflow/pull/20002#discussion_r765344252
##########
File path: airflow/www/views.py
##########
@@ -136,6 +136,11 @@
PAGE_SIZE = conf.getint('webserver', 'page_size')
FILTER_TAGS_COOKIE = 'tags_filter'
FILTER_STATUS_COOKIE = 'dag_status_filter'
+LINECHART_X_AXIS_TICKFORMAT = (
+ "function (d, i) { let xLabel;"
+ "if (i === undefined) {xLabel = d3.time.format('%H:%M, %d %b %Y')(new Date(parseInt(d)));"
+ "} else {xLabel = d3.time.format('%H:%M')(new Date(parseInt(d)));} return xLabel;}"
Review comment:

Your suggestion looks pretty better than showing only the hh:mm π
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] hwooson12 commented on pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
Posted by GitBox <gi...@apache.org>.
hwooson12 commented on pull request #20002:
URL: https://github.com/apache/airflow/pull/20002#issuecomment-995724054
Does this PR need more reviews to be merged or is there anything else I need to do to proceed forward? @bbovenzi
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] uranusjr commented on pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
Posted by GitBox <gi...@apache.org>.
uranusjr commented on pull request #20002:
URL: https://github.com/apache/airflow/pull/20002#issuecomment-986455946
That looks quite nice to me as well.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on pull request #20002: Add hour and minute to time format on x-axis of all charts using nvd3.lineChart
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #20002:
URL: https://github.com/apache/airflow/pull/20002#issuecomment-985125454
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:
- Pay attention to the quality of your code (flake8, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
- In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
- Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, itβs a heavy docker but it ships with a working Airflow and a lot of integrations.
- Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
- Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
- Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
Apache Airflow is a community-driven project and together we are making it better π.
In case of doubts contact the developers at:
Mailing List: dev@airflow.apache.org
Slack: https://s.apache.org/airflow-slack
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org