Exemple #1
0
def test_online_feature():
    online()
    bar = create_a_bar(TITLE)
    html = bar._repr_html_()
    expected_jshost = "https://pyecharts.github.io/jupyter-echarts/echarts"
    assert expected_jshost in html
    CURRENT_CONFIG.hosted_on_github = False
Exemple #2
0
def test_online_with_custom_jshost():
    online(host="https://my-site.com/js")
    bar = create_a_bar(TITLE)
    html = bar._repr_html_()
    expected_jshost = "https://my-site.com/js"
    assert expected_jshost in html
    CURRENT_CONFIG.jshost = None
Exemple #3
0
def test_jupyter_online_display():
    online()
    map = create_uk_map()
    html = map._repr_html_()
    assert "UK_electoral_2016" in html
    assert "'echarts': 'https://pyecharts.github.io/jupyter-echarts/echarts/echarts.min'" in html  # flake8: noqa
    print(html)
    assert "https://echarts-maps.github.io/echarts-united-kingdom-js/echarts-united-kingdom-js/westminster_2016_uk" in html  # flake8: noqa
 def __init__(self,
              stock_name,
              jsPath='https://cdn.bootcss.com/echarts/4.1.0.rc2'):
     # 使用最新的echarts js文件
     online(jsPath)
     # K线
     self.stock_name = stock_name
     self.kline = Kline(stock_name)
     self.volume_bar = Bar('')
Exemple #5
0
def test_online_html():
    online()
    bar = Bar()
    bar.add("", CLOTHES, [5, 20, 36, 10, 75, 90], is_stack=True)
    bar.render()
    html_content = get_default_rendering_file_content()
    assert ('src="https://pyecharts.github.io/assets/js/echarts.min.js'
            in html_content)
    CURRENT_CONFIG.jshost = None
    CURRENT_CONFIG.hosted_on_github = False
Exemple #6
0
def test_online_with_custom_jshost():
    online(host="https://my-site.com/js")
    bar = create_a_bar(TITLE)
    html = bar._repr_html_()
    expected_jshost = "https://my-site.com/js"
    assert expected_jshost in html
Exemple #7
0
def test_online_feature():
    online()
    bar = create_a_bar(TITLE)
    html = bar._repr_html_()
    expected_jshost = "https://pyecharts.github.io/jupyter-echarts/echarts"
    assert expected_jshost in html
def test_online_with_custom_jshost():
    online(host='https://my-site.com/js')
    bar = create_a_bar(TITLE)
    html = bar._repr_html_()
    expected_jshost = 'https://my-site.com/js'
    assert expected_jshost in html
def test_online_feature():
    online()
    bar = create_a_bar(TITLE)
    html = bar._repr_html_()
    expected_jshost = 'https://pyecharts.github.io/jupyter-echarts/echarts'
    assert expected_jshost in html
python3, only runnable on joinquant.com due to the data API
'''

import pandas as pd
import datetime as dt
import os
import numpy as np
import jqdata
import bisect
import matplotlib.pyplot as plt
from pyecharts import Page, online, Line, Grid
import warnings

warnings.filterwarnings('ignore')

online()

origin = '2005-01-01'
today = dt.datetime.strftime(pd.datetime.today() - dt.timedelta(1), '%Y-%m-%d')


def convert_code(code):
    if code.endswith('XSHG'):
        return 'sh' + code[0:6]
    elif code.endswith('XSHE'):
        return 'sz' + code[0:6]


def get_ff(index_code, date=today):
    stock_list = get_index_stocks(index_code, date)
    if len(stock_list) > 0:
Exemple #11
0
# import  ray.dataframe as pd
#
# ##
# words = ['cat', 'window', 'defenestrate']
# print(len(words))
#
# for w in words:
#     print(w,len(w))
#
# for index in range(len(words)):
#     print(words[index])
#
# for w in words[:]:
#     if len(w)>6:
#         words.insert(1,w)
# print(words)
# ##enumerate
# seasons=['spring','summer','fall','winter']
# print(list(enumerate(seasons)))
#

from __future__ import unicode_literals
from pyecharts import Bar
from pyecharts import online

online()  # 使用远程 jshost
bar = Bar("我的第一个图表", "这里是副标题")
bar.use_theme('dark')
bar.add("服装", ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"], [5, 20, 36, 10, 75, 90])
bar.render()
bar