Renders a table row cell showing a sparkline. Sparklines can either come from a NRQL query (thus providing accountId
and query
), or from a predefined data
passed in the chart format. In either case, all props are 1:1 compatible with the <NrqlQuery>
format type CHART
.
A common case to render one row per NRQL facet, is to perform the query outside of the table, then pass the result as items (returned data from a <NrqlQuery>
is an array, that can be directly used as the input items of a table). Once rendering the sparkline, you need to re-wrap the data in an array, in order to build, from a series, a new entire set of data.
Usage
import { SparklineTableRowCell } from 'nr1'
Examples
Example 1
function render() { const items = [ { accountId: 1, query: "SELECT count(*) FROM Transaction WHERE metric = '…' TIMESERIES", }, ];
return ( <Table items={items}> <TableHeader> <TableHeaderCell>Account</TableHeaderCell> <TableHeaderCell>Stats</TableHeaderCell> </TableHeader>
{({ item }) => ( <TableRow> <TableRowCell>{item.accountId}</TableRowCell> <SparklineTableRowCell accountId={item.accountId} query={item.query} /> </TableRow> )} </Table> );}
Example 2
<NrqlQuery accountId={1} query="SELECT count(*) FROM Transaction WHERE metric = '…' TIMESERIES"> {({ loading, error, data }) => { if (loading || error) { return null; }
return ( <Table items={data}> <TableHeader> <TableHeaderCell>Name</TableHeaderCell> <TableHeaderCell>Stats</TableHeaderCell> </TableHeader>
{({ item }) => ( <TableRow> <TableRowCell>{item.metadata.name}</TableRowCell> <SparklineTableRowCell data={[item]} /> </TableRow> )} </Table> ); }}</NrqlQuery>
Props
DEPRECATEDnumber | Due November 1st, 2022The accountId is deprecated, use accountIds instead |
string | Appends class names to the component.Should be used only for positioning and spacing purposes. |
object[] | Data is an array of objects where each object represents a series to be drawn. Each series comprises visualization metadata and an array of data points.
|
function | Callback fired any time the user clicks on the table cell. function ( |
string | NRQL query used for fetching data. The query is performed against the provided |
object | Inline style for custom styling.Should be used only for positioning and spacing purposes. |
string | Adds a Note: You might not see |
shape|string | Location object or url string to link to.Linked shapepathname REQUIREDstring
string
string |