Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
@grafana/data package
A library containing most of the core functionality and data types used in Grafana.
Classes
Enumerations
Functions
compareArrayValues(a, b, framesHaveSameStructure);
NOTE: this does a shallow check on the FieldConfig properties, when using the query editor, this should be sufficient, however if applicaitons are mutating properties deep in the FieldConfig this will not recognize a change |
| doStandardCalcs(field, ignoreNulls, nullAsZero) | |
| eventFactory(name) | |
| findCommonLabels(labelsSets) | Returns a map labels that are common to the given label sets. |
| findHighlightChunksInText({ searchWords, textToHighlight, }) | Adapt findMatchesInText for react-highlight-words findChunks handler. See https://github.com/bvaughn/react-highlight-words#props |
| findMatchesInText(haystack, needle) | Returns a list of substring regexp matches. |
| findUniqueLabels(labels, commonLabels) | Returns a map of labels that are in labels
, but not in commonLabels
. |
| formatLabels(labels, defaultValue, withoutBraces) | Serializes the given labels to a string. |
| formattedValueToString(val) | |
| getActiveThreshold(value, thresholds) | |
| getColorDefinitionByName(name) | |
| getColorForTheme(color, theme) | |
| getColorFromHexRgbOrName(color, type) | |
| getDataFrameRow(data, row) | Wrapper to get an array from each field value |
| getDefaultTimeRange() | |
| getDisplayProcessor(options) | |
| getDisplayValueAlignmentFactors(values) | |
| getFieldColorMode(mode) | |
| getFieldColorModeForField(field) | |
| getFieldDisplayName(field, frame, allFrames) | |
| getFieldMatcher(config) | Resolves a field matcher from the registry for given config. Will throw an error if matcher can not be resolved. |
| getFlotPairs({ xField, yField, nullValueMode }) | |
| getFlotPairsConstant(seriesData, range) | Returns a constant series based on the first value from the provide series. |
| getFrameDisplayName(frame, index) | Get an appropriate display title |
| getFrameMatchers(config) | Resolves a frame matcher from the registry for given config. Will throw an error if matcher can not be resolved. |
| getLogLevel(line) | Returns the log level of a log line. Parse the line for level words. If no level is found, it returns LogLevel.unknown
.Example: getLogLevel(‘WARN 1999-12-31 this is great’) // LogLevel.warn
|
| getLogLevelFromKey(key) | |
| getParser(line) | |
| getRawDisplayProcessor() | |
| getScaleCalculator(field, theme) | |
| getValueFormat(id) | |
| getValueFormats() | |
| getValueFormatterIndex() | |
| getValueMatcher(config) | Resolves a value matcher from the registry for given config. Will throw an error if matcher can not be resolved. |
| grafanaDataFrameToArrowTable(data, keepOriginalNames) | |
| guessFieldTypeForField(field) | Looks at the data to guess the column type. This ignores any existing setting |
| guessFieldTypeFromNameAndValue(name, v) | Given a name and value, this will pick a reasonable field type |
| guessFieldTypeFromValue(v) | Given a value this will guess the best column typeTODO: better Date/Time support! Look for standard date strings? |
| hasLinks(field) | |
| isLiveChannelJoinEvent(evt) | |
| isLiveChannelLeaveEvent(evt) | |
| isLiveChannelMessageEvent(evt) | |
| isLiveChannelStatusEvent(evt) | |
| isValidLiveChannelAddress(addr) | Check if the address has a scope, namespace, and path |
| locale(value, decimals) | |
| localTimeFormat(options, locale, fallback) | localTimeFormat helps to generate date formats for momentjs based on browser’s locale |
| mapInternalLinkToExplore(options) | |
| matchAllLabels(expect, against) | Check that all labels exist in another set of labels |
| outerJoinDataFrames(options) | This will return a single frame joined by the first matching field. When a join field is not specified, the default will use the first time field |
| parseFlags(text) | Converts any mode modifiers in the text to the Javascript equivalent flag |
| parseLabels(labels) | Returns a map of label keys to value from an input selector string.Example: parseLabels(’{job="foo", instance="bar"}) // {job: "foo", instance: "bar"}
|
| readCSV(csv, options) | |
| reduceField(options) | |
| renderMarkdown(str, options) | |
| reverseDataFrame(data) | Returns a copy with all values reversed |
| scaledUnits(factor, extArray) | |
| serializeStateToUrlParam(urlState, compact) | |
| shallowCompare(a, b, cmp) | (BETA) Checks if two objects are equal shallowly |
| simpleCountUnit(symbol) | |
| sortDataFrame(data, sortIndex, reverse) | |
| sortThresholds(thresholds) | Sorts the thresholds |
| stringFormater(value) | |
| stringStartsAsRegEx(str) | |
| stringToJsRegex(str) | |
| stringToMs(str) | |
| toCSV(data, config) | |
| toDataFrame(data) | Inspect any object and return the results as a DataFrame |
| toDataFrameDTO(data) | Returns a copy that does not include functions |
| toFixed(value, decimals) | |
| toFixedScaled(value, decimals, ext) | |
| toFixedUnit(unit, asPrefix) | |
| toFloatOrUndefined(value) | |
| toIntegerOrUndefined(value) | |
| toNumberString(value) | |
| transformDataFrame(options, data) | Apply configured transformations to the input data |
| updateDatasourcePluginOption(props, key, val) | |
| validateFieldConfig(config) | This checks that all options on FieldConfig make sense. It mutates any value that needs fixed. In particular this makes sure that the first threshold value is -Infinity (not valid in JSON) |
| vectorator(vector) | Use functional programming with your vector |
Interfaces
Namespaces
Variables
Variable | Description |
---|
AppEvents | |
binaryOperators | |
booleanOverrideProcessor | |
checkLogsError | |
classicColors | |
createDimension | |
DataLinkBuiltInVars | |
dataLinksOverrideProcessor | |
dateTime | |
dateTimeAsMoment | |
dateTimeFormat | Helper function to format date and time according to the specified options. If no options are supplied, then default values are used. For more details, see DateTimeOptionsWithFormat. |
dateTimeFormatISO | Helper function to format date and time according to the standard ISO format e.g. 2013-02-04T22:44:30.652Z. If no options are supplied, then default values are used. For more details, see DateTimeOptionsWithFormat. |
dateTimeFormatTimeAgo | Helper function to return elapsed time since passed date. The returned value will be formatted in a human readable format e.g. 4 years ago. If no options are supplied, then default values are used. For more details, see DateTimeOptions. |
dateTimeFormatWithAbbrevation | Helper function to format date and time according to the Grafana default formatting, but it also appends the time zone abbreviation at the end e.g. 2020-05-20 13:37:00 CET. If no options are supplied, then default values are used. For more details please see DateTimeOptions. |
dateTimeForTimeZone | |
dateTimeParse | Helper function to parse a number, text or Date to a DateTime value. If a timeZone is supplied the incoming value is parsed with that timeZone as a base. The only exception to this is if the passed value is in a UTC-based format. Then it will use UTC as the base. If no format is specified the current system format will be assumed.It can also parse the Grafana quick date and time format, e.g. now-6h will be parsed as Date.now() - 6 hours and returned as a valid DateTime value.If no options are supplied, then default values are used. For more details please see DateTimeOptions. |
DEFAULT_FIELD_DISPLAY_VALUES_LIMIT | |
DefaultTimeZone | |
deprecationWarning | |
escapeStringForRegex | |
escapeUnescapedString | |
FALLBACK_COLOR | |
fieldColorModeRegistry | |
fieldMatchers | Registry that contains all of the built in field matchers. |
fieldReducers | |
frameMatchers | Registry that contains all of the built in frame matchers. |
getAllValuesFromDimension | |
getColumnFromDimension | |
getColumnsFromDimension | |
getDimensionByName | |
getFieldDisplayValues | |
getLocale | |
getLocaleData | |
getMappedValue | |
getNamedColorPalette | |
getSeriesTimeStep | Returns minimal time step from series time field |
getTimeField | |
getTimeZoneGroups | |
getTimeZoneInfo | |
getTimeZones | |
getValueFromDimension | |
guessFieldTypes | |
hasMsResolution | Checks if series time field has ms resolution |
identityOverrideProcessor | |
isDataFrame | |
isDateTime | |
ISO_8601 | |
isTableData | |
locationUtil | |
LogsParsers | |
MISSING_VALUE | |
numberOverrideProcessor | |
objRemoveUndefined | |
onUpdateDatasourceJsonDataOption | |
onUpdateDatasourceJsonDataOptionChecked | |
onUpdateDatasourceJsonDataOptionSelect | |
onUpdateDatasourceOption | |
onUpdateDatasourceResetOption | |
onUpdateDatasourceSecureJsonDataOption | |
onUpdateDatasourceSecureJsonDataOptionSelect | |
PanelEvents | |
selectOverrideProcessor | |
setLocale | |
sortInAscendingOrder | |
sortInDescendingOrder | |
sortLogRows | |
sortLogsResult | |
standardEditorsRegistry | |
standardFieldConfigEditorRegistry | |
standardTransformers | |
standardTransformersRegistry | Registry of transformation options that can be driven by stored configuration files. |
stringOverrideProcessor | |
systemDateFormats | |
textUtil | |
thresholdsOverrideProcessor | |
TIME_FORMAT | |
TIME_SERIES_METRIC_FIELD_NAME | |
TIME_SERIES_TIME_FIELD_NAME | |
TIME_SERIES_VALUE_FIELD_NAME | |
timeZoneAbbrevation | Helper function to return only the time zone abbreviation for a given date and time value. If no options are supplied, then default values are used. For more details please see DateTimeOptions. |
timeZoneFormatUserFriendly | |
toDuration | |
toLegacyResponseData | |
toPascalCase | |
toUtc | |
unEscapeStringFromRegex | |
unitOverrideProcessor | |
updateDatasourcePluginJsonDataOption | |
updateDatasourcePluginResetOption | |
updateDatasourcePluginSecureJsonDataOption | |
urlUtil | |
valueMappingsOverrideProcessor | |
valueMatchers | Registry that contains all of the built in value matchers. |
VAR_CALC | |
VAR_CELL_PREFIX | |
VAR_FIELD_LABELS | |
VAR_FIELD_NAME | |
VAR_SERIES_NAME | |
Type Aliases