Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart not rendering data correctly #473

Open
kpermenter opened this issue Jul 18, 2020 · 2 comments
Open

Chart not rendering data correctly #473

kpermenter opened this issue Jul 18, 2020 · 2 comments
Assignees

Comments

@kpermenter
Copy link

I have the below code and a few of the regions aren't rendering correctly. The queries are correct, so I'm guessing the definition is set up incorrectly?

Any help would be greatly appreciated!

var definition = {
type: "area",
datasets: [
{
url: "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
name: "Asia Pacific",
query: {
where: "Region='Asia Pacific' AND Type='Export' AND Start_up>=1964",
orderByFields: "Start_up",
groupByFieldsForStatistics: "Start_up",
outStatistics: [{
statisticType: "sum",
onStatisticField: "Project_ca",
outStatisticFieldName: "Project_ca_SUM"
}]
},
join: "Start_up",
},
{
url: "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
name: "Middle East",
query: {
where: "Region='Middle East' AND Type='Export' AND Start_up>=1964",
orderByFields: "Start_up",
groupByFieldsForStatistics: "Start_up",
outStatistics: [{
statisticType: "sum",
onStatisticField: "Project_ca",
outStatisticFieldName: "Project_ca_SUM"
}]
},
join: "Start_up",
},
{
url: "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
name: "Europe",
query: {
where: "Region='Europe' AND Type='Export' AND Start_up>=1964",
orderByFields: "Start_up",
groupByFieldsForStatistics: "Start_up",
outStatistics: [{
statisticType: "sum",
onStatisticField: "Project_ca",
outStatisticFieldName: "Project_ca_SUM"
}]
},
join: "Start_up",
},
{
url: "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
name: "North America",
query: {
where: "Region='North America' AND Type='Export' AND Start_up>=1964",
orderByFields: "Start_up",
groupByFieldsForStatistics: "Start_up",
outStatistics: [{
statisticType: "sum",
onStatisticField: "Project_ca",
outStatisticFieldName: "Project_ca_SUM"
}]
},
join: "Start_up",
},
{
url: "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
name: "Africa",
query: {
where: "Region='Africa' AND Type='Export' AND Start_up>=1964",
orderByFields: "Start_up",
groupByFieldsForStatistics: "Start_up",
outStatistics: [{
statisticType: "sum",
onStatisticField: "Project_ca",
outStatisticFieldName: "Project_ca_SUM"
}]
},
join: "Start_up",
},
{
url: "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
name: "Latin America",
query: {
where: "Region='Latin America' AND Type='Export' AND Start_up>=1964",
orderByFields: "Start_up",
groupByFieldsForStatistics: "Start_up",
outStatistics: [{
statisticType: "sum",
onStatisticField: "Project_ca",
outStatisticFieldName: "Project_ca_SUM"
}]
},
join: "Start_up",
},
],

series: [
{
category: { "field": "Start_up", "label": "Years" },
source: "Asia Pacific",
value: {
field: "Project_ca_SUM",
label: "Asia Pacific",
}
},
{
category: { "field": "Start_up", "label": "Years" },
source: "Middle East",
value: {
field: "Project_ca_SUM",
label: "Middle East",
}
},
{
category: { "field": "Start_up", "label": "Years" },
source: "Europe",
value: {
field: "Project_ca_SUM",
label: "Europe",
}
},
{
category: { "field": "Start_up", "label": "Years" },
source: "North America",
value: {
field: "Project_ca_SUM",
label: "North America",
}
},
{
category: { "field": "Start_up", "label": "Years" },
source: "Africa",
value: {
field: "Project_ca_SUM",
label: "Africa",
}
},
{
category: { "field": "Start_up", "label": "Years" },
source: "Latin America",
value: {
field: "Project_ca_SUM",
label: "Latin America",
}
},
]
}
var chart = new cedar.Chart("chartLine2", definition);
chart.show();

@ajturner
Copy link
Member

I put this JSON in the custom editor and saw this:
image

can you clarify which regions are not showing correctly?

