Skip to content

Commit

Permalink
enumerate vizTypes and pieLabelType
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Sep 13, 2018
1 parent dfab7e3 commit 4c45f5f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
28 changes: 24 additions & 4 deletions superset/assets/src/visualizations/nvd3/NVD3Vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
boxPlotValueType,
bulletDataType,
categoryAndValueXYType,
colorObjectType,
rgbObjectType,
numericXYType,
numberOrAutoType,
stringOrObjectWithLabelType,
Expand Down Expand Up @@ -109,7 +109,21 @@ const propTypes = {
showLegend: PropTypes.bool,
showMarkers: PropTypes.bool,
useRichTooltip: PropTypes.bool,
vizType: PropTypes.string,
vizType: PropTypes.oneOf([
'area',
'bar',
'box_plot',
'bubble',
'bullet',
'compare',
'column',
'dist_bar',
'line',
'line_multi',
'time_pivot',
'pie',
'dual_line',
]),
xAxisFormat: PropTypes.string,
xAxisLabel: PropTypes.string,
xAxisShowMinMax: PropTypes.bool,
Expand Down Expand Up @@ -139,7 +153,13 @@ const propTypes = {
// 'pie' only
isDonut: PropTypes.bool,
isPieLabelOutside: PropTypes.bool,
pieLabelType: PropTypes.string,
pieLabelType: PropTypes.oneOf([
'key',
'value',
'percent',
'key_value',
'key_percent',
]),
showLabels: PropTypes.bool,
// 'area' only
areaStackedStyle: PropTypes.string,
Expand All @@ -150,7 +170,7 @@ const propTypes = {
yField: stringOrObjectWithLabelType,
sizeField: stringOrObjectWithLabelType,
// time-pivot only
baseColor: colorObjectType,
baseColor: rgbObjectType,
};

const NOOP = () => {};
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/visualizations/nvd3/PropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const stringOrObjectWithLabelType = PropTypes.oneOfType([
}),
]);

export const colorObjectType = PropTypes.shape({
export const rgbObjectType = PropTypes.shape({
r: PropTypes.number.isRequired,
g: PropTypes.number.isRequired,
b: PropTypes.number.isRequired,
Expand Down

0 comments on commit 4c45f5f

Please sign in to comment.