woocommerce/plugins/woocommerce-admin/client/components/chart
Robert Elliott c11da940e2 if legend item unchecked no hover status
modified:   client/components/chart/legend.js
	modified:   client/components/chart/style.scss
	modified:   package-lock.json
2018-09-06 18:15:08 +02:00
..
d3-base rebase with master after some afk 2018-08-13 12:24:10 +02:00
test exmple-hour update 2018-09-06 11:40:29 +02:00
README.md updated README 2018-09-05 23:22:34 +02:00
charts.js updated from feedback 2018-09-06 17:58:24 +02:00
example-hour.js exmple-hour update 2018-09-06 11:40:29 +02:00
example.js Components: Export reusable components to a separate file + global (https://github.com/woocommerce/woocommerce-admin/pull/297) 2018-08-20 17:18:13 -04:00
index.js x, y and tooltip formatting 2018-09-05 23:02:13 +02:00
legend.js if legend item unchecked no hover status 2018-09-06 18:15:08 +02:00
placeholder.js Add loading indicators, error state, and EmptyContent to the revenue report. (#347, woocommerce/woocommerce-admin#348) 2018-09-05 12:45:49 -04:00
style.scss if legend item unchecked no hover status 2018-09-06 18:15:08 +02:00
utils.js updated README 2018-09-05 23:22:34 +02:00

README.md

D3 Chart Component

A simple D3 line and bar chart component for timeseries data in React.

Usage

<Chart
	data={ timeseries }
	tooltipFormat={ 'Date is %Y-%m-%d' }
	type={ 'bar' }
	xFormat={ '%d' }
	yFormat={ '.3s' }
/>

Expected Data Format

This component accepts timeseries data prop in the following format (with dates following the ISO 8601 format):

[
	{
		date: '%Y-%m-%dT%H:%M:%S', // string
		category1: value, // number
		category2: value, // number
		...
	},
	...
]

For example:

[
	{
		date: '2018-06-25T00:00:00',
		category1: 1234.56,
		category2: 9876,
		...
	},
	...
]

Props

Required props are marked with *.

Name Type Default Description
data* array none An array of data as specified above(below)
type* string line Chart type of either line or bar
title string none Chart title
tooltipFormat string %Y-%m-%d Title and format of the tooltip title
xFormat string %Y-%m-%d d3TimeFormat of the x-axis values
yFormat string .3s d3Format of the y-axis values