mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Statistics: Ellipsize long product names
This commit is contained in:
@@ -34,10 +34,23 @@ $(function () {
|
||||
new Morris.Bar({
|
||||
element: 'obp_chart',
|
||||
data: JSON.parse($("#obp-data").html()),
|
||||
xkey: 'item',
|
||||
xkey: 'item_short',
|
||||
ykeys: ['ordered', 'paid'],
|
||||
labels: [gettext('Placed orders'), gettext('Paid orders')],
|
||||
barColors: ['#3b1c4a', '#50a167'],
|
||||
hoverCallback: function (index, options, content, row) {
|
||||
console.log(content);
|
||||
var $c = $("<div>" + content + "</div>");
|
||||
var $label = $c.find(".morris-hover-row-label");
|
||||
$label.text(row.item);
|
||||
var newc = $label.get(0).outerHTML;
|
||||
$c.find('.morris-hover-point').each(function (i, r) {
|
||||
if ($.trim($(r).text().split("\n")[2]) !== "0") {
|
||||
newc += r.outerHTML;
|
||||
}
|
||||
});
|
||||
return newc;
|
||||
},
|
||||
resize: true,
|
||||
xLabelAngle: 30
|
||||
});
|
||||
|
||||
@@ -117,6 +117,7 @@ class IndexView(EventPermissionRequiredMixin, ChartContainingView, TemplateView)
|
||||
ctx['obp_data'] = json.dumps([
|
||||
{
|
||||
'item': item_names[item],
|
||||
'item_short': item_names[item] if len(item_names[item]) < 15 else (item_names[item][:15] + "…"),
|
||||
'ordered': cnt,
|
||||
'paid': num_paid.get(item, 0)
|
||||
} for item, cnt in num_ordered.items()
|
||||
|
||||
Reference in New Issue
Block a user