From 193d4820990d297fe81d56b59e5873e1334bf05c Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Wed, 15 May 2019 08:16:13 -0400 Subject: [PATCH] fix(Chart): expose type coercion functions for charts --- terminus-ui/chart/src/chart.component.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/terminus-ui/chart/src/chart.component.md b/terminus-ui/chart/src/chart.component.md index cabd0cc3e..dee68c181 100644 --- a/terminus-ui/chart/src/chart.component.md +++ b/terminus-ui/chart/src/chart.component.md @@ -9,6 +9,7 @@ - [Inject the needed libraries](#inject-the-needed-libraries) - [Set up the chart](#set-up-the-chart) - [Supported chart types](#supported-chart-types) + - [Chart Type Coercion](#chart-type-coercion) - [AmCharts documentation](#amcharts-documentation) @@ -81,13 +82,34 @@ setUpChart(chart: am4charts.Chart) { - `pie` - `map` - `radar` -- `treemap` +- `tree` - `sankey` - `chord` > See `TsChartVisualizationOptions` for all supported types. +### Chart Type Coercion + +The library exposes functions for coercing to specific chart types: + +- `tsChartXYTypeCheck` +- `tsChartPieTypeCheck` +- `tsChartMapTypeCheck` +- `tsChartRadarTypeCheck` +- `tsChartTreeTypeCheck` +- `tsChartSankeyTypeCheck` +- `tsChartChordTypeCheck` + +Example: + +```typescript +if (tsChartXYTypeCheck(chart)) { + // Now we know we are dealing with an XY chart type +} +``` + + ## AmCharts documentation See https://www.amcharts.com/docs/v4/ for full documentation.