@grafana/data APIs
- SelectableValue
- DataQuery
- DataSourceJsonData
- PanelProps
- PanelPlugin
- DataFrame
- DataSourcePluginOptionsEditorProps
- DataSourceInstanceSettings
- FieldType
- DataSourcePlugin
- DataSourceApi
- MetricFindValue
- PanelEditorProps
- GrafanaTheme
- getDisplayProcessor
- DataQueryError
- DataQueryRequest
- DataQueryResponse
- MutableDataFrame
- ArrayVector
- LoadingState
- KeyValue
- AppPluginMeta
- PluginMeta
- AppPlugin
- NavModelItem
- ThresholdsMode
- DisplayValue
- formattedValueToString
- FieldConfig
- FieldColorMode
- GraphSeriesValue
- FieldDisplayOptions
- GraphSeriesXY
- TimeZone
- MS_DATE_TIME_FORMAT
- DEFAULT_DATE_TIME_FORMAT
- ReducerID
- AppEvents
- DataSourceSelectItem
- NullValueMode
- getFlotPairs
- getValueFormat
- AbsoluteTimeRange
- AnnotationEvent
- PanelData
- getTimeField
- reduceField
- getSeriesTimeStep
- hasMsResolution
- FieldColor
- MutableField
- AppRootProps
- GrafanaThemeType
- PanelPluginMeta
- ScopedVars
- PluginBuildInfo
- PluginState
- VizOrientation
- Field
- TimeSeriesValue
- FormattedValue
- DisplayValueAlignmentFactors
- getColorFromHexRgbOrName
- getColorDefinitionByName
- getNamedColorPalette
- getColorName
- getColorForTheme
- deprecationWarning
- DataLink
- VariableSuggestion
- VariableOrigin
- LinkModelSupplier
- DataSourceSettings
- applyFieldOverrides
- FieldConfigSource
- InterpolateFunction
- FieldMatcherID
- toDataFrame
- standardFieldConfigEditorRegistry
- FieldOverrideContext
- FieldConfigEditorProps
- FieldOverrideEditorProps
- ValueMapping
- toIntegerOrUndefined
- toFloatOrUndefined
- FieldPropertyEditorItem
- ThresholdsConfig
- getActiveThreshold
- Threshold
- dateTime
- TimeRange
- DefaultTimeZone
- createDimension
- DateTimeInput
- FlotDataPoint
- getValueFromDimension
- getColumnFromDimension
- FieldCache
- LogRowModel
- LogLevel
- calculateFieldStats
- calculateLogsLabelStats
- calculateStats
- getParser
- LinkModel
- Labels
- findHighlightChunksInText
- LogsDedupStrategy
- fieldMatchers
- Registry
- stringToMs
- DEFAULT_FIELD_DISPLAY_VALUES_LIMIT
- toNumberString
- VAR_SERIES_NAME
- VAR_FIELD_NAME
- VAR_CALC
- VAR_CELL_PREFIX
- fieldReducers
- sortThresholds
- MappingType
- PanelModel
- ConfigOverrideRule
- validateFieldConfig
- readCSV
- DateTime
- dateTimeAsMoment
- TimeFragment
- isDateTime
- rangeUtil
- TIME_FORMAT
- TimeOption
- dateMath
- dateTimeForTimeZone
- getTimeZoneGroups
- RawTimeRange
- FilterFieldsByNameTransformerOptions
- DataTransformerID
- transformersRegistry
- FilterFramesByRefIdTransformerOptions
- ReduceTransformerOptions
- DataTransformerConfig
- transformDataFrame
- getValueFormats
- GrafanaThemeCommons
- setLocale
- setMarkdownOptions
- escapeStringForRegex
- unEscapeStringFromRegex
- UserOrgDTO
- NavModel
- NavModelBreadcrumb
- renderMarkdown
- LogsMetaKind
- findCommonLabels
- findUniqueLabels
- getLogLevel
- getLogLevelFromKey
- LogsModel
- LogsMetaItem
- toUtc
- FieldWithIndex
- NavIndex
- PanelEvents
- OrgRole
- eventFactory
- TableData
- Column
- ValueFormatter
- stringToJsRegex
- DecimalCount
- AppEvent
- ExploreMode
- CoreApp
- HistoryItem
- IntervalValues
- toCSV
- DynamicConfigValue
- FieldConfigEditorRegistry
- VariableSuggestionsScope
- DefaultTimeRange
- toDataFrameDTO
- PanelMenuItem
- PluginType
- toLegacyResponseData
- DataQueryResponseData
- guessFieldTypes
- DataSourcePluginMeta
- DataSourceConstructor
- PluginInclude
- PluginMetaInfo
- toDuration
- LogsDedupDescription
- QueryFixAction
- TimeSeries
- LegacyResponseData
- AngularPanelMenuItem
- FieldDisplay
- DataFrameView
- GrafanaPlugin
- PluginDependencies
- PluginIncludeType
- onUpdateDatasourceJsonDataOptionSelect
- onUpdateDatasourceOption
- onUpdateDatasourceResetOption
- onUpdateDatasourceJsonDataOption
- onUpdateDatasourceSecureJsonDataOption
- updateDatasourcePluginOption
- updateDatasourcePluginResetOption
- updateDatasourcePluginJsonDataOption
- updateDatasourcePluginSecureJsonDataOption
- ExploreStartPageProps
- DataFrameDTO
- AnnotationQueryRequest
- LanguageProvider
- formatLabels
- parseLabels
- CircularDataFrame
- QueryHint
- isDataFrame
- QueryFix
- CSVReader
- DurationUnit
- getFieldDisplayValues
- getDisplayValueAlignmentFactors
- getFlotPairsConstant
- CreatePlotOverlay
- isTableData
- stringStartsAsRegEx
- base64StringToArrowTable
- arrowTableToDataFrame
- FieldConfigProperty
Other Related APIs
- @storybook/addon-knobs#number
- @grafana/data#MutableDataFrame
- @grafana/data#FieldType
- @grafana/data#DataFrame
- @grafana/data#GrafanaTheme
- @grafana/data#VizOrientation
- @grafana/data#ThresholdsMode
- @grafana/data#FieldConfig
- @grafana/data#FieldColorMode
- @grafana/data#applyFieldOverrides
- @grafana/data#FieldMatcherID
- @grafana/data#FieldDisplayOptions
- @grafana/data#ValueMapping
- @grafana/data#ThresholdsConfig
- @grafana/data#Threshold
- @grafana/data#ReducerID
- @grafana/data#fieldReducers
- @grafana/data#sortThresholds
- @grafana/data#MappingType
- @grafana/data#PanelModel
- @grafana/data#validateFieldConfig
@grafana/data#ConfigOverrideRule TypeScript Examples
The following examples show how to use
@grafana/data#ConfigOverrideRule.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SingleStatBaseOptions.ts From grafana-chinese with Apache License 2.0 | 5 votes |
export function sharedSingleStatPanelChangedHandler(
options: Partial<SingleStatBaseOptions> | any,
prevPluginId: string,
prevOptions: any
) {
// Migrating from angular singlestat
if (prevPluginId === 'singlestat' && prevOptions.angular) {
const panel = prevOptions.angular;
const reducer = fieldReducers.getIfExists(panel.valueName);
const options = {
fieldOptions: {
defaults: {} as FieldConfig,
overrides: [] as ConfigOverrideRule[],
calcs: [reducer ? reducer.id : ReducerID.mean],
},
orientation: VizOrientation.Horizontal,
};
const defaults = options.fieldOptions.defaults;
if (panel.format) {
defaults.unit = panel.format;
}
if (panel.nullPointMode) {
defaults.nullValueMode = panel.nullPointMode;
}
if (panel.nullText) {
defaults.noValue = panel.nullText;
}
if (panel.decimals || panel.decimals === 0) {
defaults.decimals = panel.decimals;
}
// Convert thresholds and color values
if (panel.thresholds && panel.colors) {
const levels = panel.thresholds.split(',').map((strVale: string) => {
return Number(strVale.trim());
});
// One more color than threshold
const thresholds: Threshold[] = [];
for (const color of panel.colors) {
const idx = thresholds.length - 1;
if (idx >= 0) {
thresholds.push({ value: levels[idx], color });
} else {
thresholds.push({ value: -Infinity, color });
}
}
defaults.thresholds = {
mode: ThresholdsMode.Absolute,
steps: thresholds,
};
}
// Convert value mappings
const mappings = convertOldAngularValueMapping(panel);
if (mappings && mappings.length) {
defaults.mappings = mappings;
}
if (panel.gauge && panel.gauge.show) {
defaults.min = panel.gauge.minValue;
defaults.max = panel.gauge.maxValue;
}
return options;
}
for (const k of optionsToKeep) {
if (prevOptions.hasOwnProperty(k)) {
options[k] = cloneDeep(prevOptions[k]);
}
}
return options;
}
Example #2
Source File: Table.story.tsx From grafana-chinese with Apache License 2.0 | 5 votes |
function buildData(theme: GrafanaTheme, overrides: ConfigOverrideRule[]): DataFrame {
const data = new MutableDataFrame({
fields: [
{ name: 'Time', type: FieldType.time, values: [] }, // The time field
{
name: 'Quantity',
type: FieldType.number,
values: [],
config: {
decimals: 0,
custom: {
align: 'center',
},
},
},
{ name: 'Status', type: FieldType.string, values: [] }, // The time field
{
name: 'Value',
type: FieldType.number,
values: [],
config: {
decimals: 2,
},
},
{
name: 'Progress',
type: FieldType.number,
values: [],
config: {
unit: 'percent',
custom: {
width: 100,
},
},
},
],
});
for (let i = 0; i < 1000; i++) {
data.appendRow([
new Date().getTime(),
Math.random() * 2,
Math.random() > 0.7 ? 'Active' : 'Cancelled',
Math.random() * 100,
Math.random() * 100,
]);
}
return applyFieldOverrides({
data: [data],
fieldOptions: {
overrides,
defaults: {},
},
theme,
replaceVariables: (value: string) => value,
})[0];
}