From 5910bf007acd15676d14ece67801cb85355f4abd Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Thu, 14 Jan 2016 15:31:23 -0800 Subject: [PATCH] Providing options for Y axis number formating --- panoramix/forms.py | 15 ++++++++++++--- panoramix/static/panoramix.js | 5 ++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/panoramix/forms.py b/panoramix/forms.py index cbc2f3c18da1..29592ca9efe2 100644 --- a/panoramix/forms.py +++ b/panoramix/forms.py @@ -305,7 +305,16 @@ def __init__(self, viz): description="Based on granularity, number of time periods to compare against"), 'compare_suffix': TextField('Comparison suffix', description="Suffix to apply after the percentage display"), - 'y_axis_format': TextField('Y axis format', + 'y_axis_format': FreeFormSelectField('Y axis format', + default='.3s', + choices=[ + ('.3s', '".3s" | 12.3k'), + ('.3%', '".3%" | 1234543.210%'), + ('.4r', '".4r" | 12350'), + ('.3f', '".3f" | 12345.432'), + ('+,', '"+," | +12,345.4321'), + ('$,.2f', '"$,.2f" | $12,345.43'), + ], description="D3 format syntax for y axis " "https://github.com/mbostock/\n" "d3/wiki/Formatting"), @@ -360,9 +369,9 @@ def __init__(self, viz): "Legend", default=True, description="Whether to display the legend (toggles)"), 'x_axis_showminmax': BetterBooleanField( - "X show min/max", default=True, + "X bounds", default=True, description=( - "Whether to display the min and max values of the axis")), + "Whether to display the min and max values of the X axis")), 'rich_tooltip': BetterBooleanField( "Rich Tooltip", default=True, description=( diff --git a/panoramix/static/panoramix.js b/panoramix/static/panoramix.js index 0c4cb2ad327d..e7f56252c689 100644 --- a/panoramix/static/panoramix.js +++ b/panoramix/static/panoramix.js @@ -214,14 +214,12 @@ var px = (function() { url: '/r/shortner/', data: {'data': '/' + window.location.pathname + slice.querystring()}, success: function(data) { - console.log(data); data += '   '; $('#shortner').popover({content: data, placement: 'left', html: true, trigger: 'manual'}); $('#shortner').popover('show'); $('#close_shortner').click(function(){ $('#shortner').popover('destroy'); }); - }, error: function() {alert("Error :(");}, }); @@ -239,7 +237,7 @@ var px = (function() { } $(".select2").select2({dropdownAutoWidth : true}); - $(".select2Sortable").select2(); + $(".select2Sortable").select2({dropdownAutoWidth : true}); $(".select2Sortable").select2Sortable({bindOrder: 'sortableStop'}); $("form").show(); $('[data-toggle="tooltip"]').tooltip({container: 'body'}); @@ -356,6 +354,7 @@ var px = (function() { .select2({ createSearchChoice: create_choices, initSelection: initSelectionToValue, + dropdownAutoWidth : true, multiple: false, data: l, });