Browse Source

Harmonize colors

pull/8105/head
Thomas Kaul 5 days ago
parent
commit
fc4371fcd0
  1. 12
      apps/client/src/app/components/investment-chart/investment-chart.component.ts

12
apps/client/src/app/components/investment-chart/investment-chart.component.ts

@ -113,9 +113,9 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
} }
private initialize() { private initialize() {
const benchmarkColorRgb = this.groupBy const isBarChart = !!this.groupBy;
? primaryColorRgb
: secondaryColorRgb; const benchmarkColorRgb = isBarChart ? primaryColorRgb : secondaryColorRgb;
// Create clones of the input data // Create clones of the input data
this.investments = this.benchmarkDataItems.map((item) => this.investments = this.benchmarkDataItems.map((item) =>
@ -134,7 +134,7 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
{ {
backgroundColor: `rgb(${benchmarkColorRgb.r}, ${benchmarkColorRgb.g}, ${benchmarkColorRgb.b})`, backgroundColor: `rgb(${benchmarkColorRgb.r}, ${benchmarkColorRgb.g}, ${benchmarkColorRgb.b})`,
borderColor: `rgb(${benchmarkColorRgb.r}, ${benchmarkColorRgb.g}, ${benchmarkColorRgb.b})`, borderColor: `rgb(${benchmarkColorRgb.r}, ${benchmarkColorRgb.g}, ${benchmarkColorRgb.b})`,
borderWidth: this.groupBy ? 0 : 1, borderWidth: isBarChart ? 0 : 1,
data: this.investments.map(({ date, investment }) => { data: this.investments.map(({ date, investment }) => {
return { return {
x: parseDate(date)?.getTime() ?? null, x: parseDate(date)?.getTime() ?? null,
@ -239,7 +239,7 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
responsive: true, responsive: true,
scales: { scales: {
x: getTimeAxisOptions({ x: getTimeAxisOptions({
borderWidth: this.groupBy ? 0 : 1, borderWidth: isBarChart ? 0 : 1,
colorScheme: this.colorScheme, colorScheme: this.colorScheme,
locale: this.locale locale: this.locale
}), }),
@ -255,7 +255,7 @@ export class GfInvestmentChartComponent implements OnChanges, OnDestroy {
plugins: [ plugins: [
getVerticalHoverLinePlugin(this.chartCanvas(), this.colorScheme) getVerticalHoverLinePlugin(this.chartCanvas(), this.colorScheme)
], ],
type: this.groupBy ? 'bar' : 'line' type: isBarChart ? 'bar' : 'line'
} }
); );
} }

Loading…
Cancel
Save