components#Visualization TypeScript Examples

The following examples show how to use components#Visualization. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.tsx    From covid19-visualized with MIT License 6 votes vote down vote up
Page: NextPage = () => {
    const { data } = useFetch<Country[]>(API_BASEURL + 'confirmed')()

    return (
        <>
            <Summary />
            
            <div className="btn-link mb-24">
                <Link href="/region">
                    <Button block color="primary" text="See Country and Region Cases" />
                </Link>
                <Link href="/indonesia">
                    <Button className="mt-8" block color="danger" text="See Indonesia Cases" />
                </Link>
            </div>

            <h2 className="text-center mt-32 mb-12">World Visualization</h2>
            <Visualization
                id="world-visualization"
                data={data}
                visualize={visualize.world}
                legends={worldLegends.map(({ color, value }) => (
                    <div key={color} className="legends-item font is-size-small">
                        <div className="legends-detail">{value === 0 ? `No case infected` : `${value} or more cases infected`}</div>
                        <div className="legends-color mx-4" style={{ backgroundColor: color }} />
                    </div>
                ))}
            />
            
            <Daily />
        </>
    )
}
Example #2
Source File: index.tsx    From covid19-visualized with MIT License 5 votes vote down vote up
Page: NextPage = () => {
    const { data } = useFetch<IDFormat<IDProvince[]>>(API_INDONESIA + 'provinsi')(
        data => {
            data.data = data.data.filter(({ kodeProvi }) => kodeProvi)
            return data
        }
    )

    return (
        <>
            <Head>
                <title>Indonesia Daily Update | COVID-19 Visualized</title>
                {meta}
            </Head>

            <div className="text-center my-12">
                <h1 className="my-2">Indonesia Update</h1>
            </div>

            <div className="divider-line" />

            <Summary />

            <div className="btn-link my-24">
                <Link href="/indonesia/province">
                    <Button className="my-4" block color="primary" text="See Province Cases" />
                </Link>
                <Link href="/indonesia/cases">
                    <Button className="my-4" block color="success" text="See Case details" />
                </Link>
                <Link href="/">
                    <Button className="my-4" block color="secondary" text="< Back to Home" />
                </Link>
            </div>

            <h2 className="text-center mt-32 mb-12">Indonesia Visualization</h2>
            <Visualization
                id="indonesia-visualization"
                data={data?.data}
                visualize={visualize.indonesia}
                legends={indonesiaLegends.map(({ color, value }) => (
                    <div key={color} className="legends-item font is-size-small">
                        <div className="legends-detail">{value === 0 ? `Tidak ada kasus positif` : `${value} atau lebih kasus positif`}</div>
                        <div className="legends-color mx-4" style={{ backgroundColor: color }} />
                    </div>
                ))}
            />

            <Daily />
        </>
    )
}