A dashboard card for one chart, with its table view and source.
import { Chart } from '@oztix/roadie-charts/chart'
The chart inside the card supplies the Table view and the summary a screen reader hears.
Use a takeaway sentence when no single number answers the question.
Open on the Table view with view='table'. A chart inside the card supplies its table once it runs in the browser. When the Table view renders on the server, or must work without JavaScript, pass table from @oztix/roadie-charts/tables.
import { lineChartTable } from '@oztix/roadie-charts/tables'
Pass table to show different numbers from the plot, such as a few key dates. It wins over the table the chart supplies.
A single line gets no legend of its own on a wide card, where end labels name its reading aids. Pass one when you want the line and its aids named at every width. Use the words the plot uses, and the card's legend replaces the one the plot adds on a narrow card.
Pass actions to add controls after the Chart and Table switch. Use at most one visible action, then the More menu last. Pass DataCard.MoreButton to a Menu trigger's render, and it keeps its name and ref. Group the items as the More menu guideline says, with the danger action last.
source is required. A chart inside the card supplies the Table view, and a table prop wins over it. A static image needs a table.table from @oztix/roadie-charts/tables when the Table view renders on the server or must work without JavaScript.size='sm' is 160px and md is 220px. lg and full start at 260px and grow with the card's width, to 340px at lg and 420px at full, so a wide plot keeps about a 4:1 shape. One CSS rule sets this for every chart, so there is nothing to tune per dashboard.narrow rendition for plots under 480px wide and a wide one for 960px and up, so the text stays readable at every width.ToggleGroup: ChartLineIcon and TableIcon, bold, size-4. Each item is named by its aria-label, not visible text, so it never competes with the label for space.CHART_LABEL_LIMITS from @oztix/roadie-core/dashboard-layout, not COPY_LIMITS, because the label's row also holds the view switch: 21 characters at sm and md, 27 at lg and full.ACTIONS_LABEL_LIMITS from @oztix/roadie-core/dashboard-layout. See card actions.aria-label, with aria-pressed and aria-controls pointing at the views. The hidden view is inert, so keyboard focus and screen readers reach only the one on show.Fixed name for the card. People and agents refer to the card by it.
Defaults to 'number'.
One sentence, used when there is no single headline number.
Controls at the top right, after the label. Shown in every state, so an action such as refresh still works on a card that failed to load. Card actions after the Chart and Table switch, such as `<DataCard.MoreButton>`. Shown in every state.
Defaults to 'ready'.
Body height while loading. Defaults to the live plot height for `size`: 160px at `sm`, 220px at `md`, and from 260px up to 340px at `lg` or 420px at `full` as the card widens. A static plot sizes to its image, so it may settle at a different height when it loads.
Exact numbers behind the chart, shown in the Table view. A chart inside the card supplies its own once it runs in the browser, and this wins over it. When the Table view renders on the server, or must work without JavaScript, pass `table` from `@oztix/roadie-charts/tables`.
Defaults to chart.