docs/extend/key-concepts/ui/lens-config-api/lens-config-builder-api-metric.md
Understanding LensMetricConfig in detail
chartType'metric'titlestring:::{include} ./_snippets/dataset.md :::
valueLensLayerQuerylabelstringquerySecondaryMetricLensLayerQueryqueryMaxValueLensLayerQuery:::{include} ./_snippets/breakdown.md :::
trendLinebooleansubtitlestringconst config: LensConfig = {
chartType: 'metric',
title: 'Total Sales',
dataset: {
esql: 'from myindex | stats totalSales = sum(sales_field)',
},
value: 'totalSales',
label: 'Total Sales Value',
};
const configBuilder = new LensConfigBuilder(dataViewsAPI, lensFormulaAPI);
const lensConfig = configBuilder(config, {
timeRange: { from: 'now-30d', to: 'now', type: 'relative' },
embeddable: true,
}