2019-05-06 04:39:10 +00:00
|
|
|
/** @format */
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import moment from 'moment';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WooCommerce dependencies
|
|
|
|
*/
|
|
|
|
import { Card, Chart } from '@woocommerce/components';
|
|
|
|
import { formatCurrency } from '@woocommerce/currency';
|
|
|
|
|
|
|
|
const data = [];
|
|
|
|
|
|
|
|
for ( let i = 1; i <= 20; i++ ) {
|
|
|
|
const date = moment().subtract( i, 'days' );
|
|
|
|
data.push( {
|
|
|
|
date: date.format( 'YYYY-MM-DDT00:00:00' ),
|
|
|
|
primary: {
|
|
|
|
label: 'Global Apple Prices, last 20 days',
|
|
|
|
labelDate: date.format( 'YYYY-MM-DD 00:00:00' ),
|
|
|
|
value: Math.floor( Math.random() * 100 ),
|
|
|
|
},
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
const GlobalPrices = () => {
|
|
|
|
return (
|
2019-05-23 20:09:59 +00:00
|
|
|
<Card className="woocommerce-dashboard__chart-block woocommerce-analytics__card" title="Global Apple Prices">
|
2019-05-06 04:39:10 +00:00
|
|
|
<Chart
|
|
|
|
title="Global Apple Prices"
|
|
|
|
interval="day"
|
|
|
|
data={ data.reverse() }
|
|
|
|
dateParser="%Y-%m-%dT%H:%M:%S"
|
|
|
|
showHeaderControls={ false }
|
|
|
|
valueType={ 'currency' }
|
|
|
|
tooltipValueFormat={ formatCurrency }
|
|
|
|
/>
|
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default GlobalPrices;
|