Git Product home page Git Product logo

echarts-python's Introduction

Echarts for Python

An unofficial Echarts options generator with Python.

Latest Version

Travis CI Status

Codecov Status

Doc Status

This repo still on developing (ALPHA), DON'T USE IT IN PRODUCTION.

Installation

Installing echarts-python with pip :

$ pip install echarts-python

Current version for Echarts 3.1.6

Basic Usage

from echarts import Echart, Legend, Bar, Axis

chart = Echart('GDP', 'This is a fake chart')
chart.use(Bar('China', [2, 3, 4, 5]))
chart.use(Legend(['GDP']))
chart.use(Axis('category', 'bottom', data=['Nov', 'Dec', 'Jan', 'Feb']))

The chart.json property will be

{
    "title": {
        "text": "GDP",
        "subtext": "This is a fake chart"
    },
    "series": [
        {
            "type": "bar",
            "data": [
                2,
                3,
                4,
                5
            ],
            "name": "China"
        }
    ],
    "legend": {
        "y": "top",
        "x": "center",
        "data": [
            "GDP"
        ],
        "orient": "horizontal"
    },
    "xAxis": [
        {
            "position": "bottom",
            "data": [
                "Nov",
                "Dec",
                "Jan",
                "Feb"
            ],
            "type": "category"
        }
    ],
    "yAxis": {}
}

on Mac OSX, you also can execute :

chart.plot()

and invoke a browser to display the chart.

Contribution

This package authored by Hsiaoming Yang <[email protected]> in 2014.

If you have any question or want to improve this repository, welcome to create an issue or pull requests .

This repo is maintained by Yufei Li <[email protected]> now, you can also send a email to me.

echarts-python's People

Contributors

af1ynch avatar bonfy avatar lepture avatar yufeiminds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

echarts-python's Issues

Could not be installed with pip

Are you sure this can be installed by pip?

$ pip install echarts-python
Collecting echarts-python
  Could not find a version that satisfies the requirement echarts-python (from versions: )
No matching distribution found for echarts-python

$ pip search echarts
eea.googlecharts (14.9)            - Configurator for GoogleCharts
django-googlecharts (1.0-alpha-1)  - Django template tags to generate charts
                                     using the Google chart API.

中文乱码

你好。
请问一下中文乱码需要怎么处理了?

luanma

title

How to set the width

Hi, I am using the library, but i find the figure generated alway fit the screen, I want it become smaller. But I don't know the way. Please help me, thanks

Create samples for providing chart-code mapping

Samples folder like this:

├── samples
│   ├── index.html
│   ├── index.js
│   ├── index.py
│   ├── package.json
│   ├── static
│   │   └── build.js
│   └── webpack.config.js

UnicodeDecodeError

# -*- coding: utf-8 -*-
from echarts import Echart, Legend, Bar, Axis
chart = Echart(u'GDP',u'This is a fake chart')
chart.use(Bar('China',[2, 3, 4, 5]))
chart.use(Legend(['GDP']))
chart.use(Axis('category', 'bottom', data=['Nov', 'Dec', 'Jan', 'Feb']))
chart.plot()

报错:

Traceback (most recent call last):
  File "C:\Program Files\Python36\echats.py", line 8, in <module>
    chart.plot()
  File "C:\Program Files\Python36\lib\site-packages\echarts\__init__.py", line 105, in plot
    fobj.write(self._html())
  File "C:\Program Files\Python36\lib\site-packages\echarts\__init__.py", line 95, in _html
    template = f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 250: illegal multibyte sequence

按提示改了下:~Python36\lib\site-packages\echarts_init_.py -->

def _html(self):
        with open(os.path.join(os.path.dirname(__file__), u'plot.j2'),'rb') as f:
            template = f.read()
            return template.replace(bytes('{{ opt }}',encoding='utf-8'),bytes(json.dumps(self.json, indent=4),encoding='utf-8'))

然后正常运行;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.