docs/extend/key-concepts/ui/lens-config-api/lens-config-builder-api-pie.md
Understanding LensPieConfig in detail
chartType'pie' | 'donut'titlestring:::{include} ./_snippets/dataset.md :::
breakdownLensBreakdownConfig[]legendIdentity:::{include} ./_snippets/breakdown.md :::
const pieConfig: LensConfig = {
chartType: 'pie',
title: 'Bytes by Region',
dataset: {
esql: 'from sales_data | stats avgBytes = avg(bytes) by geo.src',
},
breakdown: [
'geo.src'
],
legend: {
show: true,
position: 'right',
},
};
const configBuilder = new LensConfigBuilder(dataViewsAPI, lensFormulaAPI);
const lensConfig = configBuilder.build(pieConfig, {
timeRange: { from: 'now-1y', to: 'now', type: 'relative' },
embeddable: true,
});