Renders a row table cell showing a particular metric. The metric is formatted according to the unit passed. Units are 1:1 compatible with the ones supported by <NrqlQuery>
format type CHART
.
Unit and prefix formatting is automatically picked for you so that it is consistent with the rest of the platform. Metrics are automatically aligned to the left, and ellipsified from the right, which is the standard way for presenting them.
Usage
import { MetricTableRowCell } from 'nr1'
Examples
Basic
function render() { const items = [ { value: 123456789, }, ];
return ( <Table items={items}> <TableHeader> <TableHeaderCell alignmentType={TableHeaderCell.ALIGNMENT_TYPE.RIGHT}> Memory usage </TableHeaderCell> </TableHeader>
{({ item }) => ( <TableRow> <MetricTableRowCell type={MetricTableRowCell.TYPE.BITS} value={item.value} /> </TableRow> )} </Table> );}
With additional value
function render() { const items = [ { value: 123456789, lastUpdated: new Date().toLocaleTimeString(), }, ];
return ( <Table items={items} multivalue> <TableHeader> <TableHeaderCell alignmentType={TableHeaderCell.ALIGNMENT_TYPE.RIGHT}> Memory usage </TableHeaderCell> </TableHeader>
{({ item }) => ( <TableRow> <MetricTableRowCell type={MetricTableRowCell.TYPE.BITS} value={item.value} additionalValue={`Last updated at ${item.lastUpdated}`} /> </TableRow> )} </Table> );}
Props
string | Additional information along the main data in the cell.Note: At the moment this content becomes visible only when the |
string | Appends class names to the component.Should be used only for positioning and spacing purposes. |
function | Callback fired any time the user clicks on the table cell. function ( |
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 shape
REQUIREDstring
string
string |
enum | Unit of the provided metric. Will be used for auto-formatting the numerical value. <One of |
REQUIREDnumber | Metric value, always in the shape of a number. |