Skip to content

Commit 54dcb6c

Browse files
committed
add demo page, tested to 95% and add documentation
1 parent 8c0ea2a commit 54dcb6c

File tree

20 files changed

+401
-82
lines changed

20 files changed

+401
-82
lines changed

.moban.d/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
{%endblock%}
55

66
{%block features %}
7-
**{{name}}** does xyz.
7+
{%include "gantt.rst"%}
88
{%endblock%}

.moban.d/docs/source/index.rst.jj2

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{%include "header.rst.jj2" %}
2+
3+
Introduction
4+
--------------------------------------------------------------------------------
5+
6+
{%include "gantt.rst"%}
7+
8+
{%include "constraints.rst.jj2"%}
9+
10+
Installation
11+
--------------------------------------------------------------------------------
12+
13+
{%include "installation.rst.jj2" %}
14+
15+
16+
Rendering Options
17+
--------------------------------------------------------------------------------
18+
19+
You can pass the following options to :meth:`pyexcel.Sheet.save_as`.
20+
The same options are applicable to
21+
pyexcel's signature functions, but please remember to add 'dest_' prefix.
22+
23+
**embed** If it is set true, the resulting html will only contain a portion
24+
of HTML without the HTML header. And it is expected that you, as the
25+
developer to provide the necessary HTML header in your web page.
26+
27+
28+
Embed Setup
29+
--------------------------------------------------------------------------------
30+
31+
32+
Please copy the hightlighted lines into the head section of each of your web pages:
33+
34+
.. code-block:: html
35+
:linenos:
36+
:emphasize-lines: 2-21
37+
38+
<html><head>
39+
<style>
40+
body {
41+
font-family: sans-serif;
42+
background: #ccc;
43+
}
44+
.container {
45+
width: 80%;
46+
margin: 0 auto;
47+
}
48+
.gantt-container {
49+
overflow: scroll;
50+
}
51+
/* custom class */
52+
.gantt .bar-milestone .bar-progress {
53+
fill: tomato;
54+
}
55+
</style>
56+
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
57+
<script src="https://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.5.1/snap.svg-min.js"></script>
58+
<script src="https://github.com/frappe/gantt/raw/master/dist/frappe-gantt.min.js"></script>
59+
</head><body>
60+
<!-- here is the embedded gatt -->
61+
</body>
62+
</html>
63+
64+
65+
Then pass on `embed=True` to pyexcel signature functions. It is as simple as that.
66+
67+
{%include "license.rst.jj2" %}

.moban.d/gantt.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
**{{name}}** does {{description}}.
2+
3+
Here is `a sample csv`_ file::
4+
5+
id,name,start,end,progress,dependencies,custom_class
6+
Task 1,Writing pyexcel-gantt,2017-07-17,2017-07-18,80,,
7+
Task 2,Test pyexcel-gantt,2017-07-19,2017-07-20,10,Task 1,,
8+
Task 3,Write up the documentation,2017-07-21,2017-07-22,0,Task 1,,
9+
Task 4,Release pyexcel-gantt,2017-07-23,2017-07-23,0,"Task 2, Task 3",,bar-milestone
10+
11+
.. image:: demo/demo.png
12+
13+
Here's what you need to do in your program:
14+
15+
.. code-block:: python
16+
17+
import pyexcel as p
18+
19+
20+
p.save_as(file_name='tasks.csv',
21+
dest_file_name='tasks.gantt.html')
22+
23+
Alternatively, you can do it with pyexcel's command line interface:
24+
25+
.. code-block:: bash
26+
27+
$ pyexcel transcode tasks.csv tasks.gantt.html
28+
29+
30+
.. _a sample csv:

.moban.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ targets:
1616
- test.bat: test.script.jj2
1717
- .travis.yml: travis.yml.jj2
1818
- .gitignore: gitignore.jj2
19+
- "docs/source/index.rst": "docs/source/index.rst.jj2"
20+
- "docs/source/conf.py": "docs/source/conf.py.jj2"

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
include README.rst
22
include CHANGELOG.rst
3-
recursive-include pyexcel_gantt/templates *.html *.js

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ all: test
33
test:
44
bash test.sh
55

6-
document:
7-
bash document.sh
6+
doc:
7+
sphinx-build -b html docs/source docs/build
88

99
spelling:
1010
sphinx-build -b spelling docs/source/ docs/build/spelling

README.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,28 @@ a little bit more time in coding, documentation and writing interesting posts.
3535

3636
Introduction
3737
================================================================================
38-
**pyexcel-gantt** does xyz.
38+
**pyexcel-gantt** does Draw gantt chart using frappe-gantt module for pyexcel data.
39+
40+
Here is a sample csv file::
41+
42+
id,name,start,end,progress,dependencies,custom_class
43+
Task 1,Writing pyexcel-gantt,2017-07-17,2017-07-18,80,,
44+
Task 2,Test pyexcel-gantt,2017-07-19,2017-07-20,10,Task 1,,
45+
Task 3,Write up the documentation,2017-07-21,2017-07-22,0,Task 1,,
46+
Task 4,Release pyexcel-gantt,2017-07-23,2017-07-23,0,"Task 2, Task 3",,bar-milestone
47+
48+
.. image:: demo/demo.png
49+
50+
Here's what you need to do in your program:
51+
52+
.. code-block:: python
53+
54+
import pyexcel as p
55+
56+
57+
p.save_as(file_name='tasks.csv',
58+
dest_file_name='demo.gantt.html',)
59+
3960
4061
4162

demo/demo.png

62 KB
Loading

demo/demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
p.save_as(file_name='tasks.csv',
5-
dest_file_name='s.gantt.html', dest_js_url='frappe-gantt.min.js')
5+
dest_file_name='tasks.gantt.html',)

demo/frappe-gantt.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)