PptxGenJS icon indicating copy to clipboard operation
PptxGenJS copied to clipboard

Chart Customization

Open adeelkhalid opened this issue 3 years ago • 1 comments

image

This is a must-required feature for me. Can you please put all formatting variables in the chart data series? It would be a great help.

Originally posted by @adeelkhalid in https://github.com/gitbrent/PptxGenJS/issues/716#issuecomment-863817608

adeelkhalid avatar Jun 18 '21 07:06 adeelkhalid

Hi again. I have managed to change the color for each category label by providing a color array.

`slide.addChart(pptx.ChartType.line, dataChartAreaLine, { x: 1, y: 1, w: 8, h: 4, showDataTable: true, showDataTableKeys: true, dataTableFontSize: 10, dataBorder: { pt: "1", color: "92D050" }, border: { pt: "1", color: "92D050" }, valAxisHidden: true, showValue: true, chartColors: ["92D050", "FF0000"], dataLabelPosition: "t",

dataLabelColorArray: ["92D050", "FF0000"], //color array for labels

dataLabelColor: "92D051", });`

Changed one line located on line 751 in gen-charts.ts // default line strXml += ' <a:solidFill>' + createColorElement(opts.dataLabelColor || DEF_FONT_COLOR) + '</a:solidFill>'

//changed strXml += ' <a:solidFill>' + createColorElement(opts.dataLabelColorArray[idx] || DEF_FONT_COLOR) + '</a:solidFill>'

adeelkhalid avatar Jun 18 '21 18:06 adeelkhalid

Hi, Do you have implement this property : dataLabelColorArray ?

64237442 avatar Nov 22 '22 04:11 64237442