Skip to content

Commit

Permalink
feat(charts/waterfall): add color input for waterfall #1816
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and ickisIckis committed Aug 23, 2024
1 parent 2e4ba07 commit 7935be5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/doc/src/app/charts/waterfall/waterfall.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
[xField]="xField"
[yField]="yField"
[theme]="$any(prizmTheme.changesTheme$ | async)"
[color]="color"
></prizm-charts-waterfall>
</prizm-doc-demo>
<prizm-doc-documentation>
Expand Down Expand Up @@ -81,6 +82,15 @@
>
Height
</ng-template>
<ng-template
[(documentationPropertyValue)]="color"
[documentationPropertyValues]="$any(colorVariants)"
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
6 changes: 6 additions & 0 deletions apps/doc/src/app/charts/waterfall/waterfall.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export class WaterfallComponent {
];
public xField = 'type';
public yField = 'money';
public colorVariants = [
'',
['red', 'blue', 'green', 'yellow'],
['#b07e9f', '#7dbbb0', '#a37c18', '#e7bee6', '#396878', '#6699cc', '#fc9e7b'],
];
public color = this.colorVariants[0];
public options = {
appendPadding: [15, 0, 0, 0],
meta: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ export class PrizmChartsWaterfallComponent<
return this.options?.data ?? [];
}

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

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

0 comments on commit 7935be5

Please sign in to comment.