Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiandongx committed Aug 6, 2017
1 parent c3afea6 commit af801ed
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,44 +23,46 @@ $ python setup.py install
```

## Basic Usage

from pyecharts import Bar

attr = ["{}month".format(i) for i in range(1, 13)]
attr = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
v1 = [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
v2 = [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
bar = Bar("Bar chart", "precipitation and evaporation one year")
bar.add("precipitation", attr, v1, mark_line=["average"], mark_point=["max", "min"])
bar.add("evaporation", attr, v2, mark_line=["average"], mark_point=["max", "min"])
bar.render()


```python
from pyecharts import Bar

attr = ["{}month".format(i) for i in range(1, 13)]
attr = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
v1 = [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
v2 = [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
bar = Bar("Bar chart", "precipitation and evaporation one year")
bar.add("precipitation", attr, v1, mark_line=["average"], mark_point=["max", "min"])
bar.add("evaporation", attr, v2, mark_line=["average"], mark_point=["max", "min"])
bar.render()
```

It will creat a file named render.html in the root directory, open file with your borwser.

![usage](https://github.com/chenjiandongx/pyecharts/blob/master/images/usage.gif)
![usage-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/usage-0.gif)

## Working with pandas & numpy
```python
import pandas as pd
import numpy as np

import pandas as pd
import numpy as np
from pyecharts import Bar
from pyecharts import Bar

index = pd.date_range('3/8/2017', periods=6, freq='M')
df1 = pd.DataFrame(np.random.randn(6), index=index)
dtvalue1, pdattr1 = Bar.pdcast(df1)
index = pd.date_range('3/8/2017', periods=6, freq='M')
df1 = pd.DataFrame(np.random.randn(6), index=index)
dtvalue1, pdattr1 = Bar.pdcast(df1)

df2 = pd.DataFrame(np.random.randn(6), index=index)
dtvalue2, pdattr2 = Bar.pdcast(df2)
df2 = pd.DataFrame(np.random.randn(6), index=index)
dtvalue2, pdattr2 = Bar.pdcast(df2)

dtvalue1 = [i[0] for i in dtvalue1]
dtvalue2 = [i[0] for i in dtvalue2]
dtvalue1 = [i[0] for i in dtvalue1]
dtvalue2 = [i[0] for i in dtvalue2]

bar = Bar('MyBar', 'precipitation and evaporation one year')
bar.add('precipitation', pdattr1, dtvalue1, mark_line=['average'], mark_point=['max', 'min'])
bar.add('evaporation', pdattr2, dtvalue2, mark_line=['average'], mark_point=['max', 'min'])
bar.render()
bar = Bar('Bar chart', 'Profit and loss situation')
bar.add('profit', pdattr1, dtvalue1)
bar.add('loss', pdattr2, dtvalue2)
bar.render()
```
![usage-1](https://github.com/chenjiandongx/pyecharts/blob/master/images/usage-1.png)

## Documentation
* [中文档案](https://github.com/chenjiandongx/pyecharts/blob/master/document/doc_zh_CN.md)
Expand Down
File renamed without changes
Binary file added images/usage-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit af801ed

Please sign in to comment.