Replies: 1 comment 1 reply
-
Usually the refId is located at
To me, it sounds like redId "mHits" doesn't exist.
Not really. If you want to get the series with the refId from the query, that's the easiest. The above might not be of much help, but if you can create a minimal example of your data.series object, I can guide you a bit more. Don't add any sensitive information. Try to replace your values with some random stuff or create it from scratch. Example data.series object: [
{
"refId": "A",
"fields": [
{
"name": "time",
"type": "time",
"values": [
1698412519789
],
"state": {
"seriesIndex": 0
}
},
{
"name": "Something",
"type": "number",
"values": [
1
],
"state": {
"seriesIndex": 0,
"range": {
"min": 1,
"max": 1,
"delta": 0
},
"calcs": {
"sum": 1,
"max": 1,
"min": 1,
"logmin": 1,
"mean": 1,
"last": 1,
"first": 1,
"lastNotNull": 1,
"firstNotNull": 1,
"count": 1,
"nonNullCount": 1,
"allIsNull": false,
"allIsZero": false,
"range": 0,
"diff": 0,
"delta": 0,
"step": null,
"diffperc": 0,
"previousDeltaUp": true
},
"displayName": "Something",
"multipleFrames": true
}
}
],
"length": 1
},
{
"refId": "B",
"fields": [
{
"name": "time",
"type": "time",
"values": [
1698412519789
],
"state": {
"seriesIndex": 1
}
},
{
"name": "Something",
"type": "number",
"values": [
1
],
"state": {
"calcs": {
"sum": 1,
"max": 1,
"min": 1,
"logmin": 1,
"mean": 1,
"last": 1,
"first": 1,
"lastNotNull": 1,
"firstNotNull": 1,
"count": 1,
"nonNullCount": 1,
"allIsNull": false,
"allIsZero": false,
"range": 0,
"diff": 0,
"delta": 0,
"step": null,
"diffperc": 0,
"previousDeltaUp": true
},
"seriesIndex": 1,
"range": {
"min": 1,
"max": 1,
"delta": 0
},
"displayName": "Something",
"multipleFrames": true
}
}
],
"length": 1
}
] |
Beta Was this translation helpful? Give feedback.
-
I have a panel with numerous queries, each of which returns a single data set consisting of path names within our portal and various single value metrics (page hit count, percentile load time, HTTP error count, etc.). I access each query by
refId
and retrieve the path names and values similar to the following (this is simplified from the real code for illustration):I can then align all the data from the various queries by the path names into a nice table format.
I now have to add a different type of query that returns only timeseries data sets, one for each path name. In a stand-alone panel, I can get this to also work out by cycling thru all the data sets to retrieve the path names and sum the timeseries values as follows:
Referencing the
refId
of all the data sets (i.e.data.series[i].fields[1].refId
) show they all have the same name (therefId
of the original query).In order to integrate this query into the first panel, I need to access the query by name. If I try to access the query by
refId
as I do for the other queries, and then ask for the path name and a count:it gives me path name and the number of entries in the first dataset. Any attempt to use array notation with mHitsQ to get at the other data sets generate an error.
I know I can loop through the entire array of data sets in
data.series
and find the ones related to this query'srefId
, but is there a more efficient access by name syntax I am missing that will return an array of only those data sets associated with therefID
?Beta Was this translation helpful? Give feedback.
All reactions