Skip to content

Commit

Permalink
Docs: Clarify info on converting dataframes from long to wide (#1379)
Browse files Browse the repository at this point in the history
  • Loading branch information
josmperez authored Dec 12, 2024
1 parent 8cba0a7 commit 70dcd9a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions docusaurus/docs/key-concepts/data-frames.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,22 @@ Some data sources return data in a _long_ format (also called _narrow_ format).

In the long format, string values are represented as separate fields rather than as labels. As a result, a data form in long form may have duplicated time values.

Grafana can detect and convert data frames in long format into wide format.
With the Grafana plugin SDK for Go, a plugin can detect can detect and convert data frames in long format into wide format.

For detecting and converting a data frame, refer to this example:

```go
tsSchema := frame.TimeSeriesSchema()
if tsSchema.Type == data.TimeSeriesTypeLong {
wideFrame, err := data.LongToWide(frame, nil)
if err == nil {
// handle error
}
// return wideFrame
}
```

For example, the following data frame appears in long format:
Here's an additional example. The following data frame appears in long format:

```text
Name: Long
Expand Down

0 comments on commit 70dcd9a

Please sign in to comment.