File size: 1,666 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Chart

This module renders a dataset as an HTML-based chart representing the data.

## Usage

```jsx
// import the component
import ElementChart from 'calypso/my-sites/chart';

// And use it inline inside the render method of another component
function render() {
	return (
		<ElementChart
			loading={ loading /*boolean*/ }
			data={ data /*array*/ }
			barClick={ barClick /*function*/ }
		/>
	);
}

// Example Data Array
/*
[ {
	'label': 		<String>, // x-axis label
	'value': 		<Number>, // bar value
	'nestedValue':	<Number>, // nested bar value or null if no nested bar
	'className': 	<String>, // classname(s) applied to bar container
	'data':			<Object>, // any data that you want to have access to in the barClick callback
	'tooltipData':	[
		{
			label: 		<String>,
			value: 		<Number>,
			link: 		<String>,
			icon: 		<String>,
			className: 	<String>
		}
	]
} ]
*/
```

## Required Props

- <strong>loading</strong> — Any truthy value indicates the chart is loading
- <strong>data</strong> — An array of data objects using the format outlined above

## Optional Props

- <strong>minTouchBarWidth</strong>_default: 42_ The minimum bar width on touch devices
- <strong>minBarWidth</strong>_default: 15_ The minimum bar width on non-touch devices
- <strong>barClick</strong> - The function to be called when a bar is clicked on the chart, it is passed the entire data object of the bar
- <strong>minBarsToBeShown</strong> - The minimun no of bars to be shown
- <strong>hideYAxis</strong> - _default: false_ A boolean value whether to hide the y-axis
- <strong>hideXAxis</strong> - _default: false_ A boolean value whether to hide the x-axis