Chart.presentation Property
Controls native chart layout, transparency, independent axes and bar spacing without changing series values.
Owner: Chart. Package: @txtextcontrol/tx-sheet-control. Version: 2.0.0.
Syntax
presentation?: ChartAppearance['presentation']
Settings
| Setting | Meaning |
|---|---|
backgroundColor, borderColor | Six-digit RGB; null selects transparency or removes the frame. |
plotLayout | x, y, width, height in chart fractions from 0 to 1; dimensions must be positive. |
legendLayout | Overlay legend rectangle in the same units, with vertically stacked entries. |
categoryAxis | visible, lineVisible, reverseOrder, and clockwise labelRotation from -90 to 90 degrees. |
valueAxis | visible, lineVisible, minimum, maximum, positive majorUnit, and numberFormatCode. |
gapWidth | Category gap as a percentage of bar width, from 0 to 500. |
Minimum must be less than maximum when both are set. Omitted settings use automatic layout. Invalid values throw before the chart changes. Presentation is retained by XLSX, TXWB and ODS and shared by browser and server PDF rendering.
Examples
import type { Workbook } from '@txtextcontrol/tx-sheet-control';
function configureReport(book: Workbook) {
const sheet = book.sheets.at(0);
const chart = sheet.charts.add({
type: 'bar-100', title: 'Event budget',
series: [
{ name: 'Income', values: { values: [1936, 1831] }, categories: { values: ['Estimated', 'Actual'] },
color: '#ff4500', dataLabels: { numberFormatCode: '"$"#,##0', color: '#ffffff', bold: true, position: 'center' } },
{ name: 'Expenses', values: { values: [882, 333] }, categories: { values: ['Estimated', 'Actual'] },
color: '#ffb499', dataLabels: { numberFormatCode: '"$"#,##0', position: 'center' } }
], anchor: { cell: 'E2' }, size: { width: 520, height: 320 }
});
chart.update({
elements: { dataLabels: true, gridlines: false },
presentation: {
backgroundColor: null, borderColor: null,
plotLayout: { x: 0.12, y: 0.24, width: 0.85, height: 0.68 },
categoryAxis: { visible: true, lineVisible: false, labelRotation: -90 },
valueAxis: { visible: false }, gapWidth: 50
}
});
return chart;
}