diff --git a/.betterer.results b/.betterer.results index 5253d0803ae..6169f6b2cb3 100644 --- a/.betterer.results +++ b/.betterer.results @@ -544,9 +544,9 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "42"], [0, 0, 0, "Unexpected any. Specify a different type.", "43"], [0, 0, 0, "Unexpected any. Specify a different type.", "44"], - [0, 0, 0, "Unexpected any. Specify a different type.", "45"], + [0, 0, 0, "Do not use any type assertions.", "45"], [0, 0, 0, "Unexpected any. Specify a different type.", "46"], - [0, 0, 0, "Unexpected any. Specify a different type.", "47"], + [0, 0, 0, "Do not use any type assertions.", "47"], [0, 0, 0, "Unexpected any. Specify a different type.", "48"], [0, 0, 0, "Unexpected any. Specify a different type.", "49"], [0, 0, 0, "Unexpected any. Specify a different type.", "50"], @@ -555,11 +555,11 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "53"], [0, 0, 0, "Unexpected any. Specify a different type.", "54"], [0, 0, 0, "Unexpected any. Specify a different type.", "55"], - [0, 0, 0, "Do not use any type assertions.", "56"], + [0, 0, 0, "Unexpected any. Specify a different type.", "56"], [0, 0, 0, "Unexpected any. Specify a different type.", "57"], - [0, 0, 0, "Do not use any type assertions.", "58"], + [0, 0, 0, "Unexpected any. Specify a different type.", "58"], [0, 0, 0, "Unexpected any. Specify a different type.", "59"], - [0, 0, 0, "Do not use any type assertions.", "60"], + [0, 0, 0, "Unexpected any. Specify a different type.", "60"], [0, 0, 0, "Unexpected any. Specify a different type.", "61"], [0, 0, 0, "Do not use any type assertions.", "62"], [0, 0, 0, "Unexpected any. Specify a different type.", "63"], @@ -569,9 +569,9 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "67"], [0, 0, 0, "Do not use any type assertions.", "68"], [0, 0, 0, "Unexpected any. Specify a different type.", "69"], - [0, 0, 0, "Unexpected any. Specify a different type.", "70"], - [0, 0, 0, "Do not use any type assertions.", "71"], - [0, 0, 0, "Unexpected any. Specify a different type.", "72"], + [0, 0, 0, "Do not use any type assertions.", "70"], + [0, 0, 0, "Unexpected any. Specify a different type.", "71"], + [0, 0, 0, "Do not use any type assertions.", "72"], [0, 0, 0, "Unexpected any. Specify a different type.", "73"], [0, 0, 0, "Do not use any type assertions.", "74"], [0, 0, 0, "Unexpected any. Specify a different type.", "75"], @@ -586,7 +586,13 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "84"], [0, 0, 0, "Unexpected any. Specify a different type.", "85"], [0, 0, 0, "Do not use any type assertions.", "86"], - [0, 0, 0, "Unexpected any. Specify a different type.", "87"] + [0, 0, 0, "Unexpected any. Specify a different type.", "87"], + [0, 0, 0, "Unexpected any. Specify a different type.", "88"], + [0, 0, 0, "Do not use any type assertions.", "89"], + [0, 0, 0, "Unexpected any. Specify a different type.", "90"], + [0, 0, 0, "Unexpected any. Specify a different type.", "91"], + [0, 0, 0, "Do not use any type assertions.", "92"], + [0, 0, 0, "Unexpected any. Specify a different type.", "93"] ], "packages/grafana-data/src/utils/Registry.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] diff --git a/docs/sources/developers/kinds/composable/xychart/panelcfg/schema-reference.md b/docs/sources/developers/kinds/composable/xychart/panelcfg/schema-reference.md index cdcfffeb885..d07e2fdce7e 100644 --- a/docs/sources/developers/kinds/composable/xychart/panelcfg/schema-reference.md +++ b/docs/sources/developers/kinds/composable/xychart/panelcfg/schema-reference.md @@ -15,13 +15,128 @@ title: XYChartPanelCfg kind | Property | Type | Required | Default | Description | |-----------------------|--------------------------------|----------|---------|---------------------------------------------------------| +| `FieldConfig` | [object](#fieldconfig) | **Yes** | | | | `Options` | [object](#options) | **Yes** | | | -| `ScatterFieldConfig` | [object](#scatterfieldconfig) | **Yes** | | | | `ScatterSeriesConfig` | [object](#scatterseriesconfig) | **Yes** | | | | `ScatterShow` | string | **Yes** | | Possible values are: `points`, `lines`, `points+lines`. | | `SeriesMapping` | string | **Yes** | | Possible values are: `auto`, `manual`. | | `XYDimensionConfig` | [object](#xydimensionconfig) | **Yes** | | | +### FieldConfig + +It extends [HideableFieldConfig](#hideablefieldconfig) and [AxisConfig](#axisconfig). + +| Property | Type | Required | Default | Description | +|---------------------|-----------------------------------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------| +| `axisCenteredZero` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `axisColorMode` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs
Possible values are: `text`, `series`. | +| `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | +| `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | *(Inherited from [HideableFieldConfig](#hideablefieldconfig))*
TODO docs | +| `labelValue` | [TextDimensionConfig](#textdimensionconfig) | No | | | +| `label` | string | No | | TODO docs
Possible values are: `auto`, `never`, `always`. | +| `lineColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | | +| `lineStyle` | [LineStyle](#linestyle) | No | | TODO docs | +| `lineWidth` | integer | No | | Constraint: `>=0 & <=2147483647`. | +| `pointColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | | +| `pointSize` | [ScaleDimensionConfig](#scaledimensionconfig) | No | | | +| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs | +| `show` | string | No | | Possible values are: `points`, `lines`, `points+lines`. | + +### AxisConfig + +TODO docs + +| Property | Type | Required | Default | Description | +|---------------------|-----------------------------------------------------|----------|---------|----------------------------------------------------------------------------------------| +| `axisCenteredZero` | boolean | No | | | +| `axisColorMode` | string | No | | TODO docs
Possible values are: `text`, `series`. | +| `axisGridShow` | boolean | No | | | +| `axisLabel` | string | No | | | +| `axisPlacement` | string | No | | TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | +| `axisSoftMax` | number | No | | | +| `axisSoftMin` | number | No | | | +| `axisWidth` | number | No | | | +| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | TODO docs | + +### ScaleDistributionConfig + +TODO docs + +| Property | Type | Required | Default | Description | +|-------------------|--------|----------|---------|--------------------------------------------------------------------------| +| `type` | string | **Yes** | | TODO docs
Possible values are: `linear`, `log`, `ordinal`, `symlog`. | +| `linearThreshold` | number | No | | | +| `log` | number | No | | | + +### ColorDimensionConfig + +It extends [BaseDimensionConfig](#basedimensionconfig). + +| Property | Type | Required | Default | Description | +|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| +| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | +| `fixed` | string | No | | | + +### BaseDimensionConfig + +| Property | Type | Required | Default | Description | +|----------|--------|----------|---------|-------------------------------------------| +| `field` | string | No | | fixed: T -- will be added by each element | + +### HideSeriesConfig + +TODO docs + +| Property | Type | Required | Default | Description | +|-----------|---------|----------|---------|-------------| +| `legend` | boolean | **Yes** | | | +| `tooltip` | boolean | **Yes** | | | +| `viz` | boolean | **Yes** | | | + +### HideableFieldConfig + +TODO docs + +| Property | Type | Required | Default | Description | +|------------|---------------------------------------|----------|---------|-------------| +| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | TODO docs | + +### LineStyle + +TODO docs + +| Property | Type | Required | Default | Description | +|----------|----------|----------|---------|--------------------------------------------------------| +| `dash` | number[] | No | | | +| `fill` | string | No | | Possible values are: `solid`, `dash`, `dot`, `square`. | + +### ScaleDimensionConfig + +It extends [BaseDimensionConfig](#basedimensionconfig). + +| Property | Type | Required | Default | Description | +|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| +| `max` | number | **Yes** | | | +| `min` | number | **Yes** | | | +| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | +| `fixed` | number | No | | | +| `mode` | string | No | | Possible values are: `linear`, `quad`. | + +### TextDimensionConfig + +It extends [BaseDimensionConfig](#basedimensionconfig). + +| Property | Type | Required | Default | Description | +|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| +| `mode` | string | **Yes** | | Possible values are: `fixed`, `field`, `template`. | +| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | +| `fixed` | string | No | | | + ### Options It extends [OptionsWithLegend](#optionswithlegend) and [OptionsWithTooltip](#optionswithtooltip). @@ -77,146 +192,31 @@ TODO docs ### ScatterSeriesConfig -It extends [ScatterFieldConfig](#scatterfieldconfig). +It extends [FieldConfig](#fieldconfig). -| Property | Type | Required | Default | Description | -|---------------------|-----------------------------------------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------| -| `axisCenteredZero` | boolean | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `axisColorMode` | string | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs
Possible values are: `text`, `series`. | -| `axisGridShow` | boolean | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `axisLabel` | string | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `axisPlacement` | string | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | -| `axisSoftMax` | number | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `axisSoftMin` | number | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `axisWidth` | number | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs | -| `labelValue` | [TextDimensionConfig](#textdimensionconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `label` | string | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs
Possible values are: `auto`, `never`, `always`. | -| `lineColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `lineStyle` | [LineStyle](#linestyle) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs | -| `lineWidth` | integer | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
Constraint: `>=0 & <=2147483647`. | -| `name` | string | No | | | -| `pointColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `pointSize` | [ScaleDimensionConfig](#scaledimensionconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs | -| `show` | string | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
Possible values are: `points`, `lines`, `points+lines`. | -| `x` | string | No | | | -| `y` | string | No | | | - -### ColorDimensionConfig - -It extends [BaseDimensionConfig](#basedimensionconfig). - -| Property | Type | Required | Default | Description | -|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| -| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | -| `fixed` | string | No | | | - -### BaseDimensionConfig - -| Property | Type | Required | Default | Description | -|----------|--------|----------|---------|-------------------------------------------| -| `field` | string | No | | fixed: T -- will be added by each element | - -### HideSeriesConfig - -TODO docs - -| Property | Type | Required | Default | Description | -|-----------|---------|----------|---------|-------------| -| `legend` | boolean | **Yes** | | | -| `tooltip` | boolean | **Yes** | | | -| `viz` | boolean | **Yes** | | | - -### LineStyle - -TODO docs - -| Property | Type | Required | Default | Description | -|----------|----------|----------|---------|--------------------------------------------------------| -| `dash` | number[] | No | | | -| `fill` | string | No | | Possible values are: `solid`, `dash`, `dot`, `square`. | - -### ScaleDimensionConfig - -It extends [BaseDimensionConfig](#basedimensionconfig). - -| Property | Type | Required | Default | Description | -|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| -| `max` | number | **Yes** | | | -| `min` | number | **Yes** | | | -| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | -| `fixed` | number | No | | | -| `mode` | string | No | | Possible values are: `linear`, `quad`. | - -### ScaleDistributionConfig - -TODO docs - -| Property | Type | Required | Default | Description | -|-------------------|--------|----------|---------|--------------------------------------------------------------------------| -| `type` | string | **Yes** | | TODO docs
Possible values are: `linear`, `log`, `ordinal`, `symlog`. | -| `linearThreshold` | number | No | | | -| `log` | number | No | | | - -### ScatterFieldConfig - -It extends [HideableFieldConfig](#hideablefieldconfig) and [AxisConfig](#axisconfig). - -| Property | Type | Required | Default | Description | -|---------------------|-----------------------------------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------| -| `axisCenteredZero` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `axisColorMode` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs
Possible values are: `text`, `series`. | -| `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | -| `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | *(Inherited from [HideableFieldConfig](#hideablefieldconfig))*
TODO docs | -| `labelValue` | [TextDimensionConfig](#textdimensionconfig) | No | | | -| `label` | string | No | | TODO docs
Possible values are: `auto`, `never`, `always`. | -| `lineColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | | -| `lineStyle` | [LineStyle](#linestyle) | No | | TODO docs | -| `lineWidth` | integer | No | | Constraint: `>=0 & <=2147483647`. | -| `pointColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | | -| `pointSize` | [ScaleDimensionConfig](#scaledimensionconfig) | No | | | -| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs | -| `show` | string | No | | Possible values are: `points`, `lines`, `points+lines`. | - -### AxisConfig - -TODO docs - -| Property | Type | Required | Default | Description | -|---------------------|-----------------------------------------------------|----------|---------|----------------------------------------------------------------------------------------| -| `axisCenteredZero` | boolean | No | | | -| `axisColorMode` | string | No | | TODO docs
Possible values are: `text`, `series`. | -| `axisGridShow` | boolean | No | | | -| `axisLabel` | string | No | | | -| `axisPlacement` | string | No | | TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | -| `axisSoftMax` | number | No | | | -| `axisSoftMin` | number | No | | | -| `axisWidth` | number | No | | | -| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | TODO docs | - -### HideableFieldConfig - -TODO docs - -| Property | Type | Required | Default | Description | -|------------|---------------------------------------|----------|---------|-------------| -| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | TODO docs | - -### TextDimensionConfig - -It extends [BaseDimensionConfig](#basedimensionconfig). - -| Property | Type | Required | Default | Description | -|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| -| `mode` | string | **Yes** | | Possible values are: `fixed`, `field`, `template`. | -| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | -| `fixed` | string | No | | | +| Property | Type | Required | Default | Description | +|---------------------|-----------------------------------------------------|----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------| +| `axisCenteredZero` | boolean | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `axisColorMode` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs
Possible values are: `text`, `series`. | +| `axisGridShow` | boolean | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `axisLabel` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `axisPlacement` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | +| `axisSoftMax` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `axisSoftMin` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `axisWidth` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs | +| `labelValue` | [TextDimensionConfig](#textdimensionconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `label` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs
Possible values are: `auto`, `never`, `always`. | +| `lineColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `lineStyle` | [LineStyle](#linestyle) | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs | +| `lineWidth` | integer | No | | *(Inherited from [FieldConfig](#fieldconfig))*
Constraint: `>=0 & <=2147483647`. | +| `name` | string | No | | | +| `pointColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `pointSize` | [ScaleDimensionConfig](#scaledimensionconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs | +| `show` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))*
Possible values are: `points`, `lines`, `points+lines`. | +| `x` | string | No | | | +| `y` | string | No | | | ### XYDimensionConfig diff --git a/docs/sources/developers/kinds/composable/xychartpanelcfg/schema-reference.md b/docs/sources/developers/kinds/composable/xychartpanelcfg/schema-reference.md index cdcfffeb885..6d2f3d1c945 100644 --- a/docs/sources/developers/kinds/composable/xychartpanelcfg/schema-reference.md +++ b/docs/sources/developers/kinds/composable/xychartpanelcfg/schema-reference.md @@ -15,13 +15,142 @@ title: XYChartPanelCfg kind | Property | Type | Required | Default | Description | |-----------------------|--------------------------------|----------|---------|---------------------------------------------------------| +| `FieldConfig` | [object](#fieldconfig) | **Yes** | | | | `Options` | [object](#options) | **Yes** | | | -| `ScatterFieldConfig` | [object](#scatterfieldconfig) | **Yes** | | | | `ScatterSeriesConfig` | [object](#scatterseriesconfig) | **Yes** | | | | `ScatterShow` | string | **Yes** | | Possible values are: `points`, `lines`, `points+lines`. | | `SeriesMapping` | string | **Yes** | | Possible values are: `auto`, `manual`. | | `XYDimensionConfig` | [object](#xydimensionconfig) | **Yes** | | | +### FieldConfig + +It extends [HideableFieldConfig](#hideablefieldconfig) and [AxisConfig](#axisconfig). + +| Property | Type | Required | Default | Description | +|---------------------|-----------------------------------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------| +| `axisCenteredZero` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `axisColorMode` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs
Possible values are: `text`, `series`. | +| `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | +| `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | +| `fillOpacity` | number | No | `0.5` | Constraint: `>=0 & <=1`. | +| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | *(Inherited from [HideableFieldConfig](#hideablefieldconfig))*
TODO docs | +| `labelValue` | [TextDimensionConfig](#textdimensionconfig) | No | | | +| `label` | string | No | | TODO docs
Possible values are: `auto`, `never`, `always`. | +| `lineColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | | +| `lineStyle` | [LineStyle](#linestyle) | No | | TODO docs | +| `lineWidth` | integer | No | | Constraint: `>=0 & <=2147483647`. | +| `pointColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | | +| `pointSize` | [ScaleDimensionConfig](#scaledimensionconfig) | No | | | +| `pointSymbol` | [ResourceDimensionConfig](#resourcedimensionconfig) | No | | Links to a resource (image/svg path) | +| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs | +| `show` | string | No | | Possible values are: `points`, `lines`, `points+lines`. | + +### AxisConfig + +TODO docs + +| Property | Type | Required | Default | Description | +|---------------------|-----------------------------------------------------|----------|---------|----------------------------------------------------------------------------------------| +| `axisCenteredZero` | boolean | No | | | +| `axisColorMode` | string | No | | TODO docs
Possible values are: `text`, `series`. | +| `axisGridShow` | boolean | No | | | +| `axisLabel` | string | No | | | +| `axisPlacement` | string | No | | TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | +| `axisSoftMax` | number | No | | | +| `axisSoftMin` | number | No | | | +| `axisWidth` | number | No | | | +| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | TODO docs | + +### ScaleDistributionConfig + +TODO docs + +| Property | Type | Required | Default | Description | +|-------------------|--------|----------|---------|--------------------------------------------------------------------------| +| `type` | string | **Yes** | | TODO docs
Possible values are: `linear`, `log`, `ordinal`, `symlog`. | +| `linearThreshold` | number | No | | | +| `log` | number | No | | | + +### ColorDimensionConfig + +It extends [BaseDimensionConfig](#basedimensionconfig). + +| Property | Type | Required | Default | Description | +|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| +| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | +| `fixed` | string | No | | | + +### BaseDimensionConfig + +| Property | Type | Required | Default | Description | +|----------|--------|----------|---------|-------------------------------------------| +| `field` | string | No | | fixed: T -- will be added by each element | + +### HideSeriesConfig + +TODO docs + +| Property | Type | Required | Default | Description | +|-----------|---------|----------|---------|-------------| +| `legend` | boolean | **Yes** | | | +| `tooltip` | boolean | **Yes** | | | +| `viz` | boolean | **Yes** | | | + +### HideableFieldConfig + +TODO docs + +| Property | Type | Required | Default | Description | +|------------|---------------------------------------|----------|---------|-------------| +| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | TODO docs | + +### LineStyle + +TODO docs + +| Property | Type | Required | Default | Description | +|----------|----------|----------|---------|--------------------------------------------------------| +| `dash` | number[] | No | | | +| `fill` | string | No | | Possible values are: `solid`, `dash`, `dot`, `square`. | + +### ResourceDimensionConfig + +Links to a resource (image/svg path) + +It extends [BaseDimensionConfig](#basedimensionconfig). + +| Property | Type | Required | Default | Description | +|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| +| `mode` | string | **Yes** | | Possible values are: `fixed`, `field`, `mapping`. | +| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | +| `fixed` | string | No | | | + +### ScaleDimensionConfig + +It extends [BaseDimensionConfig](#basedimensionconfig). + +| Property | Type | Required | Default | Description | +|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| +| `max` | number | **Yes** | | | +| `min` | number | **Yes** | | | +| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | +| `fixed` | number | No | | | +| `mode` | string | No | | Possible values are: `linear`, `quad`. | + +### TextDimensionConfig + +It extends [BaseDimensionConfig](#basedimensionconfig). + +| Property | Type | Required | Default | Description | +|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| +| `mode` | string | **Yes** | | Possible values are: `fixed`, `field`, `template`. | +| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | +| `fixed` | string | No | | | + ### Options It extends [OptionsWithLegend](#optionswithlegend) and [OptionsWithTooltip](#optionswithtooltip). @@ -77,146 +206,33 @@ TODO docs ### ScatterSeriesConfig -It extends [ScatterFieldConfig](#scatterfieldconfig). +It extends [FieldConfig](#fieldconfig). -| Property | Type | Required | Default | Description | -|---------------------|-----------------------------------------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------| -| `axisCenteredZero` | boolean | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `axisColorMode` | string | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs
Possible values are: `text`, `series`. | -| `axisGridShow` | boolean | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `axisLabel` | string | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `axisPlacement` | string | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | -| `axisSoftMax` | number | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `axisSoftMin` | number | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `axisWidth` | number | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs | -| `labelValue` | [TextDimensionConfig](#textdimensionconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `label` | string | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs
Possible values are: `auto`, `never`, `always`. | -| `lineColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `lineStyle` | [LineStyle](#linestyle) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs | -| `lineWidth` | integer | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
Constraint: `>=0 & <=2147483647`. | -| `name` | string | No | | | -| `pointColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `pointSize` | [ScaleDimensionConfig](#scaledimensionconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))* | -| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
TODO docs | -| `show` | string | No | | *(Inherited from [ScatterFieldConfig](#scatterfieldconfig))*
Possible values are: `points`, `lines`, `points+lines`. | -| `x` | string | No | | | -| `y` | string | No | | | - -### ColorDimensionConfig - -It extends [BaseDimensionConfig](#basedimensionconfig). - -| Property | Type | Required | Default | Description | -|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| -| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | -| `fixed` | string | No | | | - -### BaseDimensionConfig - -| Property | Type | Required | Default | Description | -|----------|--------|----------|---------|-------------------------------------------| -| `field` | string | No | | fixed: T -- will be added by each element | - -### HideSeriesConfig - -TODO docs - -| Property | Type | Required | Default | Description | -|-----------|---------|----------|---------|-------------| -| `legend` | boolean | **Yes** | | | -| `tooltip` | boolean | **Yes** | | | -| `viz` | boolean | **Yes** | | | - -### LineStyle - -TODO docs - -| Property | Type | Required | Default | Description | -|----------|----------|----------|---------|--------------------------------------------------------| -| `dash` | number[] | No | | | -| `fill` | string | No | | Possible values are: `solid`, `dash`, `dot`, `square`. | - -### ScaleDimensionConfig - -It extends [BaseDimensionConfig](#basedimensionconfig). - -| Property | Type | Required | Default | Description | -|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| -| `max` | number | **Yes** | | | -| `min` | number | **Yes** | | | -| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | -| `fixed` | number | No | | | -| `mode` | string | No | | Possible values are: `linear`, `quad`. | - -### ScaleDistributionConfig - -TODO docs - -| Property | Type | Required | Default | Description | -|-------------------|--------|----------|---------|--------------------------------------------------------------------------| -| `type` | string | **Yes** | | TODO docs
Possible values are: `linear`, `log`, `ordinal`, `symlog`. | -| `linearThreshold` | number | No | | | -| `log` | number | No | | | - -### ScatterFieldConfig - -It extends [HideableFieldConfig](#hideablefieldconfig) and [AxisConfig](#axisconfig). - -| Property | Type | Required | Default | Description | -|---------------------|-----------------------------------------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------| -| `axisCenteredZero` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `axisColorMode` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs
Possible values are: `text`, `series`. | -| `axisGridShow` | boolean | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `axisLabel` | string | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `axisPlacement` | string | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | -| `axisSoftMax` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `axisSoftMin` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `axisWidth` | number | No | | *(Inherited from [AxisConfig](#axisconfig))* | -| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | *(Inherited from [HideableFieldConfig](#hideablefieldconfig))*
TODO docs | -| `labelValue` | [TextDimensionConfig](#textdimensionconfig) | No | | | -| `label` | string | No | | TODO docs
Possible values are: `auto`, `never`, `always`. | -| `lineColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | | -| `lineStyle` | [LineStyle](#linestyle) | No | | TODO docs | -| `lineWidth` | integer | No | | Constraint: `>=0 & <=2147483647`. | -| `pointColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | | -| `pointSize` | [ScaleDimensionConfig](#scaledimensionconfig) | No | | | -| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | *(Inherited from [AxisConfig](#axisconfig))*
TODO docs | -| `show` | string | No | | Possible values are: `points`, `lines`, `points+lines`. | - -### AxisConfig - -TODO docs - -| Property | Type | Required | Default | Description | -|---------------------|-----------------------------------------------------|----------|---------|----------------------------------------------------------------------------------------| -| `axisCenteredZero` | boolean | No | | | -| `axisColorMode` | string | No | | TODO docs
Possible values are: `text`, `series`. | -| `axisGridShow` | boolean | No | | | -| `axisLabel` | string | No | | | -| `axisPlacement` | string | No | | TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | -| `axisSoftMax` | number | No | | | -| `axisSoftMin` | number | No | | | -| `axisWidth` | number | No | | | -| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | TODO docs | - -### HideableFieldConfig - -TODO docs - -| Property | Type | Required | Default | Description | -|------------|---------------------------------------|----------|---------|-------------| -| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | TODO docs | - -### TextDimensionConfig - -It extends [BaseDimensionConfig](#basedimensionconfig). - -| Property | Type | Required | Default | Description | -|----------|--------|----------|---------|--------------------------------------------------------------------------------------------------------------| -| `mode` | string | **Yes** | | Possible values are: `fixed`, `field`, `template`. | -| `field` | string | No | | *(Inherited from [BaseDimensionConfig](#basedimensionconfig))*
fixed: T -- will be added by each element | -| `fixed` | string | No | | | +| Property | Type | Required | Default | Description | +|---------------------|-----------------------------------------------------|----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------| +| `axisCenteredZero` | boolean | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `axisColorMode` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs
Possible values are: `text`, `series`. | +| `axisGridShow` | boolean | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `axisLabel` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `axisPlacement` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs
Possible values are: `auto`, `top`, `right`, `bottom`, `left`, `hidden`. | +| `axisSoftMax` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `axisSoftMin` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `axisWidth` | number | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `fillOpacity` | number | No | `0.5` | *(Inherited from [FieldConfig](#fieldconfig))*
Constraint: `>=0 & <=1`. | +| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs | +| `labelValue` | [TextDimensionConfig](#textdimensionconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `label` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs
Possible values are: `auto`, `never`, `always`. | +| `lineColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `lineStyle` | [LineStyle](#linestyle) | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs | +| `lineWidth` | integer | No | | *(Inherited from [FieldConfig](#fieldconfig))*
Constraint: `>=0 & <=2147483647`. | +| `name` | string | No | | | +| `pointColor` | [ColorDimensionConfig](#colordimensionconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `pointSize` | [ScaleDimensionConfig](#scaledimensionconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))* | +| `pointSymbol` | [ResourceDimensionConfig](#resourcedimensionconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))*
Links to a resource (image/svg path) | +| `scaleDistribution` | [ScaleDistributionConfig](#scaledistributionconfig) | No | | *(Inherited from [FieldConfig](#fieldconfig))*
TODO docs | +| `show` | string | No | | *(Inherited from [FieldConfig](#fieldconfig))*
Possible values are: `points`, `lines`, `points+lines`. | +| `x` | string | No | | | +| `y` | string | No | | | ### XYDimensionConfig diff --git a/packages/grafana-data/src/utils/OptionsUIBuilders.ts b/packages/grafana-data/src/utils/OptionsUIBuilders.ts index 3bd634853e8..e86b7683ad5 100644 --- a/packages/grafana-data/src/utils/OptionsUIBuilders.ts +++ b/packages/grafana-data/src/utils/OptionsUIBuilders.ts @@ -143,6 +143,21 @@ export class FieldConfigEditorBuilder extends OptionsUIRegistryBuilder settings: config.settings || {}, }); } + + addGenericEditor( + config: FieldConfigEditorConfig, // & any... i give up! + editor: (props: StandardEditorProps) => JSX.Element + ): this { + return this.addCustomEditor({ + ...config, + id: config.path, + editor: editor as any, + override: editor as any, + process: identityOverrideProcessor, + shouldApply: config.shouldApply ? config.shouldApply : () => true, + settings: config.settings || {}, + }); + } } export interface NestedValueAccess { diff --git a/packages/grafana-schema/src/raw/composable/xychart/panelcfg/x/XYChartPanelCfg_types.gen.ts b/packages/grafana-schema/src/raw/composable/xychart/panelcfg/x/XYChartPanelCfg_types.gen.ts index 482ac5440c9..c399dabfa32 100644 --- a/packages/grafana-schema/src/raw/composable/xychart/panelcfg/x/XYChartPanelCfg_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/xychart/panelcfg/x/XYChartPanelCfg_types.gen.ts @@ -34,7 +34,7 @@ export const defaultXYDimensionConfig: Partial = { exclude: [], }; -export interface ScatterFieldConfig extends common.HideableFieldConfig, common.AxisConfig { +export interface FieldConfig extends common.HideableFieldConfig, common.AxisConfig { label?: common.VisibilityMode; labelValue?: common.TextDimensionConfig; lineColor?: common.ColorDimensionConfig; @@ -45,12 +45,12 @@ export interface ScatterFieldConfig extends common.HideableFieldConfig, common.A show?: ScatterShow; } -export const defaultScatterFieldConfig: Partial = { +export const defaultFieldConfig: Partial = { label: common.VisibilityMode.Auto, show: ScatterShow.Points, }; -export interface ScatterSeriesConfig extends ScatterFieldConfig { +export interface ScatterSeriesConfig extends FieldConfig { name?: string; x?: string; y?: string; diff --git a/public/app/features/dimensions/editors/ResourcePicker.tsx b/public/app/features/dimensions/editors/ResourcePicker.tsx index 7e00ad6f07f..209403bd3ff 100644 --- a/public/app/features/dimensions/editors/ResourcePicker.tsx +++ b/public/app/features/dimensions/editors/ResourcePicker.tsx @@ -70,7 +70,7 @@ export const ResourcePicker = (props: Props) => { } @@ -109,6 +109,17 @@ export const ResourcePicker = (props: Props) => { ); }; +// strip the SVG off icons in the icons folder +function getDisplayName(src?: string, name?: string): string | undefined { + if (src?.startsWith('public/img/icons')) { + const idx = name?.lastIndexOf('.svg') ?? 0; + if (idx > 0) { + return name!.substring(0, idx); + } + } + return name; +} + const getStyles = (theme: GrafanaTheme2) => ({ pointer: css` cursor: pointer; diff --git a/public/app/plugins/panel/xychart/AutoEditor.tsx b/public/app/plugins/panel/xychart/AutoEditor.tsx index d5f4efe6f5a..b4867f79afe 100644 --- a/public/app/plugins/panel/xychart/AutoEditor.tsx +++ b/public/app/plugins/panel/xychart/AutoEditor.tsx @@ -11,7 +11,7 @@ import { import { Field, IconButton, Select, useStyles2 } from '@grafana/ui'; import { getXYDimensions, isGraphable } from './dims'; -import { XYDimensionConfig, XYChartOptions } from './models.gen'; +import { XYDimensionConfig, Options } from './panelcfg.gen'; interface XYInfo { numberFields: Array>; @@ -19,11 +19,7 @@ interface XYInfo { yFields: Array>; } -export const AutoEditor = ({ - value, - onChange, - context, -}: StandardEditorProps) => { +export const AutoEditor = ({ value, onChange, context }: StandardEditorProps) => { const frameNames = useMemo(() => { if (context?.data?.length) { return context.data.map((f, idx) => ({ diff --git a/public/app/plugins/panel/xychart/ManualEditor.tsx b/public/app/plugins/panel/xychart/ManualEditor.tsx index de00a9acbbb..c4f70e63211 100644 --- a/public/app/plugins/panel/xychart/ManualEditor.tsx +++ b/public/app/plugins/panel/xychart/ManualEditor.tsx @@ -7,7 +7,7 @@ import { FieldNamePicker } from '@grafana/ui/src/components/MatchersUI/FieldName import { LayerName } from 'app/core/components/Layers/LayerName'; import { ColorDimensionEditor, ScaleDimensionEditor } from 'app/features/dimensions/editors'; -import { Options, ScatterSeriesConfig, defaultScatterFieldConfig } from './types'; +import { Options, ScatterSeriesConfig, defaultFieldConfig } from './panelcfg.gen'; export const ManualEditor = ({ value, @@ -33,7 +33,7 @@ export const ManualEditor = ({ ...value, { pointColor: {} as any, - pointSize: defaultScatterFieldConfig.pointSize, + pointSize: defaultFieldConfig.pointSize, }, ]); setSelected(value.length); diff --git a/public/app/plugins/panel/xychart/SymbolEditor.tsx b/public/app/plugins/panel/xychart/SymbolEditor.tsx new file mode 100644 index 00000000000..b7112613385 --- /dev/null +++ b/public/app/plugins/panel/xychart/SymbolEditor.tsx @@ -0,0 +1,31 @@ +import React from 'react'; + +import { StandardEditorProps } from '@grafana/data'; +import { ResourceDimensionConfig, ResourceDimensionMode } from '@grafana/schema'; +import { RadioButtonGroup } from '@grafana/ui'; +import { ResourceDimensionOptions } from 'app/features/dimensions'; + +export const SymbolEditor = ( + props: StandardEditorProps +) => { + const { value } = props; + + const basicSymbols = [ + { value: 'img/icons/marker/circle.svg', label: 'Circle' }, + { value: 'img/icons/marker/square.svg', label: 'Square' }, + ]; + + const onSymbolChange = (v: string) => { + props.onChange({ + fixed: v, + mode: ResourceDimensionMode.Fixed, + }); + }; + + return ( +
+ + {!basicSymbols.find((v) => v.value === value.fixed) &&
{value.fixed}
} +
+ ); +}; diff --git a/public/app/plugins/panel/xychart/TooltipView.tsx b/public/app/plugins/panel/xychart/TooltipView.tsx index d442036c911..bf8256bf309 100644 --- a/public/app/plugins/panel/xychart/TooltipView.tsx +++ b/public/app/plugins/panel/xychart/TooltipView.tsx @@ -6,7 +6,7 @@ import { LinkButton, useStyles2, VerticalGroup, VizTooltipOptions } from '@grafa import { findField } from 'app/features/dimensions'; import { getTitleFromHref } from 'app/features/explore/utils/links'; -import { ScatterSeriesConfig, SeriesMapping } from './models.gen'; +import { ScatterSeriesConfig, SeriesMapping } from './panelcfg.gen'; import { ScatterSeries } from './types'; interface YValue { diff --git a/public/app/plugins/panel/xychart/XYChartPanel.old b/public/app/plugins/panel/xychart/XYChartPanel.old deleted file mode 100644 index 879f8d4ef83..00000000000 --- a/public/app/plugins/panel/xychart/XYChartPanel.old +++ /dev/null @@ -1,71 +0,0 @@ -import React, { useMemo } from 'react'; -import { LegendDisplayMode, UPlotChart, useTheme2, VizLayout, VizLegend, VizLegendItem } from '@grafana/ui'; -import { PanelProps } from '@grafana/data'; -import { XYChartOptions } from './models.gen'; -import { prepData, prepScatter } from './scatter'; - -interface XYChartPanelProps extends PanelProps {} - -export const XYChartPanel = ({ - data, - width, - height, - options, - fieldConfig, - timeRange, - //onFieldConfigChange, -}: XYChartPanelProps) => { - const theme = useTheme2(); - - const info = useMemo(() => { - console.log('prepScatter!'); - return prepScatter(options, data, theme, () => {}); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [data.structureRev, options]); - - // preps data in various shapes...aligned, stacked, merged, interpolated, etc.. - const scatterData = useMemo(() => { - console.log('prepData!'); - return prepData(info, data.series); - }, [info, data.series]); - - const legend = useMemo(() => { - const items: VizLegendItem[] = []; - for (const s of info.series) { - const frame = s.frame(data.series); - if (frame) { - for (const item of s.legend(frame)) { - items.push(item); - } - } - } - - return ( - - - - ); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [info]); - - if (info.error) { - return ( -
-

{info.error}

-
- ); - } - - return ( - - {(vizWidth: number, vizHeight: number) => ( - //
-        //   {JSON.stringify(scatterData, null, 2)}
-        // 
- - {/*children ? children(config, alignedFrame) : null*/} - - )} -
- ); -}; diff --git a/public/app/plugins/panel/xychart/XYChartPanel2.tsx b/public/app/plugins/panel/xychart/XYChartPanel2.tsx index 359d7a0e769..df9cf4b4ccc 100644 --- a/public/app/plugins/panel/xychart/XYChartPanel2.tsx +++ b/public/app/plugins/panel/xychart/XYChartPanel2.tsx @@ -26,9 +26,9 @@ import { FacetedData } from '@grafana/ui/src/components/uPlot/types'; import { CloseButton } from 'app/core/components/CloseButton/CloseButton'; import { TooltipView } from './TooltipView'; -import { SeriesMapping } from './models.gen'; +import { Options, SeriesMapping } from './panelcfg.gen'; import { prepData, prepScatter, ScatterPanelInfo } from './scatter'; -import { Options, ScatterHoverEvent, ScatterSeries } from './types'; +import { ScatterHoverEvent, ScatterSeries } from './types'; type Props = PanelProps; const TOOLTIP_OFFSET = 10; diff --git a/public/app/plugins/panel/xychart/config.ts b/public/app/plugins/panel/xychart/config.ts index a8e267b9735..abd08f15eab 100644 --- a/public/app/plugins/panel/xychart/config.ts +++ b/public/app/plugins/panel/xychart/config.ts @@ -10,11 +10,11 @@ import { commonOptionsBuilder } from '@grafana/ui'; import { LineStyleEditor } from '../timeseries/LineStyleEditor'; -import { ScatterFieldConfig, ScatterShow } from './types'; +import { FieldConfig, ScatterShow } from './panelcfg.gen'; export const DEFAULT_POINT_SIZE = 5; -export function getScatterFieldConfig(cfg: ScatterFieldConfig): SetFieldConfigOptionsArgs { +export function getScatterFieldConfig(cfg: FieldConfig): SetFieldConfigOptionsArgs { return { standardOptions: { [FieldConfigProperty.Min]: { @@ -71,6 +71,25 @@ export function getScatterFieldConfig(cfg: ScatterFieldConfig): SetFieldConfigOp ], }, }) + // .addGenericEditor( + // { + // path: 'pointSymbol', + // name: 'Point symbol', + // defaultValue: defaultFieldConfig.pointSymbol ?? { + // mode: 'fixed', + // fixed: 'img/icons/marker/circle.svg', + // }, + // settings: { + // resourceType: MediaType.Icon, + // folderName: ResourceFolderName.Marker, + // placeholderText: 'Select a symbol', + // placeholderValue: 'img/icons/marker/circle.svg', + // showSourceRadio: false, + // }, + // showIf: (c) => c.show !== ScatterShow.Lines, + // }, + // SymbolEditor // ResourceDimensionEditor + // ) .addSliderInput({ path: 'pointSize.fixed', name: 'Point size', @@ -82,6 +101,17 @@ export function getScatterFieldConfig(cfg: ScatterFieldConfig): SetFieldConfigOp }, showIf: (c) => c.show !== ScatterShow.Lines, }) + // .addSliderInput({ + // path: 'fillOpacity', + // name: 'Fill opacity', + // defaultValue: 0.4, // defaultFieldConfig.fillOpacity, + // settings: { + // min: 0, // hidden? or just outlines? + // max: 1, + // step: 0.05, + // }, + // showIf: (c) => c.show !== ScatterShow.Lines, + // }) .addCustomEditor({ id: 'lineStyle', path: 'lineStyle', diff --git a/public/app/plugins/panel/xychart/dims.ts b/public/app/plugins/panel/xychart/dims.ts index 6d5434b582d..30320448330 100644 --- a/public/app/plugins/panel/xychart/dims.ts +++ b/public/app/plugins/panel/xychart/dims.ts @@ -1,7 +1,7 @@ import { DataFrame, Field, FieldMatcher, FieldType, getFieldDisplayName } from '@grafana/data'; import { XYFieldMatchers } from '@grafana/ui/src/components/GraphNG/types'; -import { XYDimensionConfig } from './types'; +import { XYDimensionConfig } from './panelcfg.gen'; // TODO: fix import diff --git a/public/app/plugins/panel/xychart/models.gen.ts b/public/app/plugins/panel/xychart/models.gen.ts deleted file mode 100644 index 1dcde9abd06..00000000000 --- a/public/app/plugins/panel/xychart/models.gen.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { - OptionsWithTooltip, - OptionsWithLegend, - LineStyle, - VisibilityMode, - HideableFieldConfig, - AxisConfig, - AxisPlacement, - ColorDimensionConfig, - ScaleDimensionConfig, - TextDimensionConfig, -} from '@grafana/schema'; -import { - DimensionSupplier, -} from 'app/features/dimensions'; - -import { DEFAULT_POINT_SIZE } from './config'; - -// export enum ScatterLineMode { -// None = 'none', -// Linear = 'linear', -// Smooth -// r2, etc -// } - -export enum ScatterShow { - Points = 'points', - Lines = 'lines', - PointsAndLines = 'points+lines', -} - -export enum SeriesMapping { - Auto = 'auto', - Manual = 'manual', -} - -export interface ScatterFieldConfig extends HideableFieldConfig, AxisConfig { - show?: ScatterShow; - - lineWidth?: number; - lineStyle?: LineStyle; - lineColor?: ColorDimensionConfig; - - pointSize?: ScaleDimensionConfig; // only 'fixed' is exposed in the UI - pointColor?: ColorDimensionConfig; - pointSymbol?: DimensionSupplier; - - label?: VisibilityMode; - labelValue?: TextDimensionConfig; -} - -/** Configured in the panel level */ -export interface ScatterSeriesConfig extends ScatterFieldConfig { - x?: string; - y?: string; - name?: string; -} - -export const defaultScatterConfig: ScatterFieldConfig = { - show: ScatterShow.Points, - lineWidth: 1, - lineStyle: { - fill: 'solid', - }, - pointSize: { - fixed: DEFAULT_POINT_SIZE, - min: 1, - max: 20, - }, - axisPlacement: AxisPlacement.Auto, -}; - -/** Old config saved with 8.0+ */ -export interface XYDimensionConfig { - frame: number; - x?: string; // name | first - exclude?: string[]; // all other numbers except -} - -export interface XYChartOptions extends OptionsWithLegend, OptionsWithTooltip { - seriesMapping?: SeriesMapping; - dims: XYDimensionConfig; - - series?: ScatterSeriesConfig[]; -} diff --git a/public/app/plugins/panel/xychart/module.tsx b/public/app/plugins/panel/xychart/module.tsx index e1339325850..6fbafbe8aa0 100644 --- a/public/app/plugins/panel/xychart/module.tsx +++ b/public/app/plugins/panel/xychart/module.tsx @@ -5,10 +5,10 @@ import { AutoEditor } from './AutoEditor'; import { ManualEditor } from './ManualEditor'; import { XYChartPanel2 } from './XYChartPanel2'; import { getScatterFieldConfig } from './config'; -import { defaultScatterFieldConfig, Options, ScatterFieldConfig } from './types'; +import { Options, FieldConfig, defaultFieldConfig } from './panelcfg.gen'; -export const plugin = new PanelPlugin(XYChartPanel2) - .useFieldConfig(getScatterFieldConfig(defaultScatterFieldConfig)) +export const plugin = new PanelPlugin(XYChartPanel2) + .useFieldConfig(getScatterFieldConfig(defaultFieldConfig)) .setPanelOptions((builder) => { builder .addRadio({ diff --git a/public/app/plugins/panel/xychart/panelcfg.cue b/public/app/plugins/panel/xychart/panelcfg.cue index e4b37ad59c1..1b12fc4b684 100644 --- a/public/app/plugins/panel/xychart/panelcfg.cue +++ b/public/app/plugins/panel/xychart/panelcfg.cue @@ -39,24 +39,27 @@ composableKinds: PanelCfg: { exclude?: [...string] } @cuetsy(kind="interface") - ScatterFieldConfig: { + FieldConfig: { common.HideableFieldConfig common.AxisConfig show?: ScatterShow & (*"points" | _) pointSize?: common.ScaleDimensionConfig - lineColor?: common.ColorDimensionConfig pointColor?: common.ColorDimensionConfig - labelValue?: common.TextDimensionConfig + // pointSymbol?: common.ResourceDimensionConfig + // fillOpacity?: number & >=0 & <=1 | *0.5 + lineColor?: common.ColorDimensionConfig lineWidth?: int32 & >=0 lineStyle?: common.LineStyle - label?: common.VisibilityMode & (*"auto" | _) + + label?: common.VisibilityMode & (*"auto" | _) + labelValue?: common.TextDimensionConfig } @cuetsy(kind="interface",TSVeneer="type") ScatterSeriesConfig: { - ScatterFieldConfig + FieldConfig x?: string y?: string name?: string diff --git a/public/app/plugins/panel/xychart/panelcfg.gen.ts b/public/app/plugins/panel/xychart/panelcfg.gen.ts index 21b8d86114d..7a835a614a2 100644 --- a/public/app/plugins/panel/xychart/panelcfg.gen.ts +++ b/public/app/plugins/panel/xychart/panelcfg.gen.ts @@ -31,7 +31,7 @@ export const defaultXYDimensionConfig: Partial = { exclude: [], }; -export interface ScatterFieldConfig extends common.HideableFieldConfig, common.AxisConfig { +export interface FieldConfig extends common.HideableFieldConfig, common.AxisConfig { label?: common.VisibilityMode; labelValue?: common.TextDimensionConfig; lineColor?: common.ColorDimensionConfig; @@ -42,12 +42,12 @@ export interface ScatterFieldConfig extends common.HideableFieldConfig, common.A show?: ScatterShow; } -export const defaultScatterFieldConfig: Partial = { +export const defaultFieldConfig: Partial = { label: common.VisibilityMode.Auto, show: ScatterShow.Points, }; -export interface ScatterSeriesConfig extends ScatterFieldConfig { +export interface ScatterSeriesConfig extends FieldConfig { name?: string; x?: string; y?: string; diff --git a/public/app/plugins/panel/xychart/scatter.ts b/public/app/plugins/panel/xychart/scatter.ts index 470fad03cb5..8acf8071d6b 100644 --- a/public/app/plugins/panel/xychart/scatter.ts +++ b/public/app/plugins/panel/xychart/scatter.ts @@ -30,15 +30,8 @@ import { pointWithin, Quadtree, Rect } from '../barchart/quadtree'; import { DEFAULT_POINT_SIZE } from './config'; import { isGraphable } from './dims'; -import { - DimensionValues, - ScatterFieldConfig, - defaultScatterFieldConfig, - ScatterHoverCallback, - ScatterSeries, - Options, - ScatterShow, -} from './types'; +import { FieldConfig, defaultFieldConfig, Options, ScatterShow } from './panelcfg.gen'; +import { DimensionValues, ScatterHoverCallback, ScatterSeries } from './types'; export interface ScatterPanelInfo { error?: string; @@ -111,7 +104,7 @@ function getScatterSeries( ? config.theme2.visualization.getColorByName(dims.pointColorFixed) : getFieldSeriesColor(y, config.theme2).color; let pointColor: DimensionValues = () => seriesColor; - const fieldConfig: ScatterFieldConfig = { ...defaultScatterFieldConfig, ...y.config.custom }; + const fieldConfig: FieldConfig = { ...defaultFieldConfig, ...y.config.custom }; let pointColorMode = fieldColorModeRegistry.get(FieldColorModeId.PaletteClassic); if (dims.pointColorIndex) { const f = frames[frameIndex].fields[dims.pointColorIndex]; @@ -301,7 +294,7 @@ interface DrawBubblesOpts { }; } -//const prepConfig: UPlotConfigPrepFnXY = ({ frames, series, theme }) => { +//const prepConfig: UPlotConfigPrepFnXY = ({ frames, series, theme }) => { const prepConfig = ( getData: () => DataFrame[], scatterSeries: ScatterSeries[], diff --git a/public/app/plugins/panel/xychart/types.ts b/public/app/plugins/panel/xychart/types.ts index c6302feff32..bd44ef4b27e 100644 --- a/public/app/plugins/panel/xychart/types.ts +++ b/public/app/plugins/panel/xychart/types.ts @@ -1,14 +1,6 @@ import { DataFrame, Field, FieldColorMode } from '@grafana/data'; import { LineStyle, ScaleDimensionConfig, VisibilityMode } from '@grafana/schema'; import { VizLegendItem } from '@grafana/ui'; -import { DimensionSupplier } from 'app/features/dimensions'; - -import { - ScatterFieldConfig as GeneratedScatterFieldConfig, - ScatterSeriesConfig as GeneratedScatterSeriesConfig, - defaultScatterFieldConfig as generatedDefaultScatterFieldConfig, - Options as GeneratedOptions, -} from './panelcfg.gen'; /** * @internal @@ -24,20 +16,6 @@ export interface ScatterHoverEvent { export type ScatterHoverCallback = (evt?: ScatterHoverEvent) => void; -export interface ScatterFieldConfig extends GeneratedScatterFieldConfig { - pointSymbol?: DimensionSupplier; -} - -export const defaultScatterFieldConfig: Partial = { - ...generatedDefaultScatterFieldConfig, -}; - -export interface ScatterSeriesConfig extends ScatterFieldConfig, GeneratedScatterSeriesConfig {} - -export interface Options extends Omit { - series: ScatterSeriesConfig[]; -} - // Using field where we will need formatting/scale/axis info // Use raw or DimensionValues when the values can be used directly export interface ScatterSeries { @@ -72,5 +50,3 @@ export interface ScatterSeries { }; }; } - -export { ScatterShow, SeriesMapping, XYDimensionConfig } from './panelcfg.gen'; diff --git a/public/img/icons/marker/square.svg b/public/img/icons/marker/square.svg index 856cd02fca3..1f101d799cd 100644 --- a/public/img/icons/marker/square.svg +++ b/public/img/icons/marker/square.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + \ No newline at end of file