1
1
Usage
2
2
================================================================================
3
3
4
- There are currently four type of data layouts for rendering charts.
4
+ There are currently four type of data layouts for rendering charts.
5
5
6
6
1 Simple Layout
7
7
--------------------------------------------------------------------------------
@@ -14,7 +14,7 @@ Pie chart
14
14
.. csv-table ::
15
15
:file: ../../pie.csv
16
16
17
-
17
+
18
18
Here is the source code using pyexcel
19
19
20
20
.. pyexcel-code ::
@@ -36,13 +36,15 @@ Box chart
36
36
.. image :: _static/pbox.svg
37
37
:width: 600px
38
38
:height: 400px
39
-
40
- Here is the source code using pyexcel::
41
39
42
- >>> import pyexcel as p
43
- >>> title = 'V8 benchmark results'
44
- >>> p.save_as(file_name='box.csv', dest_chart_type='box',
45
- ... dest_file_name='pbox.svg', dest_title=title)
40
+ Here is the source code using pyexcel:
41
+
42
+ .. pyexcel-code ::
43
+
44
+ title = 'V8 benchmark results'
45
+ sheet = pyexcel.get_sheet(file_name='box.csv')
46
+ svg = sheet.plot(chart_type='box',
47
+ title=title, width=600, height=400, explicit_size=True)
46
48
47
49
2 Complex layout
48
50
--------------------------------------------------------------------------------
58
60
.. csv-table ::
59
61
:file: ../../line.csv
60
62
61
- .. image :: _static/pline.svg
62
- :width: 600px
63
- :height: 400px
64
-
65
- Here is the source code using pyexcel::
63
+ Here is the source code using pyexcel:
64
+
65
+ .. pyexcel-code ::
66
66
67
- >>> import pyexcel as p
68
- >>> title = 'Browser usage evolution (in %)'
69
- >>> p.save_as(file_name='line.csv', dest_chart_type ='line',
70
- ... dest_file_name='pline.svg', dest_title=title )
67
+ title = 'Browser usage evolution (in %)'
68
+ sheet = pyexcel.get_sheet(file_name='line.csv')
69
+ svg = sheet.plot(chart_type ='line',
70
+ title=title, width=600, height=400, explicit_size=True )
71
71
72
72
Dot chart
73
73
********************************************************************************
74
74
75
75
.. csv-table ::
76
76
:file: ../../radar.csv
77
77
78
- .. image :: _static/pdot.svg
79
- :width: 600px
80
- :height: 400px
78
+ Here is the source code using pyexcel:
81
79
82
- Here is the source code using pyexcel::
80
+ .. pyexcel-code ::
83
81
84
- >>> import pyexcel as p
85
- >>> title = 'V8 benchmark results'
86
- >>> p.save_as(file_name='radar.csv', dest_chart_type ='dot',
87
- ... dest_file_name='pdot.svg', dest_title=title )
82
+ title = 'V8 benchmark results'
83
+ sheet = pyexcel.get_sheet(file_name='radar.csv')
84
+ svg = sheet.plot(chart_type ='dot',
85
+ title=title, width=600, height=400, explicit_size=True )
88
86
89
87
Funnel chart
90
88
********************************************************************************
91
89
92
90
.. csv-table ::
93
91
:file: ../../funnel.csv
94
92
95
- .. image :: _static/pfunnel.svg
96
- :width: 600px
97
- :height: 400px
98
-
93
+
99
94
Here is the source code using pyexcel::
100
95
101
- >>> import pyexcel as p
102
- >>> title = 'V8 benchmark results'
103
- >>> p.save_as(file_name='funnel.csv', dest_chart_type ='funnel',
104
- ... dest_file_name='pfunnel.svg', dest_title=title )
96
+ title = 'V8 benchmark results'
97
+ sheet = p.get_sheet(file_name='funnel.csv')
98
+ svg = sheet.plot(chart_type ='funnel',
99
+ title=title, width=600, height=400, explicit_size=True )
105
100
106
101
Radar chart
107
102
********************************************************************************
@@ -111,16 +106,14 @@ Radar chart
111
106
:file: ../../radar.csv
112
107
113
108
114
- .. image :: _static/pradar.svg
115
- :width: 600px
116
- :height: 400px
117
-
118
109
Here is the source code using pyexcel::
119
110
120
- >>> import pyexcel as p
121
- >>> title = 'V8 benchmark results'
122
- >>> p.save_as(file_name='radar.csv', dest_chart_type='radar',
123
- ... dest_file_name='pradar.svg', dest_title=title)
111
+ .. pyexcel-code ::
112
+
113
+ title = 'V8 benchmark results'
114
+ sheet = pyexcel.get_sheet(file_name='radar.csv')
115
+ svg = sheet.plot(chart_type='radar',
116
+ title=title, width=600, height=400, explicit_size=True)
124
117
125
118
Histogram
126
119
--------------------------------------------------------------------------------
@@ -131,15 +124,14 @@ in first, second and third columns.
131
124
.. csv-table ::
132
125
:file: ../../histogram_wide_bars.csv
133
126
134
- .. image :: _static/phistogram_wide_bars.svg
135
- :width: 600px
136
- :height: 400px
137
-
138
- Here is the source code using pyexcel::
139
127
140
- >>> import pyexcel as p
141
- >>> p.save_as(file_name='histogram_wide_bars.csv', dest_chart_type='histogram',
142
- ... dest_file_name='phistogram_wide_bars.svg')
128
+ Here is the source code using pyexcel:
129
+
130
+ .. pyexcel-code ::
131
+
132
+ sheet = pyexcel.get_sheet(file_name='histogram_wide_bars.csv')
133
+ svg = sheet.plot(chart_type='histogram',
134
+ width=600, height=400, explicit_size=True)
143
135
144
136
145
137
In order to draw multiple histogram on the same chart, you will need to use a
@@ -148,12 +140,15 @@ Book, each sheet of which become a histogram. Here is how you can draw multiple
148
140
.. image :: _static/phistogram.svg
149
141
:width: 600px
150
142
:height: 400px
151
-
152
- Here is the source code using pyexcel::
153
143
154
- >>> import pyexcel as p
155
- >>> p.save_book_as(file_name='histogram.xlsx', dest_chart_type='histogram',
156
- ... dest_file_name='phistogram.svg')
144
+ Here is the source code using pyexcel
145
+
146
+
147
+ .. pyexcel-code ::
148
+
149
+ book = pyexcel.get_book(file_name='histogram.xlsx')
150
+ svg = book.plot(chart_type='histogram',
151
+ width=600, height=400, explicit_size=True)
157
152
158
153
XY
159
154
--------------------------------------------------------------------------------
@@ -165,12 +160,11 @@ in individual sheets.
165
160
.. csv-table ::
166
161
:file: ../../radar.csv
167
162
168
- .. image :: _static/pxy.svg
169
- :width: 600px
170
- :height: 400px
171
-
172
- Here is the source code using pyexcel::
173
163
174
- >>> import pyexcel as p
175
- >>> p.save_book_as(file_name='xy.xlsx', dest_chart_type='xy',
176
- ... dest_file_name='pxy.svg')
164
+ Here is the source code using pyexcel
165
+
166
+ .. pyexcel-code ::
167
+
168
+ book = pyexcel.get_book(file_name='xy.xlsx')
169
+ svg = book.plot(chart_type='xy',
170
+ width=600, height=400, explicit_size=True)
0 commit comments