UNPKG

pptx-automizer

Version:

A template based pptx generator

142 lines (141 loc) 5.6 kB
import { ChartModificationCallback } from '../types/types'; import { ChartAxisRange, ChartData, ChartElementCoordinateShares, ChartPointValue, ChartSeriesDataLabelAttributes } from '../types/chart-types'; import { XmlElement } from '../types/xml-types'; export default class ModifyChartHelper { /** * Set chart data to modify default chart types. * See `__tests__/modify-existing-chart.test.js` */ static setChartData: (data: ChartData) => ChartModificationCallback; /** * Set chart data to modify vertical line charts. * See `__tests__/modify-chart-vertical-lines.test.js` */ static setChartVerticalLines: (data: ChartData) => ChartModificationCallback; /** * Set chart data to modify scatter charts. * See `__tests__/modify-chart-scatter.test.js` */ static setChartScatter: (data: ChartData) => ChartModificationCallback; /** * Set chart data to modify combo charts. * This type is prepared for * first series: bar chart (e.g. total) * other series: vertical lines * See `__tests__/modify-chart-scatter.test.js` */ static setChartCombo: (data: ChartData) => ChartModificationCallback; /** * Set chart data to modify bubble charts. * See `__tests__/modify-chart-bubbles.test.js` */ static setChartBubbles: (data: ChartData) => ChartModificationCallback; /** * Set chart data to modify extended chart types. * See `__tests__/modify-existing-extended-chart.test.js` */ static setExtendedChartData: (data: ChartData) => ChartModificationCallback; /** * Read chart workbook data * See `__tests__/read-chart-data.test.js` */ static readWorkbookData: (data: any) => ChartModificationCallback; /** * Read chart info * See `__tests__/read-chart-data.test.js` */ static readChartInfo: (info: any) => ChartModificationCallback; /** * Set range and format for chart axis. * Please notice: It will only work if the value to update is not set to * "Auto" in powerpoint. Only manually scaled min/max can be altered by this. * See `__tests__/modify-chart-axis.test.js` */ static setAxisRange: (range: ChartAxisRange) => ChartModificationCallback; static setAxisAttribute: (element: XmlElement, tag: string, value: string | number | boolean, attribute?: string) => void; /** * Set legend coordinates to zero. Could be advantageous for pptx users to * be able to maximize a legend easily. Legend will still be selectible for * a user. */ static minimizeChartLegend: () => ChartModificationCallback; /** * Completely remove a chart legend. Please notice: This will trigger * PowerPoint to automatically maximize chart space. */ static removeChartLegend: () => ChartModificationCallback; /** * Update the coordinates of a chart legend. * legendArea coordinates are shares of chart coordinates, e.g. * "w: 0.5" means "half of chart width" * @param legendArea */ static setLegendPosition: (legendArea: ChartElementCoordinateShares) => ChartModificationCallback; /** * Set the plot area coordinates of a chart. * * This modifier requires a 'c:manualLayout' element. It will only appear if * plot area coordinates are edited manually in ppt before. Recently fresh * created charts will not have a manualLayout by default. * * This is especially useful if you have problems with edgy elements on a * chart area that do not fit into the given space, e.g. when having a lot * of data labels. You can increase the chart and decrease the plot area * to create a margin. * * plotArea coordinates are shares of chart coordinates, e.g. * "w: 0.5" means "half of chart width" * * @param plotArea */ static setPlotArea: (plotArea: ChartElementCoordinateShares) => ChartModificationCallback; /** * Set a waterfall Total column to last * you may also optionally specify a different index. @param TotalColumnIDX * */ static setWaterFallColumnTotalToLast: (TotalColumnIDX?: number) => ChartModificationCallback; /** * Set the title of a chart. This requires an already existing, manually edited chart title. @param newTitle * */ static setChartTitle: (newTitle: string) => ChartModificationCallback; /** * Specify a format for DataLabels @param dataLabel * */ static setDataLabelAttributes: (dataLabel: ChartSeriesDataLabelAttributes) => ChartModificationCallback; static setDataPointLabelAttributes: (dataLabel: ChartSeriesDataLabelAttributes) => { 'c:spPr': { modify: ((element: Element) => void)[]; }; 'c:dLblPos': { modify: ((element: Element) => void)[]; }; 'c:showLegendKey': { modify: ((element: Element) => void)[]; }; 'c:showVal': { modify: ((element: Element) => void)[]; }; 'c:showCatName': { modify: ((element: Element) => void)[]; }; 'c:showSerName': { modify: ((element: Element) => void)[]; }; 'c:showPercent': { modify: ((element: Element) => void)[]; }; 'c:showBubbleSize': { modify: ((element: Element) => void)[]; }; 'c:showLeaderLines': { modify: ((element: Element) => void)[]; }; }; static parseCellValue(value: string | ChartPointValue): string; }