import React from 'react'; import { useIntl } from 'react-intl'; import CheckVisible from 'components/helpers/CheckVisible'; import BarChart from './BarChart'; export default function PageviewsChart({ websiteId, data, unit, records, className }) { const intl = useIntl(); const handleUpdate = chart => { const { data: { datasets }, } = chart; datasets[0].data = data.uniques; datasets[0].label = intl.formatMessage({ id: 'metrics.unique-visitors', defaultMessage: 'Unique visitors', }); datasets[1].data = data.pageviews; datasets[1].label = intl.formatMessage({ id: 'metrics.page-views', defaultMessage: 'Page views', }); chart.update(); }; if (!data) { return null; } return ( {visible => ( )} ); }