mirror of
https://github.com/grafana/grafana.git
synced 2025-09-25 10:04:04 +08:00
Geomap: implement basic tooltip support (#37318)
Co-authored-by: Bryan Uribe <buribe@hmc.edu>
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import React, { Component } from 'react';
|
||||
import {
|
||||
EventBus,
|
||||
LegacyGraphHoverEvent,
|
||||
@ -7,8 +8,9 @@ import {
|
||||
DataHoverPayload,
|
||||
BusEventWithPayload,
|
||||
} from '@grafana/data';
|
||||
import React, { Component } from 'react';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { CustomScrollbar } from '@grafana/ui';
|
||||
import { DataHoverView } from '../geomap/components/DataHoverView';
|
||||
|
||||
interface Props {
|
||||
eventBus: EventBus;
|
||||
@ -58,12 +60,16 @@ export class CursorView extends Component<Props, State> {
|
||||
if (!event) {
|
||||
return <div>no events yet</div>;
|
||||
}
|
||||
const { type, payload, origin } = event;
|
||||
return (
|
||||
<div>
|
||||
<h2>Origin: {(event.origin as any)?.path}</h2>
|
||||
<span>Type: {event.type}</span>
|
||||
<pre>{JSON.stringify(event.payload.point, null, ' ')}</pre>
|
||||
</div>
|
||||
<CustomScrollbar autoHeightMin="100%" autoHeightMax="100%">
|
||||
<h3>Origin: {(origin as any)?.path}</h3>
|
||||
<span>Type: {type}</span>
|
||||
<pre>{JSON.stringify(payload.point, null, ' ')}</pre>
|
||||
{payload.data && (
|
||||
<DataHoverView data={payload.data} rowIndex={payload.rowIndex} columnIndex={payload.columnIndex} />
|
||||
)}
|
||||
</CustomScrollbar>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user