{
    "type": "area",
    "datasets": [
        {
            "url": "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
            "name": "Asia Pacific",
            "query": {
                "where": "Region='Asia Pacific' AND Type='Export' AND Start_up>=1964",
                "orderByFields": "Start_up",
                "groupByFieldsForStatistics": "Start_up",
                "outStatistics": [
                    {
                        "statisticType": "sum",
                        "onStatisticField": "Project_ca",
                        "outStatisticFieldName": "Project_ca_SUM"
                    }
                ]
            },
            "join": "Start_up"
        },
        {
            "url": "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
            "name": "Middle East",
            "query": {
                "where": "Region='Middle East' AND Type='Export' AND Start_up>=1964",
                "orderByFields": "Start_up",
                "groupByFieldsForStatistics": "Start_up",
                "outStatistics": [
                    {
                        "statisticType": "sum",
                        "onStatisticField": "Project_ca",
                        "outStatisticFieldName": "Project_ca_SUM"
                    }
                ]
            },
            "join": "Start_up"
        },
        {
            "url": "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
            "name": "Europe",
            "query": {
                "where": "Region='Europe' AND Type='Export' AND Start_up>=1964",
                "orderByFields": "Start_up",
                "groupByFieldsForStatistics": "Start_up",
                "outStatistics": [
                    {
                        "statisticType": "sum",
                        "onStatisticField": "Project_ca",
                        "outStatisticFieldName": "Project_ca_SUM"
                    }
                ]
            },
            "join": "Start_up"
        },
        {
            "url": "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
            "name": "North America",
            "query": {
                "where": "Region='North America' AND Type='Export' AND Start_up>=1964",
                "orderByFields": "Start_up",
                "groupByFieldsForStatistics": "Start_up",
                "outStatistics": [
                    {
                        "statisticType": "sum",
                        "onStatisticField": "Project_ca",
                        "outStatisticFieldName": "Project_ca_SUM"
                    }
                ]
            },
            "join": "Start_up"
        },
        {
            "url": "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
            "name": "Africa",
            "query": {
                "where": "Region='Africa' AND Type='Export' AND Start_up>=1964",
                "orderByFields": "Start_up",
                "groupByFieldsForStatistics": "Start_up",
                "outStatistics": [
                    {
                        "statisticType": "sum",
                        "onStatisticField": "Project_ca",
                        "outStatisticFieldName": "Project_ca_SUM"
                    }
                ]
            },
            "join": "Start_up"
        },
        {
            "url": "https://gulfpub-gisstg.esriemcs.com/server/rest/services/EWA_Global_Assets/MapServer/3",
            "name": "Latin America",
            "query": {
                "where": "Region='Latin America' AND Type='Export' AND Start_up>=1964",
                "orderByFields": "Start_up",
                "groupByFieldsForStatistics": "Start_up",
                "outStatistics": [
                    {
                        "statisticType": "sum",
                        "onStatisticField": "Project_ca",
                        "outStatisticFieldName": "Project_ca_SUM"
                    }
                ]
            },
            "join": "Start_up"
        }
    ],
    "series": [
        {
            "category": {
                "field": "Start_up",
                "label": "Years"
            },
            "source": "Asia Pacific",
            "value": {
                "field": "Project_ca_SUM",
                "label": "Asia Pacific"
            }
        },
        {
            "category": {
                "field": "Start_up",
                "label": "Years"
            },
            "source": "Middle East",
            "value": {
                "field": "Project_ca_SUM",
                "label": "Middle East"
            }
        },
        {
            "category": {
                "field": "Start_up",
                "label": "Years"
            },
            "source": "Europe",
            "value": {
                "field": "Project_ca_SUM",
                "label": "Europe"
            }
        },
        {
            "category": {
                "field": "Start_up",
                "label": "Years"
            },
            "source": "North America",
            "value": {
                "field": "Project_ca_SUM",
                "label": "North America"
            }
        },
        {
            "category": {
                "field": "Start_up",
                "label": "Years"
            },
            "source": "Africa",
            "value": {
                "field": "Project_ca_SUM",
                "label": "Africa"
            }
        },
        {
            "category": {
                "field": "Start_up",
                "label": "Years"
            },
            "source": "Latin America",
            "value": {
                "field": "Project_ca_SUM",
                "label": "Latin America"
            }
        }
    ]
}

@ajturner
Copy link
Member

Looking at the graphic, I do see there is an issue where they series are "cross-linked" to one another. There may be an issue with how the Join is being done.

@ajturner ajturner self-assigned this Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants