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 |