refactor: Relocating/renaming various chart controls (#836)

* refactor: relocating/renaming various chart controls

* typo

* Reverting to "additional metadata"
This commit is contained in:
Evan Rusackas 2020-12-03 23:27:38 -08:00 committed by Yongjie Zhao
parent 14b7ad4dea
commit 741ea10ad4
16 changed files with 33 additions and 19 deletions

View File

@ -101,7 +101,6 @@ export const annotations = {
default: [],
description: 'Annotation Layers',
renderTrigger: true,
tabOverride: 'data',
},
},
],

View File

@ -154,7 +154,7 @@ export type InternalControlType =
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ControlType = InternalControlType | React.ComponentType<any>;
export type TabOverride = 'data' | boolean;
export type TabOverride = 'data' | 'customize' | boolean;
/**
* Control config specifying how chart controls appear in the control panel, all
@ -179,7 +179,8 @@ export type TabOverride = 'data' | boolean;
* show a warning based on the value of another component. It's also possible to bind
* arbitrary data from the redux store to the component this way.
* - tabOverride: set to 'data' if you want to force a renderTrigger to show up on the `Data`
* tab, otherwise `renderTrigger: true` components will show up on the `Style` tab.
tab, or 'customize' if you want it to show up on that tam. Otherwise sections with ALL
`renderTrigger: true` components will show up on the `Customize` tab.
* - visibility: a function that uses control panel props to check whether a control should
* be visibile.
*/
@ -198,7 +199,6 @@ export interface BaseControlConfig<
error?: ReactNode;
// override control panel state props
mapStateToProps?: (state: ControlPanelState, control: this) => ExtraControlProps;
tabOverride?: TabOverride;
visibility?: (props: ControlPanelsContainerProps) => boolean;
}

View File

