Skip to content

Commit

Permalink
feat(charts/pie): add color input for pie #1816
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jul 11, 2024
1 parent 538dfde commit dca0fc2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/doc/src/app/charts/pie/pie.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
[interactions]="interactions"
[label]="label"
[theme]="$any(prizmTheme.changesTheme$ | async)"
[color]="color"
>
</prizm-charts-pie>
</prizm-doc-demo>
Expand Down Expand Up @@ -103,6 +104,14 @@
>
Label
</ng-template>
<ng-template
[(documentationPropertyValue)]="color"
documentationPropertyName="color"
documentationPropertyType="string"
documentationPropertyMode="input"
>
Color. Sets charts color. Note, for chart with seriesField use colors array.
</ng-template>
</prizm-doc-documentation>
</ng-template>

Expand Down
1 change: 1 addition & 0 deletions apps/doc/src/app/charts/pie/pie.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class PieComponent {
];
colorField = 'type';
angleField = 'value';
color = '';
interactions: PrizmChartsPieOptions['interactions'] = [{ type: 'element-active' }];
label: PrizmChartsPieOptions['label'] = {
type: 'inner',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export class PrizmChartsPieComponent<T extends Record<string, unknown>> extends
return this.options?.angleField as string;
}

@Input()
public set color(value: PrizmChartsPieOptions['color']) {
this.updateOptions({ color: value });
}
public get color(): PrizmChartsPieOptions['color'] {
return this.options.color;
}

@Input()
public set colorField(value: string) {
this.updateOptions({ colorField: value });
Expand Down

0 comments on commit dca0fc2

Please sign in to comment.