Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Update charts and content loader

Oliver Günther140a0ce477a0
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 80588ee0d0f..16a83cd6602 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -39,7 +39,7 @@
"@kolkov/ngx-gallery": "^2.0.1",
"@ng-select/ng-option-highlight": "0.0.7",
"@ng-select/ng-select": "^11.0.0",
- "@ngneat/content-loader": "^6.1.0",
+ "@ngneat/content-loader": "^7.0.0",
"@ngx-formly/core": "^6.1.4",
"@openproject/reactivestates": "^3.0.1",
"@uirouter/angular": "^11.1.0",
@@ -49,9 +49,8 @@
"@xeokit/xeokit-bim-viewer": "2.3.10",
"autoprefixer": "^9.6.1",
"byte-base64": "^1.1.0",
- "cdk-drag-scroll": "^0.0.6",
- "chart.js": "2.9.4",
- "chartjs-plugin-datalabels": "^0.6.0",
+ "chart.js": "4.3.0",
+ "chartjs-plugin-datalabels": "^2.2.0",
"codemirror": "^5.62.0",
"copy-text-to-clipboard": "^3.0.0",
"core-js": "^3.2.1",
@@ -78,7 +77,7 @@
"mousetrap": "~1.6.3",
"ng-dynamic-component": "^10.7.0",
"ng2-charts": "^4.1.1",
- "ng2-dragula": "^2.1.1",
+ "ng2-dragula": "^3.2.0",
"ngx-cookie-service": "^14.0.0",
"observable-array": "0.0.4",
"pako": "^2.0.3",
@@ -119,7 +118,6 @@
"@storybook/mdx2-csf": "^1.1.0",
"@storybook/preset-scss": "^1.0.3",
"@storybook/testing-library": "^0.1.0",
- "@types/chart.js": "^2.9.20",
"@types/codemirror": "5.60.5",
"@types/dragula": "^3.7.0",
"@types/hammerjs": "^2.0.36",
@@ -5749,6 +5747,11 @@
"@angular/core": ">=13.0.0 <14"
}
},
+ "node_modules/@kurkle/color": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz",
+ "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw=="
+ },
"node_modules/@leichtgewicht/ip-codec": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz",
@@ -5823,10 +5826,14 @@
}
},
"node_modules/@ngneat/content-loader": {
- "version": "6.1.0",
- "license": "MIT",
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/@ngneat/content-loader/-/content-loader-7.0.0.tgz",
+ "integrity": "sha512-CfwsDxh2hsQfUwca3SWnyjQD5jcG6Vb6Ew0JIztj/spr3YIC9Obz7AqEVMDYPKch4QzPJiJ6OVRuLRM2DKiG9g==",
"dependencies": {
- "tslib": "^2.1.0"
+ "tslib": "^2.3.0"
+ },
+ "peerDependencies": {
+ "@angular/core": ">= 13.0.0"
}
},
"node_modules/@ngtools/webpack": {
@@ -9085,14 +9092,6 @@
"@types/node": "*"
}
},
- "node_modules/@types/chart.js": {
- "version": "2.9.37",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "moment": "^2.10.2"
- }
- },
"node_modules/@types/codemirror": {
"version": "5.60.5",
"dev": true,
@@ -12310,21 +12309,6 @@
"url": "https://github.com/sponsors/wooorm"
}
},
- "node_modules/cdk-drag-scroll": {
- "version": "0.0.6",
- "dependencies": {
- "tslib": "^1.9.0"
- },
- "peerDependencies": {
- "@angular/cdk": "^7.3.0",
- "@angular/common": "^7.2.0",
- "@angular/core": "^7.2.0"
- }
- },
- "node_modules/cdk-drag-scroll/node_modules/tslib": {
- "version": "1.13.0",
- "license": "0BSD"
- },
"node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@@ -12343,33 +12327,22 @@
"license": "MIT"
},
"node_modules/chart.js": {
- "version": "2.9.4",
- "license": "MIT",
- "dependencies": {
- "chartjs-color": "^2.1.0",
- "moment": "^2.10.2"
- }
- },
- "node_modules/chartjs-color": {
- "version": "2.4.1",
- "license": "MIT",
- "dependencies": {
- "chartjs-color-string": "^0.6.0",
- "color-convert": "^1.9.3"
- }
- },
- "node_modules/chartjs-color-string": {
- "version": "0.6.0",
- "license": "MIT",
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.3.0.tgz",
+ "integrity": "sha512-ynG0E79xGfMaV2xAHdbhwiPLczxnNNnasrmPEXriXsPJGjmhOBYzFVEsB65w2qMDz+CaBJJuJD0inE/ab/h36g==",
"dependencies": {
- "color-name": "^1.0.0"
+ "@kurkle/color": "^0.3.0"
+ },
+ "engines": {
+ "pnpm": ">=7"
}
},
"node_modules/chartjs-plugin-datalabels": {
- "version": "0.6.0",
- "license": "MIT",
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/chartjs-plugin-datalabels/-/chartjs-plugin-datalabels-2.2.0.tgz",
+ "integrity": "sha512-14ZU30lH7n89oq+A4bWaJPnAG8a7ZTk7dKf48YAzMvJjQtjrgg5Dpk9f+LbjCF6bpx3RAGTeL13IXpKQYyRvlw==",
"peerDependencies": {
- "chart.js": ">= 2.7.0 < 3"
+ "chart.js": ">=3.0.0"
}
},
"node_modules/cheerio": {
@@ -22821,21 +22794,21 @@
}
},
"node_modules/ng2-dragula": {
- "version": "2.1.1",
- "license": "MIT",
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ng2-dragula/-/ng2-dragula-3.2.0.tgz",
+ "integrity": "sha512-+By83ZGcumnKdAk5fEv8w92S85z3VpParJt/PDDuAOpkErdIq/DjUy4j5/5SymJ30SWADbd+Onie0UKgyxiiOA==",
"dependencies": {
- "@types/dragula": "^2.1.34",
- "dragula": "^3.7.2"
+ "tslib": "^2.3.0"
},
"peerDependencies": {
- "@angular/core": ">=6.0.0",
+ "@angular/animations": "^14.0.0",
+ "@angular/common": "^14.0.0",
+ "@angular/core": "^14.0.0",
+ "@types/dragula": "^2.1.34",
+ "dragula": "^3.7.2",
"rxjs": ">=6.0.0"
}
},
- "node_modules/ng2-dragula/node_modules/@types/dragula": {
- "version": "2.1.35",
- "license": "MIT"
- },
"node_modules/ngx-cookie-service": {
"version": "14.0.1",
"license": "MIT",
@@ -34346,6 +34319,11 @@
"tslib": "^2.3.0"
}
},
+ "@kurkle/color": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz",
+ "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw=="
+ },
"@leichtgewicht/ip-codec": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz",
@@ -34398,9 +34376,11 @@
}
},
"@ngneat/content-loader": {
- "version": "6.1.0",
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/@ngneat/content-loader/-/content-loader-7.0.0.tgz",
+ "integrity": "sha512-CfwsDxh2hsQfUwca3SWnyjQD5jcG6Vb6Ew0JIztj/spr3YIC9Obz7AqEVMDYPKch4QzPJiJ6OVRuLRM2DKiG9g==",
"requires": {
- "tslib": "^2.1.0"
+ "tslib": "^2.3.0"
}
},
"@ngtools/webpack": {
@@ -36658,13 +36638,6 @@
"@types/node": "*"
}
},
- "@types/chart.js": {
- "version": "2.9.37",
- "dev": true,
- "requires": {
- "moment": "^2.10.2"
- }
- },
"@types/codemirror": {
"version": "5.60.5",
"dev": true,
@@ -38899,17 +38872,6 @@
"version": "2.0.1",
"dev": true
},
- "cdk-drag-scroll": {
- "version": "0.0.6",
- "requires": {
- "tslib": "^1.9.0"
- },
- "dependencies": {
- "tslib": {
- "version": "1.13.0"
- }
- }
- },
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@@ -38924,27 +38886,17 @@
"version": "0.7.0"
},
"chart.js": {
- "version": "2.9.4",
- "requires": {
- "chartjs-color": "^2.1.0",
- "moment": "^2.10.2"
- }
- },
- "chartjs-color": {
- "version": "2.4.1",
- "requires": {
- "chartjs-color-string": "^0.6.0",
- "color-convert": "^1.9.3"
- }
- },
- "chartjs-color-string": {
- "version": "0.6.0",
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.3.0.tgz",
+ "integrity": "sha512-ynG0E79xGfMaV2xAHdbhwiPLczxnNNnasrmPEXriXsPJGjmhOBYzFVEsB65w2qMDz+CaBJJuJD0inE/ab/h36g==",
"requires": {
- "color-name": "^1.0.0"
+ "@kurkle/color": "^0.3.0"
}
},
"chartjs-plugin-datalabels": {
- "version": "0.6.0"
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/chartjs-plugin-datalabels/-/chartjs-plugin-datalabels-2.2.0.tgz",
+ "integrity": "sha512-14ZU30lH7n89oq+A4bWaJPnAG8a7ZTk7dKf48YAzMvJjQtjrgg5Dpk9f+LbjCF6bpx3RAGTeL13IXpKQYyRvlw=="
},
"cheerio": {
"version": "1.0.0-rc.12",
@@ -45877,15 +45829,11 @@
}
},
"ng2-dragula": {
- "version": "2.1.1",
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ng2-dragula/-/ng2-dragula-3.2.0.tgz",
+ "integrity": "sha512-+By83ZGcumnKdAk5fEv8w92S85z3VpParJt/PDDuAOpkErdIq/DjUy4j5/5SymJ30SWADbd+Onie0UKgyxiiOA==",
"requires": {
- "@types/dragula": "^2.1.34",
- "dragula": "^3.7.2"
- },
- "dependencies": {
- "@types/dragula": {
- "version": "2.1.35"
- }
+ "tslib": "^2.3.0"
}
},
"ngx-cookie-service": {
diff --git a/frontend/package.json b/frontend/package.json
index 706eece185b..da9d7088e19 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -27,7 +27,6 @@
"@storybook/mdx2-csf": "^1.1.0",
"@storybook/preset-scss": "^1.0.3",
"@storybook/testing-library": "^0.1.0",
- "@types/chart.js": "^2.9.20",
"@types/codemirror": "5.60.5",
"@types/dragula": "^3.7.0",
"@types/hammerjs": "^2.0.36",
@@ -112,7 +111,7 @@
"@kolkov/ngx-gallery": "^2.0.1",
"@ng-select/ng-option-highlight": "0.0.7",
"@ng-select/ng-select": "^11.0.0",
- "@ngneat/content-loader": "^6.1.0",
+ "@ngneat/content-loader": "^7.0.0",
"@ngx-formly/core": "^6.1.4",
"@openproject/reactivestates": "^3.0.1",
"@uirouter/angular": "^11.1.0",
@@ -122,9 +121,8 @@
"@xeokit/xeokit-bim-viewer": "2.3.10",
"autoprefixer": "^9.6.1",
"byte-base64": "^1.1.0",
- "cdk-drag-scroll": "^0.0.6",
- "chart.js": "2.9.4",
- "chartjs-plugin-datalabels": "^0.6.0",
+ "chart.js": "4.3.0",
+ "chartjs-plugin-datalabels": "^2.2.0",
"codemirror": "^5.62.0",
"copy-text-to-clipboard": "^3.0.0",
"core-js": "^3.2.1",
@@ -151,7 +149,7 @@
"mousetrap": "~1.6.3",
"ng-dynamic-component": "^10.7.0",
"ng2-charts": "^4.1.1",
- "ng2-dragula": "^2.1.1",
+ "ng2-dragula": "^3.2.0",
"ngx-cookie-service": "^14.0.0",
"observable-array": "0.0.4",
"pako": "^2.0.3",
diff --git a/frontend/src/app/features/boards/board/board-partitioned-page/board-list-container.component.html b/frontend/src/app/features/boards/board/board-partitioned-page/board-list-container.component.html
index c05f0a307b4..00ac09f72cf 100644
--- a/frontend/src/app/features/boards/board/board-partitioned-page/board-list-container.component.html
+++ b/frontend/src/app/features/boards/board/board-partitioned-page/board-list-container.component.html
@@ -13,9 +13,8 @@
class="boards-list--item"
wp-isolated-query-space
cdkDrag
- vsDragScroll
[cdkDragData]="boardWidget"
- [vsDragScrollContainer]="_container">
+ >
<span *ngIf="board.editable"
class="boards-list-item-handle icon icon-drag-handle"
cdkDragHandle></span>
diff --git a/frontend/src/app/features/boards/openproject-boards.module.ts b/frontend/src/app/features/boards/openproject-boards.module.ts
index 255ba965b9e..42177be7938 100644
--- a/frontend/src/app/features/boards/openproject-boards.module.ts
+++ b/frontend/src/app/features/boards/openproject-boards.module.ts
@@ -43,7 +43,6 @@ import { AddListModalComponent } from 'core-app/features/boards/board/add-list-m
import { BoardHighlightingTabComponent } from 'core-app/features/boards/board/configuration-modal/tabs/highlighting-tab.component';
import { AddCardDropdownMenuDirective } from 'core-app/features/boards/board/add-card-dropdown/add-card-dropdown-menu.directive';
import { BoardFilterComponent } from 'core-app/features/boards/board/board-filter/board-filter.component';
-import { DragScrollModule } from 'cdk-drag-scroll';
import { BoardListMenuComponent } from 'core-app/features/boards/board/board-list/board-list-menu.component';
import { VersionBoardHeaderComponent } from 'core-app/features/boards/board/board-actions/version/version-board-header.component';
import { DynamicModule } from 'ng-dynamic-component';
@@ -63,11 +62,10 @@ import { TileViewComponent } from './tile-view/tile-view.component';
OpSharedModule,
OpenprojectWorkPackagesModule,
OpenprojectModalModule,
- DragScrollModule,
OpenprojectAutocompleterModule,
// Dynamic Module for actions
- DynamicModule.withComponents([VersionBoardHeaderComponent]),
+ DynamicModule,
// Routes for /boards
UIRouterModule.forChild({
diff --git a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/tabs/display-settings-tab.component.ts b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/tabs/display-settings-tab.component.ts
index e1863b327a1..947654a0c23 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/tabs/display-settings-tab.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/configuration-modal/tabs/display-settings-tab.component.ts
@@ -7,6 +7,7 @@ import { Component, Injector } from '@angular/core';
import { QueryGroupByResource } from 'core-app/features/hal/resources/query-group-by-resource';
@Component({
+ selector: 'op-wp-table-configuration-settings-tab',
templateUrl: './display-settings-tab.component.html',
})
export class WpTableConfigurationDisplaySettingsTabComponent implements TabComponent {
diff --git a/frontend/src/app/features/work-packages/directives/query-space/isolated-graph-query-space.ts b/frontend/src/app/features/work-packages/directives/query-space/isolated-graph-query-space.ts
index 009f19c8729..1b5f16db9f1 100644
--- a/frontend/src/app/features/work-packages/directives/query-space/isolated-graph-query-space.ts
+++ b/frontend/src/app/features/work-packages/directives/query-space/isolated-graph-query-space.ts
@@ -1,9 +1,8 @@
import { Injectable } from '@angular/core';
import { input } from '@openproject/reactivestates';
-import { ChartType } from 'chart.js';
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
@Injectable()
export class IsolatedGraphQuerySpace extends IsolatedQuerySpace {
- chartType = input<ChartType>();
+ chartType = input<string>();
}
diff --git a/frontend/src/app/shared/components/autocompleter/openproject-autocompleter.module.ts b/frontend/src/app/shared/components/autocompleter/openproject-autocompleter.module.ts
index 3ede6c0d497..3f58d856a54 100644
--- a/frontend/src/app/shared/components/autocompleter/openproject-autocompleter.module.ts
+++ b/frontend/src/app/shared/components/autocompleter/openproject-autocompleter.module.ts
@@ -53,7 +53,7 @@ export const OPENPROJECT_AUTOCOMPLETE_COMPONENTS = [
FormsModule,
ReactiveFormsModule,
- DynamicModule.withComponents(OPENPROJECT_AUTOCOMPLETE_COMPONENTS),
+ DynamicModule,
OpenprojectPrincipalRenderingModule,
InviteUserButtonModule,
],
diff --git a/frontend/src/app/shared/components/grids/openproject-grids.module.ts b/frontend/src/app/shared/components/grids/openproject-grids.module.ts
index 3e90d1df796..565cea70a0e 100644
--- a/frontend/src/app/shared/components/grids/openproject-grids.module.ts
+++ b/frontend/src/app/shared/components/grids/openproject-grids.module.ts
@@ -82,21 +82,7 @@ import { TimeEntriesCurrentUserConfigurationModalComponent } from './widgets/tim
OpenprojectAttachmentsModule,
- DynamicModule.withComponents([
- WidgetCustomTextComponent,
- WidgetDocumentsComponent,
- WidgetMembersComponent,
- WidgetNewsComponent,
- WidgetWpTableQuerySpaceComponent,
- WidgetWpGraphComponent,
- WidgetWpCalendarComponent,
- WidgetWpOverviewComponent,
- WidgetProjectDescriptionComponent,
- WidgetProjectDetailsComponent,
- WidgetProjectStatusComponent,
- WidgetSubprojectsComponent,
- WidgetTimeEntriesCurrentUserComponent,
- WidgetTimeEntriesProjectComponent]),
+ DynamicModule,
// Support for inline editig fields
OpenprojectFieldsModule,
diff --git a/frontend/src/app/shared/components/grids/widgets/wp-graph/wp-graph.component.ts b/frontend/src/app/shared/components/grids/widgets/wp-graph/wp-graph.component.ts
index 01566640017..cc6296fedfa 100644
--- a/frontend/src/app/shared/components/grids/widgets/wp-graph/wp-graph.component.ts
+++ b/frontend/src/app/shared/components/grids/widgets/wp-graph/wp-graph.component.ts
@@ -4,7 +4,7 @@ import {
import { WorkPackageEmbeddedGraphDataset } from 'core-app/shared/components/work-package-graphs/embedded/wp-embedded-graph.component';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { AbstractWidgetComponent } from 'core-app/shared/components/grids/widgets/abstract-widget.component';
-import { ChartOptions, ChartType } from 'chart.js';
+import { ChartOptions } from 'chart.js';
import { WpGraphConfigurationService } from 'core-app/shared/components/work-package-graphs/configuration/wp-graph-configuration.service';
import { WpGraphConfiguration } from 'core-app/shared/components/work-package-graphs/configuration/wp-graph-configuration';
@@ -30,7 +30,7 @@ export class WidgetWpGraphComponent extends AbstractWidgetComponent implements O
this.loadQueriesInitially();
}
- public set chartType(type:ChartType) {
+ public set chartType(type:string) {
this.resource.options.chartType = type;
}
@@ -58,9 +58,11 @@ export class WidgetWpGraphComponent extends AbstractWidgetComponent implements O
ids.push({ id: this.resource.options.queryId as string });
}
- this.graphConfiguration.configuration = new WpGraphConfiguration(ids,
+ this.graphConfiguration.configuration = new WpGraphConfiguration(
+ ids,
this.resource.options.chartOptions as ChartOptions,
- this.resource.options.chartType as ChartType);
+ this.resource.options.chartType as string,
+ );
}
protected loadQueriesInitially() {
diff --git a/frontend/src/app/shared/components/work-package-graphs/configuration-modal/tabs/settings-tab-inner.component.ts b/frontend/src/app/shared/components/work-package-graphs/configuration-modal/tabs/settings-tab-inner.component.ts
index 220606799c1..59a60617026 100644
--- a/frontend/src/app/shared/components/work-package-graphs/configuration-modal/tabs/settings-tab-inner.component.ts
+++ b/frontend/src/app/shared/components/work-package-graphs/configuration-modal/tabs/settings-tab-inner.component.ts
@@ -1,7 +1,6 @@
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { WorkPackageViewGroupByService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-group-by.service';
import { Component } from '@angular/core';
-import { ChartType } from 'chart.js';
import { WpGraphConfigurationService } from 'core-app/shared/components/work-package-graphs/configuration/wp-graph-configuration.service';
import { WorkPackageStatesInitializationService } from 'core-app/features/work-packages/components/wp-list/wp-states-initialization.service';
import { TabComponent } from 'core-app/features/work-packages/components/wp-table/configuration-modal/tab-portal-outlet';
@@ -9,8 +8,9 @@ import { QuerySpacedTabComponent } from 'core-app/shared/components/work-package
import { QueryGroupByResource } from 'core-app/features/hal/resources/query-group-by-resource';
interface OpChartType {
- identifier:ChartType;
+ identifier:string;
label:string;
+ indexAxis?:'x'|'y';
}
@Component({
@@ -81,13 +81,13 @@ export class WpGraphConfigurationSettingsTabInnerComponent extends QuerySpacedTa
private initializeAvailableChartType() {
this.availableChartTypes = _.sortBy([
- { identifier: 'horizontalBar' as ChartType, label: this.I18n.t('js.chart.types.horizontal_bar') },
- { identifier: 'bar' as ChartType, label: this.I18n.t('js.chart.types.bar') },
- { identifier: 'line' as ChartType, label: this.I18n.t('js.chart.types.line') },
- { identifier: 'pie' as ChartType, label: this.I18n.t('js.chart.types.pie') },
- { identifier: 'doughnut' as ChartType, label: this.I18n.t('js.chart.types.doughnut') },
- { identifier: 'radar' as ChartType, label: this.I18n.t('js.chart.types.radar') },
- { identifier: 'polarArea' as ChartType, label: this.I18n.t('js.chart.types.polar_area') },
+ { identifier: 'horizontalBar', label: this.I18n.t('js.chart.types.horizontal_bar') },
+ { identifier: 'bar', label: this.I18n.t('js.chart.types.bar') },
+ { identifier: 'line', label: this.I18n.t('js.chart.types.line') },
+ { identifier: 'pie', label: this.I18n.t('js.chart.types.pie') },
+ { identifier: 'doughnut', label: this.I18n.t('js.chart.types.doughnut') },
+ { identifier: 'radar', label: this.I18n.t('js.chart.types.radar') },
+ { identifier: 'polarArea', label: this.I18n.t('js.chart.types.polar_area') },
], 'label');
this.currentChartType = this.availableChartTypes.find((type) => type.identifier === this.wpGraphConfiguration.configuration.chartType) || this.availableChartTypes[0];
diff --git a/frontend/src/app/shared/components/work-package-graphs/configuration/wp-graph-configuration.service.ts b/frontend/src/app/shared/components/work-package-graphs/configuration/wp-graph-configuration.service.ts
index f9fd428d7d1..20f3d2d8d6d 100644
--- a/frontend/src/app/shared/components/work-package-graphs/configuration/wp-graph-configuration.service.ts
+++ b/frontend/src/app/shared/components/work-package-graphs/configuration/wp-graph-configuration.service.ts
@@ -4,7 +4,7 @@ import { QueryResource } from 'core-app/features/hal/resources/query-resource';
import { TabInterface } from 'core-app/features/work-packages/components/wp-table/configuration-modal/tab-portal-outlet';
import { Injectable } from '@angular/core';
import { WpGraphConfigurationFiltersTabComponent } from 'core-app/shared/components/work-package-graphs/configuration-modal/tabs/filters-tab.component';
-import { ChartOptions, ChartType } from 'chart.js';
+import { ChartOptions } from 'chart.js';
import { QueryFormResource } from 'core-app/features/hal/resources/query-form-resource';
import {
WpGraphConfiguration,
@@ -175,11 +175,11 @@ export class WpGraphConfigurationService {
return this._formsPromise;
}
- public get chartType():ChartType {
+ public get chartType():string {
return this._configuration.chartType;
}
- public set chartType(type:ChartType) {
+ public set chartType(type:string) {
this._configuration.chartType = type;
}
diff --git a/frontend/src/app/shared/components/work-package-graphs/configuration/wp-graph-configuration.ts b/frontend/src/app/shared/components/work-package-graphs/configuration/wp-graph-configuration.ts
index 79e021017c7..8a318923605 100644
--- a/frontend/src/app/shared/components/work-package-graphs/configuration/wp-graph-configuration.ts
+++ b/frontend/src/app/shared/components/work-package-graphs/configuration/wp-graph-configuration.ts
@@ -1,5 +1,5 @@
import { QueryResource } from 'core-app/features/hal/resources/query-resource';
-import { ChartOptions, ChartType } from 'chart.js';
+import { ChartOptions } from 'chart.js';
import { I18nService } from 'core-app/core/i18n/i18n.service';
export interface WpGraphQueryParams {
@@ -11,7 +11,7 @@ export interface WpGraphQueryParams {
export interface WpGraphConfiguration {
queries:QueryResource[];
queryParams:WpGraphQueryParams[];
- chartType:ChartType;
+ chartType:string;
chartOptions:ChartOptions;
}
@@ -21,9 +21,9 @@ export class WpGraphConfiguration implements WpGraphConfiguration {
constructor(
public queryParams:WpGraphQueryParams[],
public chartOptions:ChartOptions,
- public chartType:ChartType,
+ public chartType:string,
) {
- this.chartType = this.chartType || 'horizontalBar';
+ this.chartType = this.chartType || 'bar';
}
public static queryCreationParams(i18n:I18nService, isPublic:boolean):unknown {
diff --git a/frontend/src/app/shared/components/work-package-graphs/embedded/wp-embedded-graph.component.ts b/frontend/src/app/shared/components/work-package-graphs/embedded/wp-embedded-graph.component.ts
index c8bbe80f136..8497e2d0741 100644
--- a/frontend/src/app/shared/components/work-package-graphs/embedded/wp-embedded-graph.component.ts
+++ b/frontend/src/app/shared/components/work-package-graphs/embedded/wp-embedded-graph.component.ts
@@ -1,6 +1,6 @@
import { Component, Input, SimpleChanges } from '@angular/core';
import { WorkPackageTableConfiguration } from 'core-app/features/work-packages/components/wp-table/wp-table-configuration';
-import { ChartOptions, ChartType } from 'chart.js';
+import { ChartOptions } from 'chart.js';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { GroupObject } from 'core-app/features/hal/resources/wp-collection-resource';
@@ -25,7 +25,7 @@ export class WorkPackageEmbeddedGraphComponent {
@Input() public chartOptions:ChartOptions;
- @Input() chartType:ChartType = 'horizontalBar';
+ @Input() chartType = 'bar';
public configuration:WorkPackageTableConfiguration;
@@ -98,28 +98,20 @@ export class WorkPackageEmbeddedGraphComponent {
const defaults:ChartOptions = {
responsive: true,
maintainAspectRatio: false,
- legend: {
- // Only display legends if more than one dataset is provided.
- display: this.datasets.length > 1,
- },
+ indexAxis: this.chartType === 'horizontalBar' ? 'y' : 'x',
plugins: {
+ legend: {
+ // Only display legends if more than one dataset is provided.
+ display: this.datasets.length > 1,
+ },
datalabels: {
align: this.chartType === 'bar' ? 'top' : 'center',
},
},
};
- const chartTypeDefaults:ChartOptions = (() => {
- if (this.chartType === 'horizontalBar' || this.chartType === 'bar') {
- return this.setChartAxesValues();
- }
-
- return { scales: {} };
- })();
-
this.internalChartOptions = {
...defaults,
- ...chartTypeDefaults,
...this.chartOptions,
};
}
@@ -128,6 +120,10 @@ export class WorkPackageEmbeddedGraphComponent {
return this.chartData.length > 0 && this.chartData.some((set) => set.data.length > 0);
}
+ public get mappedChartType():string {
+ return this.chartType === 'horizontalBar' ? 'bar' : this.chartType;
+ }
+
private setHeight() {
if (this.chartType === 'horizontalBar' && this.datasets && this.datasets[0]) {
const labels:string[] = [];
@@ -151,36 +147,4 @@ export class WorkPackageEmbeddedGraphComponent {
this.chartHeight = '100%';
}
}
-
- // function to set ticks of axis
- private setChartAxesValues() {
- const chartOptions:ChartOptions = { scales: {} };
- const changeableValuesAxis = [{
- stacked: true,
- ticks: {
- callback: (value:number) => {
- if (Math.floor(value) === value) {
- return value;
- }
- return null;
- },
- },
- }];
-
- const constantValuesAxis = [{
- stacked: true,
- }];
-
- if (chartOptions.scales) {
- if (this.chartType === 'bar') {
- chartOptions.scales.yAxes = changeableValuesAxis;
- chartOptions.scales.xAxes = constantValuesAxis;
- } else if (this.chartType === 'horizontalBar') {
- chartOptions.scales.xAxes = changeableValuesAxis;
- chartOptions.scales.yAxes = constantValuesAxis;
- }
- }
-
- return chartOptions;
- }
}
diff --git a/frontend/src/app/shared/components/work-package-graphs/embedded/wp-embedded-graph.html b/frontend/src/app/shared/components/work-package-graphs/embedded/wp-embedded-graph.html
index 04763758fb2..e6695ea0876 100644
--- a/frontend/src/app/shared/components/work-package-graphs/embedded/wp-embedded-graph.html
+++ b/frontend/src/app/shared/components/work-package-graphs/embedded/wp-embedded-graph.html
@@ -2,7 +2,7 @@
<canvas baseChart
[datasets]="chartData"
[labels]="chartLabels"
- [chartType]="chartType"
+ [chartType]="mappedChartType"
[options]="internalChartOptions"
*ngIf="hasDataToDisplay">
</canvas>
diff --git a/spec/features/versions/graph_spec.rb b/spec/features/versions/graph_spec.rb
index b88d1f09dd1..d8d9080693c 100644
--- a/spec/features/versions/graph_spec.rb
+++ b/spec/features/versions/graph_spec.rb
@@ -46,6 +46,6 @@ RSpec.describe 'version show graph', js: true do
it 'shows a status graph' do
expect(page).to have_selector('.work-packages-embedded-view--container', wait: 20)
- expect(page).to have_selector('.chartjs-size-monitor', visible: :all, wait: 20)
+ expect(page).to have_selector('.op-wp-embeded-graph', visible: :all, wait: 20)
end
end