Skip to content

Commit

Permalink
feat(charts/line): add color input for line #1816
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jul 11, 2024
1 parent 0c870ea commit b06a7b4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
[yField]="'value'"
[options]="{ smooth: true }"
[seriesField]="'city'"
[color]="['#00bffb', '#f400b1']"
></prizm-charts-line>
19 changes: 10 additions & 9 deletions apps/doc/src/app/charts/line/line.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
[seriesField]="$any(seriesField)"
[theme]="$any(prizmTheme.changesTheme$ | async)"
[height]="height"
[color]="color"
></prizm-charts-line>
</prizm-doc-demo>
<prizm-doc-documentation>
Expand Down Expand Up @@ -68,15 +69,6 @@
Series Field Name (use 'key' for example data)
</ng-template>

<ng-template
[(documentationPropertyValue)]="width"
documentationPropertyName="width"
documentationPropertyType="number"
documentationPropertyMode="input"
>
Width
</ng-template>

<ng-template
documentationPropertyName="data"
documentationPropertyMode="input"
Expand Down Expand Up @@ -117,6 +109,15 @@
>
Height
</ng-template>

<ng-template
[(documentationPropertyValue)]="color"
documentationPropertyName="color"
documentationPropertyType="string"
documentationPropertyMode="input"
>
Color. Sets color to line. 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/line/line.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class LineComponent {
height = 300;
xField = 'x';
yField = 'y';
color = '';
width: number | null = null;
seriesField: string | null = null;
data: any = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ export class PrizmChartsLineComponent<T = unknown> extends PrizmChartsAbstractCo

private origin_!: PrizmChartsLineOrigin;

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

@Input() set autoFit(value: boolean) {
this.updateOptions({ autoFit: value });
}
Expand Down

0 comments on commit b06a7b4

Please sign in to comment.