folkehelseinstituttet / Fhi.Frontend.Demo

MIT License
2 stars 1 forks source link

Table fails when two series have the same name #557

Closed proand closed 1 month ago

proand commented 2 months ago

Describe your issue

Diagram type "Table" in FHI Angular Highcharts fails when two series have the same name.

Steps to reproduce

Go to Demo april visning

Supplementary information

Use the following test data to mock the same in the demo app:

{
    "title": "abc",
    "series": [
        {
            "name": "Hele landet",
            "data": [
                {
                    "name": "2015",
                    "y": 10.3
                },
                {
                    "name": "2016",
                    "y": 10.3
                }
            ]
        },
        {
            "name": "Oslo",
            "data": [
                {
                    "name": "2015",
                    "y": 20.7
                },
                {
                    "name": "2016",
                    "y": 20.7
                }
            ]
        },
        {
            "name": "Østfold",
            "data": [
                {
                    "name": "2015",
                    "y": 8.8
                },
                {
                    "name": "2016",
                    "y": 9
                }
            ]
        },
        {
            "name": "Oslo",
            "data": [
                {
                    "name": "2015",
                    "y": 20.7
                },
                {
                    "name": "2016",
                    "y": 20.7
                }
            ]
        }
    ],
    "diagramTypeId": "table",
    "diagramTypeNavId": "default",
    "openSource": false,
    "flags": [
        {
            "symbol": "..",
            "label": "Manglende data"
        },
        {
            "symbol": ":",
            "label": "Anonymisert eller skjult av andre årsaker"
        }
    ],
    "tableOrientation": "seriesAsRows",
    "diagramTypeSubset": [
        "barStacked",
        "columnStacked",
        "column",
        "line",
        "table"
    ],
    "decimals": 1,
    "seriesHasDecimalDataPoints": true
}
proand commented 1 month ago

@VillereV I wonder if this is an acceptable solution:

Image

@cathral may of course come up with a better text for the error message 😄

VillereV commented 1 month ago

@proand The suggested solution sounds OK to me.