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

There are couple of issues found inbook. #6

Open
mutantkeyboard opened this issue Sep 29, 2017 · 0 comments
Open

There are couple of issues found inbook. #6

mutantkeyboard opened this issue Sep 29, 2017 · 0 comments

Comments

@mutantkeyboard
Copy link

mutantkeyboard commented Sep 29, 2017

First of all, the code in chapter two for filter uses dim instead of dims, so the updated code should be

export default async function lifeExpectancyTable() {
    const getData = async() => {
        try{
            const response = await fetch('data/data.json');
            const raw = await response.json(); 
            // pay attention to the dims, and not dim
            return raw.fact.filter(d => d.dims.GHO === 'Life expectancy at birth (years)'
        && d.dims.SEX === 'Both sexes' && d.dims.YEAR === '2014')
        .map(d => [
            d.dims.COUNTRY,
            d.Value,
        ]);

        } catch (e) {
            console.error(e);
            return undefined;
        }
    };
    const data = await getData();

    data.unshift(['Country', 'Life expectancy (years from birth)']);
    return tableFactory(data);

}

However, the datatable is shown with the values, but not headers which are shown as 0 and 1.

err

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

1 participant