Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make task ID on legend have enough width and width of line chart to be 100%. #15915

Merged
merged 4 commits into from Jun 10, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 15 additions & 4 deletions airflow/www/views.py
Expand Up @@ -439,6 +439,10 @@ def render_template(self, *args, **kwargs):
**kwargs,
)

line_chart_attr = {
'legend.maxKeyLength': 200,
}


def add_user_permissions_to_dag(sender, template, context, **extra): # noqa pylint: disable=unused-argument
"""
Expand Down Expand Up @@ -2270,8 +2274,12 @@ def duration(self, session=None):
if root:
dag = dag.sub_dag(task_ids_or_regex=root, include_upstream=True, include_downstream=False)
chart_height = wwwutils.get_chart_height(dag)
chart = nvd3.lineChart(name="lineChart", x_is_date=True, height=chart_height, width="1200")
cum_chart = nvd3.lineChart(name="cumLineChart", x_is_date=True, height=chart_height, width="1200")
chart = nvd3.lineChart(
name="lineChart", x_is_date=True, height=chart_height, chart_attr=self.line_chart_attr
)
cum_chart = nvd3.lineChart(
name="cumLineChart", x_is_date=True, height=chart_height, chart_attr=self.line_chart_attr
)

y_points = defaultdict(list)
x_points = defaultdict(list)
Expand Down Expand Up @@ -2390,7 +2398,8 @@ def tries(self, session=None):

chart_height = wwwutils.get_chart_height(dag)
chart = nvd3.lineChart(
name="lineChart", x_is_date=True, y_axis_format='d', height=chart_height, width="1200"
name="lineChart", x_is_date=True, y_axis_format='d', height=chart_height,
chart_attr=self.line_chart_attr
)

for task in dag.tasks:
Expand Down Expand Up @@ -2460,7 +2469,9 @@ def landing_times(self, session=None):
dag = dag.sub_dag(task_ids_or_regex=root, include_upstream=True, include_downstream=False)

chart_height = wwwutils.get_chart_height(dag)
chart = nvd3.lineChart(name="lineChart", x_is_date=True, height=chart_height, width="1200")
chart = nvd3.lineChart(
name="lineChart", x_is_date=True, height=chart_height, chart_attr=self.line_chart_attr
)
y_points = {}
x_points = {}
for task in dag.tasks:
Expand Down