'Grafana - get query name in TypeScript + React
I'm building a Grafana custom panel plugin with TypeScript + React.
I would like to get the name of every query but for some reason all I get is undefined. The query name will be used to display it in the panel.
Is there something I'm doing wrong?
This example/snippet shows how I try to get the query name:
import React from 'react';
import { PanelProps } from '@grafana/data';
import _ from 'lodash';
import { css } from 'emotion';
import { SimpleOptions } from 'types';
interface Props extends PanelProps<SimpleOptions> {}
export class SimplePanel extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
}
render() {
const { data, options } = this.props;
_.forEach(data.series, (series, index) => {
console.log('Series name: ' + series.name);
});
return <someHTML>
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

