Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: charts colors update #1196 #1504

Merged
merged 16 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/doc/src/app/charts/bar/bar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<prizm-doc-example id="base" [content]="exampleOutline" heading="Base">
<prizm-charts-bar-example></prizm-charts-bar-example>
</prizm-doc-example>
<prizm-doc-example id="stacked" [content]="exampleOutline" heading="Stacked">
<prizm-doc-example id="stacked" [content]="exampleStacked" heading="Stacked">
<prizm-charts-stacked-bar-example></prizm-charts-stacked-bar-example>
</prizm-doc-example>
<prizm-doc-example id="group" [content]="exampleGroup" heading="Group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[theme]="$any(prizmTheme.changesTheme$ | async)"
[color]="color"
xField="sales"
seriesField="sales"
yField="type"
seriesField="sales"
></prizm-charts-bar>
<pre>{{ data | json }}</pre>
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,23 @@ export class PrizmChartsBarExampleComponent implements AfterViewInit {
sales: 38,
},
];
readonly color: PrizmChartsBarOptions['color'] = data => {
return data.sales > 40 ? 'red' : 'green';

readonly tooltipOptions = {
showTitle: false,
formatter: item => ({ name: item.type, value: item.sales }),
};

constructor(public readonly prizmTheme: PrizmThemeService) {}

readonly color: PrizmChartsBarOptions['color'] = data => {
return data.sales > 40 ? 'red' : 'green';
};

ngAfterViewInit(): void {
// we can update options manually
this.bar.updateOptions({
legend: false,
// color: this.color
tooltip: this.tooltipOptions,
});
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<prizm-charts-bar
[data]="data"
[label]="label"
[options]="options"
[theme]="$any(prizmTheme.changesTheme$ | async)"
xField="value"
yField="label"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,7 @@ export class PrizmChartsBarGroupExampleComponent {
],
};

public options = { isGroup: true };

constructor(public readonly prizmTheme: PrizmThemeService) {}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<prizm-charts-bar
[data]="data"
[label]="label"
[options]="{ isStack: true }"
[theme]="$any(prizmTheme.changesTheme$ | async)"
xField="value"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import { PrizmChartsBarOptions } from '@prizm-ui/charts';
import { PrizmThemeService } from '@prizm-ui/theme';

@Component({
Expand Down Expand Up @@ -107,5 +108,14 @@ export class PrizmChartsStackedBarExampleComponent {
},
];

public label: PrizmChartsBarOptions['label'] = {
position: 'middle', // 'left', 'middle', 'right'
layout: [
{ type: 'interval-adjust-position' },
{ type: 'interval-hide-overlap' },
{ type: 'adjust-color' },
],
};

constructor(public readonly prizmTheme: PrizmThemeService) {}
}
2 changes: 1 addition & 1 deletion apps/doc/src/app/charts/gauge/gauge.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<ng-template
[(documentationPropertyValue)]="percent"
documentationPropertyName="percent"
documentationPropertyType="number"
documentationPropertyType="decimal"
documentationPropertyMode="input"
>
Percent
Expand Down
16 changes: 0 additions & 16 deletions apps/doc/src/app/charts/pie/pie.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,6 @@
</prizm-charts-pie>
</prizm-doc-demo>
<prizm-doc-documentation>
<ng-template
[(documentationPropertyValue)]="width"
documentationPropertyName="width"
documentationPropertyType="number"
>
Width
</ng-template>

<ng-template
[(documentationPropertyValue)]="height"
documentationPropertyName="height"
documentationPropertyType="number"
>
Height
</ng-template>

<ng-template
[(documentationPropertyValue)]="angleField"
documentationPropertyName="angleField"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class PrizmChartsScatterExampleComponent {
Team: 'Viktoria Plzen',
'xG conceded': 0.33,
'Shot conceded': 7,
Result: 3,
Result: '3',
},
{
'H/A': 'H',
Expand Down
2 changes: 1 addition & 1 deletion apps/doc/src/app/charts/scatter/scatter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class ScatterComponent {
Team: 'Viktoria Plzen',
'xG conceded': 0.33,
'Shot conceded': 7,
Result: 3,
Result: '3',
},
{
'H/A': 'H',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class PrizmChartsWaterfallExampleComponent {
},
},
label: {
style: { fontSize: 10, fill: 'rgba(0,0,0,0.65)' },
style: { fontSize: 10 },
layout: [{ type: 'interval-adjust-position' }],
},
total: {
Expand Down
3 changes: 1 addition & 2 deletions apps/doc/src/app/charts/waterfall/waterfall.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { RawLoaderContent, TuiDocExample } from '@prizm-ui/doc';
import { PrizmSize } from '@prizm-ui/components';
import { PrizmChartsWaterfallItem } from '@prizm-ui/charts';
import { PrizmThemeService } from '@prizm-ui/theme';

Expand Down Expand Up @@ -33,7 +32,7 @@ export class WaterfallComponent {
},
},
label: {
style: { fontSize: 10, fill: 'rgba(0,0,0,0.65)' },
style: { fontSize: 10 },
layout: [{ type: 'interval-adjust-position' }],
},
total: {
Expand Down
Loading
Loading