import React, {useEffect, useState} from 'react'
import { Chart, LineAdvance} from 'bizcharts';

const GraficoPublicacoesDiariasPorComunidade = () => {
    const [data, setData] = useState([])
    useEffect(() => {
        netuno.service({
            url: "/services/publicacoes/graficos/comunidades/diaria",
            method: "GET",
            credentials: 'include',
            headers: {
                'Content-Type': 'application/json'
            },
            success: (response)=> {
                if (response.json) {
                    setData(response.json)
                } else {
                    fail();
                }
            },
            fail: ()=> {
                fail();
            }
        })
    }, [])
    const fail = ()=> {
        setLoader(false)
        notification["error"]({
            message: 'Error',
            description: 'Data loading error...',
            style: {
                marginTop: 100,
            }
        });
    };
    return(
        <Chart padding={[10, 20, 50, 40]} autoFit height={300} data={data}>
            <LineAdvance
            shape="smooth"
			point
			area
			position="dia*total"
			color="comunidade" />
        </Chart>
    )
}

export default GraficoPublicacoesDiariasPorComunidade