Skip to content

Commit 0bc4f7e

Browse files
committed
add chart doc
1 parent 79d514d commit 0bc4f7e

40 files changed

+2919
-329
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,14 @@ Build production `js`, `min.js` code
211211
$ npm run prod
212212
```
213213

214+
### Docs
215+
216+
If you want to modify the docs file, please modify `docs_pre` folder.
217+
218+
After you finish, remember to install [smash-md](https://github.com/Canner/smash-md) first, then run `sh doc.sh` to compile the readme.
219+
220+
Your new readme would show in `docs` folder.
221+
214222
## License
215223

216224
Apache 2.0

doc.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
for filename in docs_pre/**/*.md docs_pre/**/**/*.md; do
3+
dist=${filename//docs_pre\//docs\/}
4+
dir=${dist%/*}
5+
mkdir -p "$dir"
6+
smashmd $filename > $dist
7+
done
8+

docs/charts/area_stack_chart.md

Lines changed: 205 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,208 @@
1-
## Area Stack Chart Example
1+
# Area Stack Chart
2+
3+
Area stack chart combines the `components/area_stack` and `x,y-axis`
4+
5+
## Required Props
6+
7+
### data
8+
9+
- type: `array of object`
10+
11+
each object has same key
12+
13+
example:
14+
15+
[{
16+
"date": "04/23/12",
17+
"Group1": "-20",
18+
"Group2": "12",
19+
"Group3": "46"
20+
}, {
21+
"date": "04/24/12",
22+
"Group1": "32",
23+
"Group2": "-20",
24+
"Group3": "24"
25+
}]
26+
27+
28+
29+
#### x
30+
31+
- type: `function`
32+
33+
parsed data function
34+
35+
#### chartSeries
36+
37+
- type: `array of object`
38+
- field: `required`, define the data field
39+
- name: `optional`, the show name of this data. default is the same with field.
40+
- color: `optional`, show categorical color
41+
42+
example:
43+
44+
[{
45+
field: "Group1",
46+
name: "Group 1",
47+
color: "red"
48+
},
49+
{
50+
field: "Group2",
51+
name: "Group 2",
52+
color: "black"
53+
}]
54+
55+
## Appearance Props (optional)
56+
57+
### title
58+
59+
- type: string
60+
61+
the title of the graph
62+
63+
### width
64+
65+
- type: int
66+
- default: `960`
67+
68+
the width of the graph
69+
70+
### height
71+
72+
- type: int
73+
- default: `500`
74+
75+
the height of the graph
76+
77+
78+
### margins
79+
80+
- type: object
81+
- default: `{top: 80, right: 100, bottom: 80, left: 100}`
82+
83+
margins of the graph
84+
85+
### id
86+
87+
- type: stirng
88+
89+
- default : `null`
90+
91+
## X axis props (optional)
92+
93+
### xDomain
94+
95+
reference [react-d3-core](https://github.com/react-d3/react-d3-core) for more detail
96+
97+
### xScale
98+
99+
- type: boolean
100+
- default: `true`
101+
102+
### xOrient
103+
104+
### xTickOrient
105+
106+
### xLabel
107+
108+
### xRange
109+
110+
111+
## Y axis props (optional)
112+
113+
### y
114+
115+
- type: function
116+
117+
- default: `y: (d) => {return +d;}`
118+
119+
120+
### yOrient
121+
122+
### yRange
123+
124+
### yDomain
125+
126+
reference [react-d3-core](https://github.com/react-d3/react-d3-core) for more details.
127+
128+
### yScale
129+
130+
- type: boolean
131+
- default: `true`
132+
133+
### yTickOrient
134+
135+
### yTicks
136+
137+
### yLabel
138+
139+
### yLabelPosition
140+
141+
## Show Props (optional)
142+
143+
### interpolate
144+
145+
please reference d3 interpolate
146+
147+
### showXAxis
148+
149+
- type: boolean
150+
- default: `true`
151+
152+
### showYAxis
153+
154+
- type: boolean
155+
- default: `true`
156+
157+
### showXGrid
158+
159+
- type: boolean
160+
- default: `true`
161+
162+
### showYGrid
163+
164+
- type: boolean
165+
- default: `true`
166+
167+
### showLegend
168+
169+
- type: boolean
170+
- default: `true`
171+
172+
### categoricalColors
173+
174+
- default: `d3.scale.category10()`
175+
176+
you must send one of the d3 categorical colors. [reference](https://github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors)
177+
178+
## Class Props (optional)
179+
180+
### svgClassName
181+
182+
- type: string
183+
- default: `null`
184+
185+
### titleClassName
186+
187+
- type: string
188+
- default: `null`
189+
190+
### yAxisClassName
191+
192+
- type: string
193+
- default: `null`
194+
195+
### xAxisClassName
196+
197+
- type: string
198+
- default: `null`
199+
200+
### legendClassName
201+
202+
- type: string
203+
- default: `null`
204+
205+
## Example
2206

3207
```js
4208
"use strict";
@@ -109,46 +313,3 @@ var AreaStackChart = require('react-d3-basic').AreaStackChart;
109313
)
110314
})()
111315
```
112-
113-
## Settings
114-
115-
### Basic Settings
116-
117-
- interpolate
118-
- chartSeries
119-
- data
120-
- xDomain
121-
- yDomain
122-
- x
123-
- y
124-
- categoricalColors
125-
126-
127-
### Show Implements
128-
129-
- showXGrid
130-
- showYGrid
131-
- showLegend
132-
133-
----
134-
135-
## Components
136-
137-
### Plotting
138-
139-
- AreaStack
140-
141-
### Core
142-
143-
#### Axis
144-
145-
- Xaxis
146-
- Yaxis
147-
148-
#### Grid
149-
150-
- Grid
151-
152-
#### Legend
153-
154-
- legend

0 commit comments

Comments
 (0)