dataviz: hide y label for one dimension dot chart type with title (#73686) #51

Merged
vdeniaud merged 1 commits from wip/73686-Cellule-Graphe-de-type-points-ma into main 2023-04-17 11:48:35 +02:00
2 changed files with 22 additions and 0 deletions

View File

@ -393,6 +393,8 @@ class ChartNgCell(CellBase):
for label, data in zip(chart.x_labels, data["series"][0]["data"])
if data
]
elif self.chart_type == 'dot':
data['series'][0]['label'] = ''
if self.chart_type == 'stacked-bar-percent':
self.make_percent([serie['data'] for serie in data['series']])

View File

@ -1599,6 +1599,26 @@ def test_chartng_cell_view_new_api_no_data(app, normal_user, new_api_statistics)
assert '>4242<' in resp.text
@with_httmock(new_api_mock)
def test_chartng_cell_view_new_api_dot_chart_hide_y_label(app, normal_user, new_api_statistics):
page = Page.objects.create(title='One', slug='index')
cell = ChartNgCell(page=page, order=1, placeholder='content')
cell.statistic = Statistic.objects.get(slug='one-serie')
cell.chart_type = 'dot'
cell.save()
location = '/api/dataviz/graph/%s/' % cell.id
resp = app.get(location + '?width=400', status=200)
assert 'Serie 1' not in resp.text
cell.statistic = Statistic.objects.get(slug='two-series')
cell.save()
resp = app.get(location + '?width=400', status=200)
assert 'Serie 1' in resp.text
assert 'Serie 2' in resp.text
@with_httmock(bijoe_mock)
def test_chartng_cell_manager(app, admin_user, statistics):
page = Page(title='One', slug='index')