dev_docs/lens/pie.mdx
import Dataset from './dataset.mdx'; import Breakdown from './breakdown.mdx';
Understanding LensPieConfig in detail
chartType'pie' | 'donut'titlestringbreakdownLensBreakdownConfig[]legendIdentity<LensLegendConfig>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,
});