mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
add timestamp toggle in chart options (Table Viz) (#439)
* add timestamp toggle in chart options (Table Viz) * refactor timestamp choices * fix build error
This commit is contained in:
committed by
Maxime Beauchemin
parent
c5fcbc0709
commit
a75d6bc52c
@@ -17,6 +17,15 @@ from caravel import app
|
||||
|
||||
config = app.config
|
||||
|
||||
TIMESTAMP_CHOICES = [
|
||||
('smart_date', 'Adaptative formating'),
|
||||
("%m/%d/%Y", '"%m/%d/%Y" | 01/14/2019'),
|
||||
("%Y-%m-%d", '"%Y-%m-%d" | 2019-01-14'),
|
||||
("%Y-%m-%d %H:%M:%S",
|
||||
'"%Y-%m-%d %H:%M:%S" | 2019-01-14 01:32:10'),
|
||||
("%H:%M:%S", '"%H:%M:%S" | 01:32:10'),
|
||||
]
|
||||
|
||||
|
||||
class BetterBooleanField(BooleanField):
|
||||
|
||||
@@ -430,17 +439,15 @@ class FormFactory(object):
|
||||
'compare_suffix': TextField(
|
||||
'Comparison suffix',
|
||||
description="Suffix to apply after the percentage display"),
|
||||
'table_timestamp_format': FreeFormSelectField(
|
||||
'Table Timestamp Format',
|
||||
default='smart_date',
|
||||
choices=TIMESTAMP_CHOICES,
|
||||
description="Timestamp Format"),
|
||||
'x_axis_format': FreeFormSelectField(
|
||||
'X axis format',
|
||||
default='smart_date',
|
||||
choices=[
|
||||
('smart_date', 'Adaptative formating'),
|
||||
("%m/%d/%Y", '"%m/%d/%Y" | 01/14/2019'),
|
||||
("%Y-%m-%d", '"%Y-%m-%d" | 2019-01-14'),
|
||||
("%Y-%m-%d %H:%M:%S",
|
||||
'"%Y-%m-%d %H:%M:%S" | 2019-01-14 01:32:10'),
|
||||
("%H:%M:%S", '"%H:%M:%S" | 01:32:10'),
|
||||
],
|
||||
choices=TIMESTAMP_CHOICES,
|
||||
description="D3 format syntax for y axis "
|
||||
"https://github.com/mbostock/\n"
|
||||
"d3/wiki/Formatting"),
|
||||
|
||||
Reference in New Issue
Block a user