Charts and widgets

What is a widget?
How do I create widgets?

Get started
Community
Last updated
Was this helpful?
Was this helpful?
import {VectorTableSource} from 'carto-api-client';
// define auth parameters in cartoConfig
const dataSource = await vectorTableSource({
...cartoConfig,
tableName: 'carto-demo-data.demo_tables.osm_pois_usa'
})
const categories = await dataSource.widgetSource.getCategories({
column: 'group_name',
operation: 'count'
})
// categories will return the corresponding aggregation by the column group_name,
// you can then plug categories into any charting library or HTML element