Charts
Charts are used in cell objects to render the data and visualise it. The charts available in this SDK are BarChartandPieChart. See the explanation below to see how you can create and use them.
Bar Chart
Instantiate the Bar Chart object.
import { BarChart } from 'dashboard-sdk';
// const barChart = new BarChart();
/* Parameters
id: string; - a unique ID for the view
title: string; - a title for the view
metricFields: string[]; - a list of field IDs
groupByFields: string[]; - a list of field IDs
*/
const barChart = new BarChart(
"1",
"Barchart Title",
["field1", "field2"],
["groupBy1", "groupBy2"]
);
BarCharttakes a unique ID and a title to show on the chart. This chart also takes in further arguements like an array of strings i.e metricFieldIDs and groupByFieldIDs.
Pie Chart
Instantiate the PieChart object.
import { PieChart } from 'dashboard-sdk';
// const pieChart = new PieChart();
/* Parameters
id: string; - a unique ID for the view
title: string; - a title for the view
metricField: string; - ID of the field used
groupByFieldId: string; - ID of the field to group by for each segment
*/
const pieChart = new PieChart("1", "Pie Chart Title", "field2", "groupBy1");
PieCharttakes a unique ID and a title to show on the chart. This chart also takes in further arguements like an array of strings i.e metricFieldIDs and groupByFieldIDs.