dataviz: use month short names instead of number in labels (#60738)
This commit is contained in:
parent
035dc30548
commit
42eebde447
|
@ -635,14 +635,14 @@ class ChartNgCell(CellBase):
|
|||
min_date, max_date = min(dates), max(dates)
|
||||
|
||||
date_formats = {
|
||||
'day': 'd-m-Y',
|
||||
'day': 'd M Y',
|
||||
# Translators: This indicates week number followed by year, for example it can yield W2-2021.
|
||||
# First "W" is the first letter of the word "week" and should be translated accordingly, second
|
||||
# "W" and "o" are interpreted by Django's date filter and should be left as is. First W is
|
||||
# backslash escaped to prevent it from being interpreted, translators should refer to Django's
|
||||
# documentation in order to know if the new letter resulting of translation should be escaped or not.
|
||||
'week': gettext(r'\WW-o'),
|
||||
'month': 'm-Y',
|
||||
'month': 'M Y',
|
||||
'year': 'Y',
|
||||
'weekday': 'l',
|
||||
}
|
||||
|
|
|
@ -1808,8 +1808,8 @@ def test_chartng_cell_new_api_aggregation(new_api_statistics, app, admin_user, n
|
|||
|
||||
chart = cell.get_chart()
|
||||
assert len(chart.x_labels) == 484
|
||||
assert chart.x_labels[:3] == ['06-10-2020', '07-10-2020', '08-10-2020']
|
||||
assert chart.x_labels[-3:] == ['30-01-2022', '31-01-2022', '01-02-2022']
|
||||
assert chart.x_labels[:3] == ['06 Oct 2020', '07 Oct 2020', '08 Oct 2020']
|
||||
assert chart.x_labels[-3:] == ['30 Jan 2022', '31 Jan 2022', '01 Feb 2022']
|
||||
assert chart.raw_series[0][0][:8] == [0, 0, 0, 0, 0, 0, 0, 1]
|
||||
assert chart.raw_series[1][0][:8] == [2, 0, 0, 0, 0, 0, 0, 2]
|
||||
|
||||
|
@ -1828,8 +1828,8 @@ def test_chartng_cell_new_api_aggregation(new_api_statistics, app, admin_user, n
|
|||
chart = cell.get_chart()
|
||||
assert 'time_interval=day' in new_api_mock.call['requests'][1].url
|
||||
assert len(chart.x_labels) == 17
|
||||
assert chart.x_labels[:3] == ['10-2020', '11-2020', '12-2020']
|
||||
assert chart.x_labels[-3:] == ['12-2021', '01-2022', '02-2022']
|
||||
assert chart.x_labels[:3] == ['Oct 2020', 'Nov 2020', 'Dec 2020']
|
||||
assert chart.x_labels[-3:] == ['Dec 2021', 'Jan 2022', 'Feb 2022']
|
||||
assert chart.raw_series == [
|
||||
([1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2], {'title': 'Serie 1'}),
|
||||
([4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], {'title': 'Serie 2'}),
|
||||
|
|
Loading…
Reference in New Issue