Skip to content

adds the possibility to define border styles for each data point from the series. works for bar, line, area, scatter, pie#1343

Open
kotlyarevskyy wants to merge 1 commit into
gitbrent:masterfrom
kotlyarevskyy:feature-data-points-individual-styles
Open

adds the possibility to define border styles for each data point from the series. works for bar, line, area, scatter, pie#1343
kotlyarevskyy wants to merge 1 commit into
gitbrent:masterfrom
kotlyarevskyy:feature-data-points-individual-styles

Conversation

@kotlyarevskyy

Copy link
Copy Markdown

Adds a new 'styles' property to the OptsChartData interface to define styles for data points.
Adds logic that allows custom border styles to be defined for each data point in the following charts: Bar, Line, Area, Scatter, Pie/Doughnut charts.

the data array would look like this, e.g:

data: [
    {
	 name: 'Project Status',
	labels: ['Red', 'On Hold', 'Green', 'Unknown'],
	values: [10, 20, 38, 2]
	styles: [
		{border: {pt: 2, color: '#ff0000'}} // RED BORDER FOR THE FIRST DATA POINT
		{}
		{border: {pt: 2, color: '#00ff00'}} // GREEN BORDER FOR THE THIRD DATA POINT
		{}
	 ]
    }
]

… styles for data points. Adds logic that allows custom border styles to be defined for each data point in the following charts: Bar, Line, Area, Scatter, Pie/Doughnut charts.
shbernal added a commit to shbernal/PptxGenJS that referenced this pull request Jun 11, 2026
Adopts upstream PR gitbrent#1343 with a typed API instead of its loose `styles`
object. Adds OptsChartData.pointStyles?: ChartDataPointStyle[] where
ChartDataPointStyle = { border?: BorderProps; fill?: HexColor }, index-
aligned with values[]. Reusing BorderProps gives 'none'|'dash'|'solid'
and bare HexColor for free vs upstream's `{ border: { pt, color:'#rgb' }}`.

- Supported: BAR, BAR3D, LINE, AREA, SCATTER, PIE, DOUGHNUT. RADAR is
  skipped (extra per-point markup historically corrupts the chart).
- Centralizes c:dPt generation in makeSeriesDataPointsXml +
  createChartBorderLine, merging legacy single-series color-vary fills
  with pointStyles so a point never emits a duplicate <c:idx>.
- Pie/doughnut: per-point border overrides chart-level dataBorder.

Prerequisite schema-order fixes (exposed by the new validated fixtures):
- Relocate bar/scatter color-vary c:dPt to before c:dLbls; CT_BarSer/
  CT_ScatterSer require dPt* then dLbls.
- Gate c:invertIfNegative to bar-only; it is absent from CT_AreaSer.

Schema fixtures: bar/pie/line/area/scatter-chart-point-styles.
Closes upstream-pr-1343.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant