Chart Parameters
Chart parameters are stored as a JSON encoded string in the slices.params
column and are often referenced throughout the code as form-data. Currently the form-data is neither versioned nor typed as thus is somewhat free-formed. Note in the future there may be merit in using something like JSON Schema to both annotate and validate the JSON object in addition to using a Mypy TypedDict
(introduced in Python 3.8) for typing the form-data in the backend. This section serves as a potential primer for that work.
The following tables provide a non-exhaustive list of the various fields which can be present in the JSON object grouped by the Explorer pane sections. These values were obtained by extracting the distinct fields from a legacy deployment consisting of tens of thousands of charts and thus some fields may be missing whilst others may be deprecated.
Note not all fields are correctly categorized. The fields vary based on visualization type and may appear in different sections depending on the type. Verified deprecated columns may indicate a missing migration and/or prior migrations which were unsuccessful and thus future work may be required to clean up the form-data.
Datasource & Chart Type
Field | Type | Notes |
---|
database_name | string | Deprecated? |
datasource | string | <datasouce_id>__<datasource_type> |
datasource_id | string | Deprecated? See datasource |
datasource_name | string | Deprecated? |
datasource_type | string | Deprecated? See datasource |
viz_type | string | The Visualization Type widget |
Time
Field | Type | Notes |
---|
druid_time_origin | string | The Druid Origin widget |
granularity | string | The Druid Time Granularity widget |
granularity_sqla | string | The SQLA Time Column widget |
time_grain_sqla | string | The SQLA Time Grain widget |
time_range | string | The Time range widget |
GROUP BY
Field | Type | Notes |
---|
metrics | array(string) | See Query section |
order_asc | - | See Query section |
row_limit | - | See Query section |
timeseries_limit_metric | - | See Query section |
NOT GROUPED BY
Field | Type | Notes |
---|
order_by_cols | array(string) | The Ordering widget |
row_limit | - | See Query section |
Y Axis 1
Field | Type | Notes |
---|
metric | - | The Left Axis Metric widget. See Query section |
y_axis_format | - | See Y Axis section |
Y Axis 2
Field | Type | Notes |
---|
metric_2 | - | The Right Axis Metric widget. See Query section |
Query
Field | Type | Notes |
---|
adhoc_filters | array(object) | The Filters widget |
extra_filters | array(object) | Another pathway to the Filters widget. It is generally used to pass dashboard filter parameters to a chart. It can be used for appending additional filters to a chart that has been saved with its own filters on an ad-hoc basis if the chart is being used as a standalone widget.
For implementation examples see : utils test.py For insight into how superset processes the contents of this parameter see: exploreUtils/index.js |
columns | array(string) | The Breakdowns widget |
groupby | array(string) | The Group by or Series widget |
limit | number | The Series Limit widget |
metric
metric_2
metrics
percent_mertics
secondary_metric
size
x
y | string,object,array(string),array(object) | The metric(s) depending on the visualization type |
order_asc | boolean | The Sort Descending widget |
row_limit | number | The Row limit widget |
timeseries_limit_metric | object | The Sort By widget |
The metric
(or equivalent) and timeseries_limit_metric
fields are all composed of either metric names or the JSON representation of the AdhocMetric
TypeScript type. The adhoc_filters
is composed of the JSON represent of the AdhocFilter
TypeScript type (which can comprise of columns or metrics depending on whether it is a WHERE or HAVING clause). The all_columns
, all_columns_x
, columns
, groupby
, and order_by_cols
fields all represent column names.
Chart Options
Field | Type | Notes |
---|
color_picker | object | The Fixed Color widget |
label_colors | object | The Color Scheme widget |
normalized | boolean | The Normalized widget |
Y Axis
Field | Type | Notes |
---|
y_axis_2_label | N/A | Deprecated? |
y_axis_format | string | The Y Axis Format widget |
y_axis_zero | N/A | Deprecated? |
Note the y_axis_format
is defined under various section for some charts.
Other
Field | Type | Notes |
---|
color_scheme | string | |
Unclassified
Field | Type | Notes |
---|
add_to_dash | N/A | |
code | N/A | |
collapsed_fieldsets | N/A | |
comparison type | N/A | |
country_fieldtype | N/A | |
default_filters | N/A | |
entity | N/A | |
expanded_slices | N/A | |
filter_immune_slice_fields | N/A | |
filter_immune_slices | N/A | |
flt_col_0 | N/A | |
flt_col_1 | N/A | |
flt_eq_0 | N/A | |
flt_eq_1 | N/A | |
flt_op_0 | N/A | |
flt_op_1 | N/A | |
goto_dash | N/A | |
import_time | N/A | |
label | N/A | |
linear_color_scheme | N/A | |
new_dashboard_name | N/A | |
new_slice_name | N/A | |
num_period_compare | N/A | |
period_ratio_type | N/A | |
perm | N/A | |
rdo_save | N/A | |
refresh_frequency | N/A | |
remote_id | N/A | |
resample_fillmethod | N/A | |
resample_how | N/A | |
rose_area_proportion | N/A | |
save_to_dashboard_id | N/A | |
schema | N/A | |
series | N/A | |
show_bubbles | N/A | |
slice_name | N/A | |
timed_refresh_immune_slices | N/A | |
userid | N/A | |