Skip to content

Commit

Permalink
Merge branch 'dev' into bugfix/dynamically-add-diagram-types-to-nav
Browse files Browse the repository at this point in the history
* dev:
  Add support for showing diagram type line with multiple series even if flagged.  (#664)
  • Loading branch information
Bernt Andersen committed Sep 12, 2024
2 parents edf7381 + 3201e9f commit c331a5d
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ speed-measure-plugin*.json
*.launch
.settings/
*.sublime-workspace
/.vs

# IDE - VSCode
.vscode/*
Expand Down
10 changes: 8 additions & 2 deletions projects/fhi-angular-highcharts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# 4.3.0
# Unreleased

> Sep 9, 2024
> Sep 12, 2024
* :bug: **Bugfix** Make it possible to dynamically add diagram types to the diagram type navigation.
* :tada: **Enhancement** Add support for showing diagram type line with multiple series even if flagged. This will also affect diagram type line with single series: data points will no longer be removed, instead the line will be broken.

## 4.3.0

> Sep 9, 2024
* :tada: **Enhancement** Give the diagrams better aspect ratios on differnt screen widths.
* :bug: **Bugfix** Remove diagram type navigation from fullscreen view since the navigation fails if diagram type is disabled, and since it doesn't add that much value for the end user.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ export class DiagramTypeGroupService {
case DiagramTypeIdValues.columnStacked:
return this.disableColumnStacked();

case DiagramTypeIdValues.line:
return this.disableLine();

case DiagramTypeIdValues.mapFylker:
case DiagramTypeIdValues.mapFylker2019:
case DiagramTypeIdValues.mapFylker2023:
Expand Down Expand Up @@ -243,14 +240,6 @@ export class DiagramTypeGroupService {
return false;
}

private disableLine(): boolean {
if (this.disableBar()) {
this.diagramTypeDisabledWarnings.line = this.diagramTypeDisabledWarningsText.flaggedData;
return true;
}
return false;
}

private disableMap(): boolean {
let disable = false;
let message: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ export class OptionsService {

private updateOptionsForCurrentDiagramType(options: Options): Options {
switch (this.diagramOptions.activeDiagramType) {
case DiagramTypeIdValues.line:
options.series = this.setStringToNull(this.diagramOptions.series);
break;

case DiagramTypeIdValues.pie:
if (options.legend && options.legend.title) {
options.legend.title.text = options.series[0].name;
Expand All @@ -151,6 +155,18 @@ export class OptionsService {
return options;
}

private setStringToNull(series: FhiDiagramSerie[]): SeriesOptionsType[] {
const newSeries = cloneDeep(series);
newSeries.forEach((serie) => {
serie.data.forEach((dataPoint) => {
if (typeof dataPoint.y === 'string') {
dataPoint.y = null;
}
});
});
return newSeries as SeriesOptionsType[];
}

private getSeriesWithoutFlaggedDataPoints() {
const seriesWithoutFlags = cloneDeep(this.diagramOptions.series);
seriesWithoutFlags.forEach((serie) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<option value="3b">{{ titles.title_3b }}</option>
<option value="3c">{{ titles.title_3c }}</option>
<option value="3d">{{ titles.title_3d }}</option>
<!-- <option value="3e">{{ titles.title_3e }}</option> -->
<option value="3e">{{ titles.title_3e }}</option>
</select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,15 @@ export class HighchartsComponent implements OnInit {
activeDiagramType: 'line',
title: this.titles.title_3e,
units: undefined,
footer: {
credits: {
href: 'https://www.fhi.no',
text: 'Folkehelseinstituttet',
},
disclaimer: 'Disse dataene kan inneholde feil.',
flags: [{ symbol: '.', label: 'Lar seg ikke beregne' }],
lastUpdated: '18.04.2024',
},
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const PrikkedeDataMedToSerier = [
{ name: '2011', y: 6967 },
{ name: '2012', y: 7057 },
{ name: '2013', y: 6581 },
{ name: '2014', y: ':' },
{ name: '2014', y: '.' },
{ name: '2015', y: 6195 },
{ name: '2016', y: 5817 },
{ name: '2017', y: 5436 },
Expand All @@ -26,7 +26,7 @@ export const PrikkedeDataMedToSerier = [
{ name: '2013', y: 5760 },
{ name: '2014', y: 5500 },
{ name: '2015', y: 5457 },
{ name: '2016', y: ':' },
{ name: '2016', y: '.' },
{ name: '2017', y: 4941 },
{ name: '2018', y: 4857 },
],
Expand Down

0 comments on commit c331a5d

Please sign in to comment.