From 6fcf3203840af321615cda519d93e6cda8af26e1 Mon Sep 17 00:00:00 2001 From: "HUSSAR-mtrela (Martin Trela)" Date: Tue, 18 Nov 2025 18:33:31 -0500 Subject: [PATCH 1/2] add user anno sample --- .../.codesandbox/Dockerfile | 1 + .../.codesandbox/tasks.json | 17 +++ .../user-annotation-layer/.stackblitzrc | 1 + .../user-annotation-layer/ReadMe.md | 58 ++++++++ .../user-annotation-layer/angular.json | 140 ++++++++++++++++++ .../user-annotation-layer/package.json | 45 ++++++ .../src/CountryRenewableElectricity.ts | 34 +++++ .../src/app.component.html | 72 +++++++++ .../src/app.component.scss | 35 +++++ .../src/app.component.ts | 113 ++++++++++++++ .../user-annotation-layer/src/app.module.ts | 44 ++++++ .../src/environments/environment.prod.ts | 3 + .../src/environments/environment.ts | 16 ++ .../user-annotation-layer/src/index.html | 23 +++ .../user-annotation-layer/src/main.ts | 15 ++ .../user-annotation-layer/src/polyfills.ts | 61 ++++++++ .../user-annotation-layer/src/styles.scss | 9 ++ .../user-annotation-layer/src/typings.d.ts | 5 + .../user-annotation-layer/tsconfig.app.json | 10 ++ .../user-annotation-layer/tsconfig.json | 25 ++++ .../user-annotation-layer/tslint.json | 31 ++++ 21 files changed, 758 insertions(+) create mode 100644 samples/charts/data-chart/user-annotation-layer/.codesandbox/Dockerfile create mode 100644 samples/charts/data-chart/user-annotation-layer/.codesandbox/tasks.json create mode 100644 samples/charts/data-chart/user-annotation-layer/.stackblitzrc create mode 100644 samples/charts/data-chart/user-annotation-layer/ReadMe.md create mode 100644 samples/charts/data-chart/user-annotation-layer/angular.json create mode 100644 samples/charts/data-chart/user-annotation-layer/package.json create mode 100644 samples/charts/data-chart/user-annotation-layer/src/CountryRenewableElectricity.ts create mode 100644 samples/charts/data-chart/user-annotation-layer/src/app.component.html create mode 100644 samples/charts/data-chart/user-annotation-layer/src/app.component.scss create mode 100644 samples/charts/data-chart/user-annotation-layer/src/app.component.ts create mode 100644 samples/charts/data-chart/user-annotation-layer/src/app.module.ts create mode 100644 samples/charts/data-chart/user-annotation-layer/src/environments/environment.prod.ts create mode 100644 samples/charts/data-chart/user-annotation-layer/src/environments/environment.ts create mode 100644 samples/charts/data-chart/user-annotation-layer/src/index.html create mode 100644 samples/charts/data-chart/user-annotation-layer/src/main.ts create mode 100644 samples/charts/data-chart/user-annotation-layer/src/polyfills.ts create mode 100644 samples/charts/data-chart/user-annotation-layer/src/styles.scss create mode 100644 samples/charts/data-chart/user-annotation-layer/src/typings.d.ts create mode 100644 samples/charts/data-chart/user-annotation-layer/tsconfig.app.json create mode 100644 samples/charts/data-chart/user-annotation-layer/tsconfig.json create mode 100644 samples/charts/data-chart/user-annotation-layer/tslint.json diff --git a/samples/charts/data-chart/user-annotation-layer/.codesandbox/Dockerfile b/samples/charts/data-chart/user-annotation-layer/.codesandbox/Dockerfile new file mode 100644 index 000000000..cd7500bb4 --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/.codesandbox/Dockerfile @@ -0,0 +1 @@ +FROM node:20 \ No newline at end of file diff --git a/samples/charts/data-chart/user-annotation-layer/.codesandbox/tasks.json b/samples/charts/data-chart/user-annotation-layer/.codesandbox/tasks.json new file mode 100644 index 000000000..8d92a54cd --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/.codesandbox/tasks.json @@ -0,0 +1,17 @@ +{ + // These tasks will run in order when initializing your CodeSandbox project. + "setupTasks": [ + { + "name": "Install Dependencies", + "command": "yarn install" + } + ], + // These tasks can be run from CodeSandbox. Running one will open a log in the app. + "tasks": { + "node node_modules/@angular/cli/bin/ng serve -o --disable-host-check": { + "name": "Start Project", + "command": "node node_modules/@angular/cli/bin/ng serve -o --disable-host-check", + "runAtStart": true + } + } +} \ No newline at end of file diff --git a/samples/charts/data-chart/user-annotation-layer/.stackblitzrc b/samples/charts/data-chart/user-annotation-layer/.stackblitzrc new file mode 100644 index 000000000..dd44ea00f --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/.stackblitzrc @@ -0,0 +1 @@ +{"installDependencies":true, "startCommand":"npm start"} \ No newline at end of file diff --git a/samples/charts/data-chart/user-annotation-layer/ReadMe.md b/samples/charts/data-chart/user-annotation-layer/ReadMe.md new file mode 100644 index 000000000..4b2ae5f92 --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/ReadMe.md @@ -0,0 +1,58 @@ + + + +This folder contains Angular application with example of Actions Built In Data Chart feature using [Toolbar](https://www.infragistics.com/products/ignite-ui-angular/angular/components/general-getting-started.html) component. + + + + + + View Docs + + + View Code + + + Run Sample + + + Run Sample + + + + +## Branches + +> **_NOTE:_** You should use [master](https://github.com/IgniteUI/igniteui-angular-examples/tree/master) branch of this repository if you want to run samples on your computer. Use the [vnext](https://github.com/IgniteUI/igniteui-angular-examples/tree/vnext) branch only when you want to contribute new samples to this repository. + +## Instructions + +Follow these instructions to run this example: + + +- clone and navigate to this sample in terminal window + +``` +git clone https://github.com/IgniteUI/igniteui-angular-examples.git +git checkout master +cd ../samples/charts/toolbar/actions-built-in-data-chart +``` + + +- open above folder in VS Code or type: +``` +code . +``` + +- In terminal window, run: +``` +npm install --legacy-peer-deps +npm run-script start +``` + +- open http://localhost:4200/ in your browser + + +## Learn More + +To learn more about **Ignite UI for Angular** components, check out the [Angular documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/general-getting-started.html). diff --git a/samples/charts/data-chart/user-annotation-layer/angular.json b/samples/charts/data-chart/user-annotation-layer/angular.json new file mode 100644 index 000000000..ab35c3cc4 --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/angular.json @@ -0,0 +1,140 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "demo": { + "schematics": { + "@schematics/angular:component": { + "prefix": "app", + "style": "scss", + "type": "component" + }, + "@schematics/angular:directive": { + "prefix": "app", + "type": "directive" + }, + "@schematics/angular:service": { + "type": "service" + }, + "@schematics/angular:guard": { + "typeSeparator": "." + }, + "@schematics/angular:interceptor": { + "typeSeparator": "." + }, + "@schematics/angular:module": { + "typeSeparator": "." + }, + "@schematics/angular:pipe": { + "typeSeparator": "." + }, + "@schematics/angular:resolver": { + "typeSeparator": "." + } + }, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "projectType": "application", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/demo", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": [ + "src/polyfills.ts" + ], + "tsConfig": "tsconfig.app.json", + "inlineStyleLanguage": "scss", + "assets": [ + "src/assets" + ], + "styles": [ + "src/styles.scss" + ], + "scripts": [], + "stylePreprocessorOptions": { + "includePaths": [ "node_modules/" ] + } + }, + "configurations": { + "production": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], + "outputHashing": "all", + "budgets": [ + { + "type": "initial", + "maximumWarning": "500kb", + "maximumError": "1mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "2kb", + "maximumError": "4kb" + } + ] + }, + "development": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "buildTarget": "demo:build:production" + }, + "development": { + "buildTarget": "demo:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "buildTarget": "demo:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.spec.json", + "karmaConfig": "karma.conf.js", + "styles": [ + "src/styles.scss" + ], + "scripts": [], + "assets": [ + "src/assets" + ], + "inlineStyleLanguage": "scss", + "stylePreprocessorOptions": { + "includePaths": [ "node_modules/" ] + } + } + } + } + } + }, + "cli": { + "analytics": false + } +} diff --git a/samples/charts/data-chart/user-annotation-layer/package.json b/samples/charts/data-chart/user-annotation-layer/package.json new file mode 100644 index 000000000..4c2d6557d --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/package.json @@ -0,0 +1,45 @@ +{ + "scripts": { + "ng": "ng", + "update": "ng update", + "start": "node --max_old_space_size=12192 node_modules/@angular/cli/bin/ng serve -o", + "build": "node --max_old_space_size=12192 node_modules/@angular/cli/bin/ng build --configuration production", + "lint": "ng lint" + }, + "dependencies": { + "@angular/animations": "20.0.1", + "@angular/common": "20.0.1", + "@angular/compiler": "20.0.1", + "@angular/core": "20.0.1", + "@angular/forms": "20.0.1", + "@angular/platform-browser": "20.0.1", + "@angular/platform-browser-dynamic": "20.0.1", + "@types/hammerjs": "2.0.40", + "classlist.js": "1.1.20150312", + "hammerjs": "2.0.8", + "igniteui-angular-charts": "20.2.0-beta.0", + "igniteui-angular-core": "20.2.0-beta.0", + "igniteui-angular-inputs": "20.2.0-beta.0", + "igniteui-angular-layouts": "20.2.0-beta.0", + "intl": "1.2.5", + "jszip": "3.8.0", + "rxjs": "7.8.1", + "tslib": "2.6.1", + "web-animations-js": "2.3.2", + "zone.js": "~0.15.0" + }, + "devDependencies": { + "@angular/cli": "20.0.1", + "@angular/compiler-cli": "20.0.1", + "@angular/language-service": "20.0.1", + "@angular-devkit/build-angular": "20.0.1", + "@types/node": "18.17.0", + "codelyzer": "6.0.2", + "jasmine-core": "5.1.1", + "jasmine-spec-reporter": "~4.2.1", + "sass.js": "0.11.1", + "tslint": "~6.1.3", + "ts-node": "10.9.1", + "typescript": "5.8.3" + } +} diff --git a/samples/charts/data-chart/user-annotation-layer/src/CountryRenewableElectricity.ts b/samples/charts/data-chart/user-annotation-layer/src/CountryRenewableElectricity.ts new file mode 100644 index 000000000..21a29ab22 --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/CountryRenewableElectricity.ts @@ -0,0 +1,34 @@ +export class CountryRenewableElectricityItem { + public constructor(init: Partial) { + Object.assign(this, init); + } + + public year: string; + public europe: number; + public china: number; + public america: number; + +} +export class CountryRenewableElectricity extends Array { + public constructor(items: Array | number = -1) { + if (Array.isArray(items)) { + super(...items); + } else { + const newItems = [ + new CountryRenewableElectricityItem({ year: `2009`, europe: 34, china: 21, america: 19 }), + new CountryRenewableElectricityItem({ year: `2010`, europe: 43, china: 26, america: 24 }), + new CountryRenewableElectricityItem({ year: `2011`, europe: 66, china: 29, america: 28 }), + new CountryRenewableElectricityItem({ year: `2012`, europe: 69, china: 32, america: 26 }), + new CountryRenewableElectricityItem({ year: `2013`, europe: 58, china: 47, america: 38 }), + new CountryRenewableElectricityItem({ year: `2014`, europe: 40, china: 46, america: 31 }), + new CountryRenewableElectricityItem({ year: `2015`, europe: 78, china: 50, america: 19 }), + new CountryRenewableElectricityItem({ year: `2016`, europe: 13, china: 90, america: 52 }), + new CountryRenewableElectricityItem({ year: `2017`, europe: 78, china: 132, america: 50 }), + new CountryRenewableElectricityItem({ year: `2018`, europe: 40, china: 134, america: 34 }), + new CountryRenewableElectricityItem({ year: `2018`, europe: 40, china: 134, america: 34 }), + new CountryRenewableElectricityItem({ year: `2019`, europe: 80, china: 96, america: 38 }), + ]; + super(...newItems.slice(0)); + } + } +} diff --git a/samples/charts/data-chart/user-annotation-layer/src/app.component.html b/samples/charts/data-chart/user-annotation-layer/src/app.component.html new file mode 100644 index 000000000..fa4f9593c --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/app.component.html @@ -0,0 +1,72 @@ +
+
+
+ + +
+
+
+ + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +
+ +
+ + + + + +
+ +
+ + +
+
+
+
diff --git a/samples/charts/data-chart/user-annotation-layer/src/app.component.scss b/samples/charts/data-chart/user-annotation-layer/src/app.component.scss new file mode 100644 index 000000000..edaa0a07e --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/app.component.scss @@ -0,0 +1,35 @@ +/* styles are loaded the Shared CSS file located at: +https://static.infragistics.com/xplatform/css/samples/ +*/ +.aboveContentSplit { + display: flex; + flex-direction: row; +} +.aboveContentLeftContainer { + margin-left: 1.25rem; + display: flex; + flex-grow: 1; + justify-content: flex-start; + align-items: flex-end; +} +.aboveContentRightContainer { + margin-right: 1.25rem; + display: flex; + flex-grow: 1; + justify-content: flex-end; + align-items: flex-end; +} + +// .annotationPopup { +// position: fixed; +// top: 50%; +// left: 50%; +// transform: translate(-50%, -50%); +// width: 13rem; +// height: 19rem; +// background-color: white; +// border: 1px black solid; +// border-radius: 0.25rem; +// padding-left: 0.5rem; +// padding-right: 0.5rem; +// } \ No newline at end of file diff --git a/samples/charts/data-chart/user-annotation-layer/src/app.component.ts b/samples/charts/data-chart/user-annotation-layer/src/app.component.ts new file mode 100644 index 000000000..422014afe --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/app.component.ts @@ -0,0 +1,113 @@ +import { AfterViewInit, Component, ViewChild, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; +import { CountryRenewableElectricityItem, CountryRenewableElectricity } from './CountryRenewableElectricity'; +import { IgxToolbarComponent } from 'igniteui-angular-layouts'; +import { IgxColorEditorComponent } from 'igniteui-angular-inputs'; + +import { IgxDataChartComponent, IgxCategoryXAxisComponent, + IgxNumericYAxisComponent, IgxLineSeriesComponent, + IgxUserAnnotationInformation, + IgxDataToolTipLayerComponent } from 'igniteui-angular-charts'; + +@Component({ + standalone: false, + selector: "app-root", + styleUrls: ["./app.component.scss"], + templateUrl: "./app.component.html", + changeDetection: ChangeDetectionStrategy.OnPush +}) + +export class AppComponent implements AfterViewInit +{ + + @ViewChild("toolbar", { static: true } ) + private toolbar: IgxToolbarComponent + @ViewChild("chart", { static: true } ) + private chart: IgxDataChartComponent + @ViewChild("xAxis", { static: true } ) + private xAxis: IgxCategoryXAxisComponent + @ViewChild("yAxis", { static: true } ) + private yAxis: IgxNumericYAxisComponent + @ViewChild("lineSeries1", { static: true } ) + private lineSeries1: IgxLineSeriesComponent + @ViewChild("lineSeries2", { static: true } ) + private lineSeries2: IgxLineSeriesComponent + @ViewChild("lineSeries3", { static: true } ) + private lineSeries3: IgxLineSeriesComponent + @ViewChild("tooltipLayer", { static: true } ) + private tooltipLayer: IgxDataToolTipLayerComponent + + @ViewChild("annotationBadgeColorEditor", { static: true } ) + private annotationBadgeColorEditor: IgxColorEditorComponent + @ViewChild("annotationMainColorEditor", { static: true } ) + private annotationMainColorEditor: IgxColorEditorComponent + + private currentAnnotationInfo: IgxUserAnnotationInformation; + + //https://github.com/IgniteUI/igniteui-wc-examples/blob/vnext/samples/charts/data-chart/user-annotation-layer/src/index.ts + + private _countryRenewableElectricity: CountryRenewableElectricity = null; + public get countryRenewableElectricity(): CountryRenewableElectricity { + if (this._countryRenewableElectricity == null) + { + this._countryRenewableElectricity = new CountryRenewableElectricity(); + } + return this._countryRenewableElectricity; + } + + public constructor(private _detector: ChangeDetectorRef) + { + this.onUserAnnotationInformationRequested = this.onUserAnnotationInformationRequested.bind(this); + this.onUserAnnotationTooltipContentUpdating = this.onUserAnnotationTooltipContentUpdating.bind(this); + this.onDoneBtnClick = this.onDoneBtnClick.bind(this); + } + + public onUserAnnotationInformationRequested(e: any) { + console.log("onUserAnnotation InformationRequested"); + this.currentAnnotationInfo = e.args.annotationInfo; + this.toggleDialogState(true); + } + + public onUserAnnotationTooltipContentUpdating(e: any) { + console.log("onUserAnnotation TooltipContentUpdating"); + } + + public onDoneBtnClick() { + console.log("onDoneBtnClick"); + + this.currentAnnotationInfo.label = "LBL"; //this.annotationInput.value; + this.currentAnnotationInfo.annotationData = "DESC"; //this.annotationTextArea.value; + this.currentAnnotationInfo.mainColor = this.annotationMainColorEditor.value; + this.currentAnnotationInfo.badgeColor = this.annotationBadgeColorEditor.value; + + this.chart.finishAnnotationFlow(this.currentAnnotationInfo); + + this.toggleDialogState(false); + } + + public onCancelBtnClick() { + console.log("onCancelBtnClick"); + this.toggleDialogState(false); + } + + public toggleDialogState(open: boolean) { + console.log("toggleDialogState"); + var popup = document.getElementById('annotationPopup') as HTMLDivElement; + + if (open) { + popup.style.display = "block"; + } + else { + popup.style.display = "none"; + } + } + + public ngAfterViewInit(): void + { + + // this.annotationBadgeColorEditor.iconColor = "green"; + // this.annotationBadgeColorEditor.textColor = "green"; + + } + +} + diff --git a/samples/charts/data-chart/user-annotation-layer/src/app.module.ts b/samples/charts/data-chart/user-annotation-layer/src/app.module.ts new file mode 100644 index 000000000..974f08aed --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/app.module.ts @@ -0,0 +1,44 @@ +import { NgModule } from "@angular/core"; +import { FormsModule } from "@angular/forms"; +import { CommonModule } from "@angular/common"; +import { BrowserModule } from "@angular/platform-browser"; +import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; +import { AppComponent } from "./app.component"; + +import { IgxToolbarModule } from 'igniteui-angular-layouts'; +import { IgxColorEditorModule } from 'igniteui-angular-inputs'; + +import { + IgxAnnotationLayerProxyModule, + IgxDataChartToolbarModule, + IgxDataChartCoreModule, + IgxDataChartCategoryModule, + IgxDataChartInteractivityModule, + IgxDataChartAnnotationDynamicModule, + IgxDataChartCategoryTrendLineModule +} from 'igniteui-angular-charts'; + +@NgModule({ + bootstrap: [AppComponent], + declarations: [ + AppComponent +], + imports: [ + BrowserModule, + BrowserAnimationsModule, + CommonModule, + FormsModule, + IgxToolbarModule, + IgxDataChartToolbarModule, + IgxDataChartCoreModule, + IgxDataChartCategoryModule, + IgxDataChartAnnotationDynamicModule, + IgxDataChartInteractivityModule, + IgxAnnotationLayerProxyModule, + IgxDataChartCategoryTrendLineModule, + IgxColorEditorModule +], + providers: [], + schemas: [] +}) +export class AppModule {} diff --git a/samples/charts/data-chart/user-annotation-layer/src/environments/environment.prod.ts b/samples/charts/data-chart/user-annotation-layer/src/environments/environment.prod.ts new file mode 100644 index 000000000..3612073bc --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/samples/charts/data-chart/user-annotation-layer/src/environments/environment.ts b/samples/charts/data-chart/user-annotation-layer/src/environments/environment.ts new file mode 100644 index 000000000..7b4f817ad --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/environments/environment.ts @@ -0,0 +1,16 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: false +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI. diff --git a/samples/charts/data-chart/user-annotation-layer/src/index.html b/samples/charts/data-chart/user-annotation-layer/src/index.html new file mode 100644 index 000000000..7650dfb64 --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/index.html @@ -0,0 +1,23 @@ + + + + + + IgniteUI for Angular | Example | infragistics + + + + + + + + + + + + + + + + + diff --git a/samples/charts/data-chart/user-annotation-layer/src/main.ts b/samples/charts/data-chart/user-annotation-layer/src/main.ts new file mode 100644 index 000000000..ec9adcd4a --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/main.ts @@ -0,0 +1,15 @@ +// tslint:disable:no-string-literal +import "./polyfills"; +import { enableProdMode } from "@angular/core"; +import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; +import { AppModule } from "./app.module"; + +platformBrowserDynamic().bootstrapModule(AppModule).then(ref => { + // ensure Angular destroys itself on hot reloads. + if (window["ngRef"]) { + window["ngRef"].destroy(); + } + window["ngRef"] = ref; + + // otherwise, log the boot error +}).catch(err => console.error(err)); diff --git a/samples/charts/data-chart/user-annotation-layer/src/polyfills.ts b/samples/charts/data-chart/user-annotation-layer/src/polyfills.ts new file mode 100644 index 000000000..bea4237c0 --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/polyfills.ts @@ -0,0 +1,61 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** +* BROWSER POLYFILLS +*/ + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +//import "classlist.js"; // run `npm install --save classlist.js`. + +/** IE10 and IE11 requires the following for the Reflect API. */ + +/* Evergreen browsers require these. */ +// used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. + +/* + * Required to support Web Animations `@angular/platform-browser/animations`. + * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation + */ +//import "web-animations-js"; // run `npm install --save web-animations-js`. + +/*************************************************************************************************** + * Zone JS is required by Angular itself. + */ +import "hammerjs/hammer"; +import "zone.js"; // included with Angular CLI. + +/*************************************************************************************************** + * @angular/animations polyfill + */ +// if (!Element.prototype.matches) { +// Element.prototype.matches = (Element.prototype as any).msMatchesSelector; +// } + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ + +/** + * Date, currency, decimal and percent pipes. + * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 + */ +// import "intl"; // Run `npm install --save intl`. +// import "intl/locale-data/jsonp/de"; +/** + * Need to import at least one locale-data with intl. + */ +// import "intl/locale-data/jsonp/en"; diff --git a/samples/charts/data-chart/user-annotation-layer/src/styles.scss b/samples/charts/data-chart/user-annotation-layer/src/styles.scss new file mode 100644 index 000000000..9b431e92d --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/styles.scss @@ -0,0 +1,9 @@ +/* autoprefixer grid: on */ +html, +body { + height: 100%; + width: 100%; + overflow: hidden; + margin: 0; + box-sizing: border-box; +} diff --git a/samples/charts/data-chart/user-annotation-layer/src/typings.d.ts b/samples/charts/data-chart/user-annotation-layer/src/typings.d.ts new file mode 100644 index 000000000..ef5c7bd62 --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/src/typings.d.ts @@ -0,0 +1,5 @@ +/* SystemJS module definition */ +declare var module: NodeModule; +interface NodeModule { + id: string; +} diff --git a/samples/charts/data-chart/user-annotation-layer/tsconfig.app.json b/samples/charts/data-chart/user-annotation-layer/tsconfig.app.json new file mode 100644 index 000000000..ff396d4ce --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/tsconfig.app.json @@ -0,0 +1,10 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/app", + "types": [] + }, + "files": ["src/main.ts", "src/polyfills.ts"], + "include": ["src/**/*.d.ts"] +} diff --git a/samples/charts/data-chart/user-annotation-layer/tsconfig.json b/samples/charts/data-chart/user-annotation-layer/tsconfig.json new file mode 100644 index 000000000..96a384c70 --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "importHelpers": true, + "module": "esnext", + "baseUrl": "./", + "outDir": "./dist/out-tsc", + "sourceMap": false, + "declaration": false, + "moduleResolution": "node", + "experimentalDecorators": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "downlevelIteration": true, + "target": "es2022", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2022", + "dom" + ] + } + +} \ No newline at end of file diff --git a/samples/charts/data-chart/user-annotation-layer/tslint.json b/samples/charts/data-chart/user-annotation-layer/tslint.json new file mode 100644 index 000000000..777c777d9 --- /dev/null +++ b/samples/charts/data-chart/user-annotation-layer/tslint.json @@ -0,0 +1,31 @@ +{ + "extends": "tslint:latest", + "rules": { + "deprecation": { + "severity": "warning" + }, + "arrow-parens": false, + "indent": [true, "spaces"], + "interface-name": [true, "always-prefix"], + "max-classes-per-file": false, + "no-bitwise": false, + "no-console": false, + "no-empty": false, + "no-duplicate-imports": false, + "no-implicit-dependencies": false, + "no-object-literal-type-assertion": false, + "no-submodule-imports": [false], + "no-string-literal": false, + "no-trailing-whitespace": false, + "no-var-keyword": false, + "object-literal-sort-keys": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-for-of": false, + "prefer-object-spread": false, + "space-within-parens": false, + "trailing-comma": [true, {"multiline": "never", "singleline": "never"}], + "variable-name": [true, "allow-leading-underscore"] + } +} From 52c2e24be93435355d64a0af3672ad65b5a552d7 Mon Sep 17 00:00:00 2001 From: "HUSSAR-mtrela (Martin Trela)" Date: Wed, 19 Nov 2025 18:51:26 -0500 Subject: [PATCH 2/2] user anno sample --- .../src/app.component.html | 47 +++++----- .../src/app.component.scss | 14 --- .../src/app.component.ts | 85 ++++++++++--------- 3 files changed, 66 insertions(+), 80 deletions(-) diff --git a/samples/charts/data-chart/user-annotation-layer/src/app.component.html b/samples/charts/data-chart/user-annotation-layer/src/app.component.html index fa4f9593c..710f7b3e0 100644 --- a/samples/charts/data-chart/user-annotation-layer/src/app.component.html +++ b/samples/charts/data-chart/user-annotation-layer/src/app.component.html @@ -1,6 +1,6 @@
-
-
+
+
- + -
-
- - -
- -
- - -
- -
- - + padding-right: 0.5rem; + box-shadow: 0.05rem 0.05rem 0.5rem 0.05rem gray;"> + + + + + + - - -
+ + -
+ + + +
diff --git a/samples/charts/data-chart/user-annotation-layer/src/app.component.scss b/samples/charts/data-chart/user-annotation-layer/src/app.component.scss index edaa0a07e..7d86d9783 100644 --- a/samples/charts/data-chart/user-annotation-layer/src/app.component.scss +++ b/samples/charts/data-chart/user-annotation-layer/src/app.component.scss @@ -19,17 +19,3 @@ https://static.infragistics.com/xplatform/css/samples/ justify-content: flex-end; align-items: flex-end; } - -// .annotationPopup { -// position: fixed; -// top: 50%; -// left: 50%; -// transform: translate(-50%, -50%); -// width: 13rem; -// height: 19rem; -// background-color: white; -// border: 1px black solid; -// border-radius: 0.25rem; -// padding-left: 0.5rem; -// padding-right: 0.5rem; -// } \ No newline at end of file diff --git a/samples/charts/data-chart/user-annotation-layer/src/app.component.ts b/samples/charts/data-chart/user-annotation-layer/src/app.component.ts index 422014afe..3d9af4f58 100644 --- a/samples/charts/data-chart/user-annotation-layer/src/app.component.ts +++ b/samples/charts/data-chart/user-annotation-layer/src/app.component.ts @@ -1,12 +1,9 @@ import { AfterViewInit, Component, ViewChild, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; -import { CountryRenewableElectricityItem, CountryRenewableElectricity } from './CountryRenewableElectricity'; +import { CountryRenewableElectricity } from './CountryRenewableElectricity'; import { IgxToolbarComponent } from 'igniteui-angular-layouts'; import { IgxColorEditorComponent } from 'igniteui-angular-inputs'; -import { IgxDataChartComponent, IgxCategoryXAxisComponent, - IgxNumericYAxisComponent, IgxLineSeriesComponent, - IgxUserAnnotationInformation, - IgxDataToolTipLayerComponent } from 'igniteui-angular-charts'; +import { IgxDataChartComponent, IgxUserAnnotationInformation } from 'igniteui-angular-charts'; @Component({ standalone: false, @@ -18,32 +15,20 @@ import { IgxDataChartComponent, IgxCategoryXAxisComponent, export class AppComponent implements AfterViewInit { - @ViewChild("toolbar", { static: true } ) private toolbar: IgxToolbarComponent @ViewChild("chart", { static: true } ) private chart: IgxDataChartComponent - @ViewChild("xAxis", { static: true } ) - private xAxis: IgxCategoryXAxisComponent - @ViewChild("yAxis", { static: true } ) - private yAxis: IgxNumericYAxisComponent - @ViewChild("lineSeries1", { static: true } ) - private lineSeries1: IgxLineSeriesComponent - @ViewChild("lineSeries2", { static: true } ) - private lineSeries2: IgxLineSeriesComponent - @ViewChild("lineSeries3", { static: true } ) - private lineSeries3: IgxLineSeriesComponent - @ViewChild("tooltipLayer", { static: true } ) - private tooltipLayer: IgxDataToolTipLayerComponent @ViewChild("annotationBadgeColorEditor", { static: true } ) private annotationBadgeColorEditor: IgxColorEditorComponent @ViewChild("annotationMainColorEditor", { static: true } ) private annotationMainColorEditor: IgxColorEditorComponent - private currentAnnotationInfo: IgxUserAnnotationInformation; + private annotationInfo: IgxUserAnnotationInformation; - //https://github.com/IgniteUI/igniteui-wc-examples/blob/vnext/samples/charts/data-chart/user-annotation-layer/src/index.ts + public annotationLabel: string = "Enter Label"; + public annotationDetails: string = "Enter Details"; private _countryRenewableElectricity: CountryRenewableElectricity = null; public get countryRenewableElectricity(): CountryRenewableElectricity { @@ -59,55 +44,71 @@ export class AppComponent implements AfterViewInit this.onUserAnnotationInformationRequested = this.onUserAnnotationInformationRequested.bind(this); this.onUserAnnotationTooltipContentUpdating = this.onUserAnnotationTooltipContentUpdating.bind(this); this.onDoneBtnClick = this.onDoneBtnClick.bind(this); + this.onInitializeToolbar = this.onInitializeToolbar.bind(this); + } + + public ngAfterViewInit(): void + { + window.setTimeout(() => this.onInitializeToolbar(), 1000); + } + + public onInitializeToolbar() { + for (let toolbarMenu of this.toolbar.actualActions) { + if (toolbarMenu.actionId === "AnnotationMenu") { + toolbarMenu.openSubMenu(); + } + } } public onUserAnnotationInformationRequested(e: any) { - console.log("onUserAnnotation InformationRequested"); - this.currentAnnotationInfo = e.args.annotationInfo; + this.annotationInfo = e.args.annotationInfo; + this.toggleDialogState(true); } public onUserAnnotationTooltipContentUpdating(e: any) { - console.log("onUserAnnotation TooltipContentUpdating"); + var details = e.args.annotationInfo.annotationData; + + if (e.args.content.children.length == 0) { + var element = document.createElement("div"); + element.textContent = details; + element.style = "color: white"; + e.args.content.appendChild(element); + } + else { + var element: HTMLDivElement = e.args.content.children[0]; + element.textContent = details; + } } public onDoneBtnClick() { - console.log("onDoneBtnClick"); - - this.currentAnnotationInfo.label = "LBL"; //this.annotationInput.value; - this.currentAnnotationInfo.annotationData = "DESC"; //this.annotationTextArea.value; - this.currentAnnotationInfo.mainColor = this.annotationMainColorEditor.value; - this.currentAnnotationInfo.badgeColor = this.annotationBadgeColorEditor.value; + + this.annotationInfo.label = this.annotationLabel; + this.annotationInfo.annotationData = this.annotationDetails; + this.annotationInfo.mainColor = this.annotationMainColorEditor.value; + this.annotationInfo.badgeColor = this.annotationBadgeColorEditor.value; - this.chart.finishAnnotationFlow(this.currentAnnotationInfo); + this.chart.finishAnnotationFlow(this.annotationInfo); this.toggleDialogState(false); } public onCancelBtnClick() { - console.log("onCancelBtnClick"); + this.chart.cancelAnnotationFlow(this.annotationInfo.annotationId); + this.toggleDialogState(false); } public toggleDialogState(open: boolean) { - console.log("toggleDialogState"); var popup = document.getElementById('annotationPopup') as HTMLDivElement; - + if (open) { - popup.style.display = "block"; + popup.style.display = "flex"; } else { popup.style.display = "none"; } } - public ngAfterViewInit(): void - { - - // this.annotationBadgeColorEditor.iconColor = "green"; - // this.annotationBadgeColorEditor.textColor = "green"; - - } - }