Skip to content

Commit

Permalink
Fix for gitbrent#970
Browse files Browse the repository at this point in the history
invertedColors should be defined as "HexColor[]";
bar chart did not render inverted colored negative bars unless more than one color was provided in the chartColors array
  • Loading branch information
lhaskin-hbs committed Sep 30, 2021
1 parent 01579e0 commit 12da6e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ export interface IChartPropsBase {
dataBorder?: BorderProps
displayBlanksAs?: string
fill?: HexColor
invertedColors?: string
invertedColors?: HexColor[]
lang?: string
layout?: PositionProps
shadow?: ShadowProps
Expand Down
6 changes: 4 additions & 2 deletions src/gen-charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,10 @@ function makeChartType(chartType: CHART_NAME, data: OptsChartData[], opts: IChar
if (
(chartType === CHART_TYPE.BAR || chartType === CHART_TYPE.BAR3D) &&
data.length === 1 &&
opts.chartColors !== BARCHART_COLORS &&
opts.chartColors.length > 1
(
(opts.chartColors && opts.chartColors !== BARCHART_COLORS && opts.chartColors.length > 1) ||
(opts.invertedColors && opts.invertedColors.length)
)
) {
// Series Data Point colors
obj.values.forEach((value, index) => {
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1863,7 +1863,7 @@ declare namespace PptxGenJS {
dataBorder?: BorderProps
displayBlanksAs?: string
fill?: HexColor
invertedColors?: string
invertedColors?: HexColor[]
lang?: string
layout?: PositionProps
shadow?: ShadowProps
Expand Down

0 comments on commit 12da6e5

Please sign in to comment.