Skip to content

Commit

Permalink
Pull request #5278: Feature/DXCF-5602 improve watermark behaviour for…
Browse files Browse the repository at this point in the history
… library

Merge in DXCHARTS/dxchart5 from feature/DXCF-5602-improve-watermark-behaviour-for-library to master

* commit '88ea0c3a22328a274bef532241ec2ef7b12dccaa':
  [DXCF-5602] Improve watermark behaviour for Library // pr fix
  [DXCF-5602] Improve watermark behaviour for Library // pr fix
  [DXCF-5602] Improve watermark behaviour for Library
  [DXCF-5602] Improve watermark behaviour for Library // init
  [DXCF-5602] Improve watermark behaviour for Library // revert
  [DXCF-5602] Improve watermark behaviour for Library // init

GitOrigin-RevId: 991a2e8b905b3edda53663d7018266bd8a98d8d0
  • Loading branch information
Keelaro1 authored and dxcity committed Nov 19, 2024
1 parent ebb3fec commit 9fcf71b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/chart/chart.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
Expand Down
21 changes: 5 additions & 16 deletions src/chart/components/watermark/water-mark.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
* Copyright (C) 2019 - 2024 Devexperts Solutions IE Limited
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
Expand All @@ -15,16 +15,6 @@ import { ChartModel } from '../chart/chart.model';
import { PaneManager } from '../pane/pane-manager.component';
import { WaterMarkDrawer } from './water-mark.drawer';

export interface WaterMarkConfig {
isVisible?: boolean;
fontFamily?: string;
firstRowFontSize?: number;
firstRowBottomPadding?: number;
secondRowFontSize?: number;
secondRowBottomPadding?: number;
thirdRowFontSize?: number;
}

export interface WaterMarkData {
firstRow?: string;
secondRow?: string;
Expand Down Expand Up @@ -103,23 +93,22 @@ export class WaterMarkComponent extends ChartBaseElement {

/**
* Sets the watermark configuration for the chart.
* @param {WaterMarkConfig} watermarkConfig - The configuration object for the watermark.
* @param {ChartConfigComponentsWaterMark} watermarkConfig - The configuration object for the watermark.
* @returns {void}
*/
public setWaterMarkConfig(watermarkConfig: WaterMarkConfig): void {
public setWaterMarkConfig(watermarkConfig: ChartConfigComponentsWaterMark): void {
if (!watermarkConfig || !this.config.components) {
return;
}
if (!this.config.components.waterMark) {
this.config.components.waterMark = JSON.parse(JSON.stringify(watermarkConfig));
} else {
const newWatermark: WaterMarkConfig = {};
const newWatermark: Partial<ChartConfigComponentsWaterMark> = {};
merge(newWatermark, watermarkConfig);
merge(newWatermark, this.config.components.waterMark);
// eslint-disable-next-line no-restricted-syntax
this.config.components.waterMark = newWatermark as ChartConfigComponentsWaterMark &
Required<ChartConfigComponentsWaterMark>;
this.config.components.waterMark = newWatermark as ChartConfigComponentsWaterMark;
}
this.canvasModel.fireDraw();
}
Expand Down

0 comments on commit 9fcf71b

Please sign in to comment.