-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #469 from geonetwork/wc-dataviz
Add a web component for viewing a dataset as a chart
- Loading branch information
Showing
23 changed files
with
239 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
|
||
:host { | ||
font-family: Roboto, 'Helvetica Neue', sans-serif; | ||
display: block; | ||
} |
5 changes: 5 additions & 0 deletions
5
...ebcomponents/src/app/components/gn-dataset-view-chart/gn-dataset-view-chart.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '../../../styles.css'; | ||
|
||
:host { | ||
display: block; | ||
} |
1 change: 1 addition & 0 deletions
1
...bcomponents/src/app/components/gn-dataset-view-chart/gn-dataset-view-chart.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<gn-ui-chart-view class="h-full" [link]="link"></gn-ui-chart-view> |
39 changes: 39 additions & 0 deletions
39
...webcomponents/src/app/components/gn-dataset-view-chart/gn-dataset-view-chart.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
ChangeDetectorRef, | ||
Component, | ||
Injector, | ||
Input, | ||
OnInit, | ||
ViewEncapsulation, | ||
} from '@angular/core' | ||
import { SearchFacade, SearchService } from '@geonetwork-ui/feature/search' | ||
import { BaseComponent } from '../base.component' | ||
import { LinkUsage, MetadataLink } from '@geonetwork-ui/util/shared' | ||
|
||
@Component({ | ||
selector: 'wc-gn-dataset-view-chart', | ||
templateUrl: './gn-dataset-view-chart.component.html', | ||
styleUrls: ['./gn-dataset-view-chart.component.css'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
encapsulation: ViewEncapsulation.ShadowDom, | ||
providers: [SearchFacade, SearchService], | ||
}) | ||
export class GnDatasetViewChartComponent | ||
extends BaseComponent | ||
implements OnInit | ||
{ | ||
@Input() datasetId!: string | ||
link: MetadataLink | ||
constructor(injector: Injector, private changeDetector: ChangeDetectorRef) { | ||
super(injector) | ||
} | ||
async init() { | ||
super.init() | ||
this.link = await this.getRecordLink(this.datasetId, [ | ||
LinkUsage.DATA, | ||
LinkUsage.GEODATA, | ||
]) | ||
this.changeDetector.detectChanges() | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
.../webcomponents/src/app/components/gn-dataset-view-chart/gn-dataset-view-chart.sample.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Web Component Demo</title> | ||
<base href="./" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Inter:wght@200;300;400;500;600;700&display=swap" | ||
rel="stylesheet" | ||
type="text/css" | ||
/> | ||
<style> | ||
html, | ||
body { | ||
font-family: var(--font-family-main); | ||
} | ||
.container { | ||
max-width: 1024px; | ||
margin-left: auto; | ||
margin-right: auto; | ||
margin-top: 3rem; | ||
} | ||
gn-dataset-view-chart { | ||
height: 500px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<main class="container"> | ||
<div style="margin: 60px 16px"> | ||
<p> | ||
Visualize dataset as a chart from a Metadata Record with | ||
<b><i>gn-dataset-view-chart</i></b> web component | ||
</p> | ||
</div> | ||
|
||
<script src="gn-wc.js"></script> | ||
<gn-dataset-view-chart | ||
api-url="https://dev.geo2france.fr/geonetwork/srv/api" | ||
dataset-id="population-mel" | ||
primary-color="#0f4395" | ||
secondary-color="#8bc832" | ||
main-color="#555" | ||
background-color="#fdfbff" | ||
main-font="'Inter', sans-serif" | ||
title-font="'DM Serif Display', serif" | ||
></gn-dataset-view-chart> | ||
</main> | ||
</body> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
...ebcomponents/src/app/components/gn-dataset-view-table/gn-dataset-view-table.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
@import '../../../styles.css'; | ||
|
||
:host { | ||
display: block; | ||
} |
2 changes: 1 addition & 1 deletion
2
...bcomponents/src/app/components/gn-dataset-view-table/gn-dataset-view-table.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<gn-ui-data-view mode="table"></gn-ui-data-view> | ||
<gn-ui-table-view class="h-full" [link]="link"></gn-ui-table-view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
apps/webcomponents/src/app/components/gn-facets/gn-facets.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
@import '../../../styles.css'; | ||
|
||
:host { | ||
display: block; | ||
} |
4 changes: 4 additions & 0 deletions
4
apps/webcomponents/src/app/components/gn-map-viewer/gn-map-viewer.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
@import '../../../styles.css'; | ||
|
||
:host { | ||
display: block; | ||
} |
45 changes: 0 additions & 45 deletions
45
apps/webcomponents/src/app/components/gn-map-viewer/gn-map-viewer.component.spec.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.