@ -68,7 +68,7 @@ class CategoricalColorScale extends ExtensibleFunction {
* @returns an object where the key is the data value and the value is the hex color code
*/
getColorMap() {
const colorMap: { [key: string]: string } = {};
const colorMap: { [key: string]: string | undefined } = {};
this.scale.domain().forEach(value => {
colorMap[value.toString()] = this.scale(value);
});

View File

@ -52,6 +52,7 @@ export default class SequentialScheme extends ColorScheme {
const piecewiseScale: (t: number) => string = piecewise(interpolateHcl, this.colors);
const adjustExtent = scaleLinear().range(extent).clamp(true);
// @ts-ignore
return quantize<string>(t => piecewiseScale(adjustExtent(t)), numColors);
}
}

View File

@ -62,6 +62,7 @@ export default {
{
label: t('Chart Options'),
expanded: true,
tabOverride: 'customize',
controlSetRows: [
['linear_color_scheme'],
[

View File

@ -27,8 +27,9 @@ export default {
controlSetRows: [['entity'], ['metric'], ['adhoc_filters']],
},
{
label: t('Options'),
label: t('Chart Options'),
expanded: true,
tabOverride: 'customize',
controlSetRows: [
[
{
@ -88,9 +89,9 @@ export default {
],
controlOverrides: {
entity: {
label: t('ISO 3166-2 codes of region/province/department'),
label: t('ISO 3166-2 Codes'),
description: t(
"It's ISO 3166-2 of your region/province/department in your table. (see documentation for list of ISO 3166-2)",
'Column containing ISO 3166-2 codes of region/province/department in your table.',
),
},
metric: {

View File

@ -38,7 +38,7 @@ const config: ControlPanelConfig = {
name: 'all_columns_x',
config: {
type: 'SelectControl',
label: t('Column containing event names'),
label: t('Event Names'),
description: t('Columns to display'),
mapStateToProps: state => ({
choices: columnChoices(state?.datasource),
@ -98,7 +98,7 @@ const config: ControlPanelConfig = {
config: {
type: 'SelectControl',
multi: true,
label: t('Meta data'),
label: t('Metadata'),
default: [],
description: t('Select any columns for metadata inspection'),
optionRenderer: c => <ColumnOption showType column={c} />,
@ -118,11 +118,11 @@ const config: ControlPanelConfig = {
],
controlOverrides: {
entity: {
label: t('Column containing entity ids'),
label: t('Entity ID'),
description: t('e.g., a "user id" column'),
},
row_limit: {
label: t('Event count limit'),
label: t('Max Events'),
description: t('The maximum number of events to return, equivalent to the number of rows'),
},
},

View File

@ -27,7 +27,8 @@ export default {
controlSetRows: [['groupby'], ['metric'], ['adhoc_filters'], ['row_limit']],
},
{
label: t('Options'),
label: t('Chart Options'),
expanded: true,
controlSetRows: [
[
{

View File

@ -41,7 +41,7 @@ export default {
name: 'all_columns_x',
config: {
type: 'SelectControl',
label: 'X',
label: 'X Axis',
default: null,
description: t('Columns to display'),
mapStateToProps: state => ({
@ -54,7 +54,7 @@ export default {
name: 'all_columns_y',
config: {
type: 'SelectControl',
label: 'Y',
label: 'Y Axis',
default: null,
description: t('Columns to display'),
mapStateToProps: state => ({
@ -72,6 +72,7 @@ export default {
{
label: t('Heatmap Options'),
expanded: true,
tabOverride: 'customize',
controlSetRows: [
['linear_color_scheme'],
[

View File

@ -30,7 +30,7 @@ export default {
name: 'all_columns_x',
config: {
type: 'SelectControl',
label: t('Numeric Columns'),
label: t('Columns'),
default: null,
description: t('Select the numeric columns to draw the histogram'),
mapStateToProps: state => ({

View File

@ -52,7 +52,7 @@ export default {
],
},
{
label: t('Paired t-test'),
label: t('Parameters'),
expanded: false,
controlSetRows: [
[

View File

@ -125,6 +125,7 @@ export default {
{
label: t('Chart Options'),
expanded: true,
tabOverride: 'customize',
controlSetRows: [
['color_scheme', 'label_colors'],
[
@ -192,6 +193,8 @@ export default {
description: t('Use a log scale'),
},
},
],
[
{
name: 'equal_date_size',
config: {

View File

@ -28,6 +28,7 @@ export default {
{
label: t('Chart Options'),
expanded: true,
tabOverride: 'customize',
controlSetRows: [
['color_scheme', 'label_colors'],
[

View File

@ -66,6 +66,7 @@ export default {
},
{
label: t('X Axis'),
tabOverride: 'customize',
expanded: true,
controlSetRows: [
[xAxisLabel, bottomMargin],
@ -75,6 +76,7 @@ export default {
},
{
label: t('Y Axis'),
tabOverride: 'customize',
expanded: true,
controlSetRows: [
['y_axis_format', yAxisBounds],

View File

@ -61,6 +61,7 @@ export default {
{
label: t('Chart Options'),
expanded: true,
tabOverride: 'customize',
controlSetRows: [
['color_scheme', 'label_colors'],
[showLegend, null],
@ -69,6 +70,7 @@ export default {
{
label: t('X Axis'),
expanded: true,
tabOverride: 'customize',
controlSetRows: [
[xAxisLabel, leftMargin],
[
@ -100,6 +102,7 @@ export default {
{
label: t('Y Axis'),
expanded: true,
tabOverride: 'customize',
controlSetRows: [
[yAxisLabel, bottomMargin],
['y_axis_format', null],

View File

@ -44,6 +44,7 @@ export default {
controlPanelSections: [
{
label: t('Chart Options'),
tabOverride: 'customize',
expanded: true,
controlSetRows: [
['color_scheme', 'label_colors'],
@ -73,7 +74,7 @@ export default {
],
},
{
label: t('Y Axis 1'),
label: t('Y Axis Left'),
expanded: true,
controlSetRows: [
[
@ -105,7 +106,7 @@ export default {
],
},
{
label: t('Y Axis 2'),
label: t('Y Axis Right'),
expanded: false,
controlSetRows: [
[