예제 #1
0
def test_custom_template_for_chart():
    data = [{
        'name': '衬衫',
        'value': 5
    }, {
        'name': '羊毛衫',
        'value': 20
    }, {
        'name': '雪纺衫',
        'value': 36
    }]

    configure(echarts_template_dir='.')

    online()

    data1 = {'衬衫': '34', '羊毛衫': 45, '雪纺衫': 40}
    names, values = Bar.cast(data)
    names1, values1 = Bar.cast(data1)
    bar = Bar("柱状图数据堆叠示例")
    bar.add("商家A", names, values, is_stack=True)
    bar.add("商家B", names1, values1, is_stack=True)
    bar.render(path='new_version_bar.html')
    with codecs.open('new_version_bar.html', 'r', 'utf-8') as f:
        actual_content = f.read()
        assert "</html>" in actual_content
예제 #2
0
def test_custom_template_for_chart():
    data = [
        {
            "name": "衬衫",
            "value": 5
        },
        {
            "name": "羊毛衫",
            "value": 20
        },
        {
            "name": "雪纺衫",
            "value": 36
        },
    ]

    configure(echarts_template_dir=".")

    data1 = {"衬衫": "34", "羊毛衫": 45, "雪纺衫": 40}
    names, values = Bar.cast(data)
    names1, values1 = Bar.cast(data1)
    bar = Bar("柱状图数据堆叠示例")
    bar.add("商家A", names, values, is_stack=True)
    bar.add("商家B", names1, values1, is_stack=True)
    bar.render(path="new_version_bar.html")
    with codecs.open("new_version_bar.html", "r", "utf-8") as f:
        actual_content = f.read()
        assert "</html>" in actual_content
예제 #3
0
def test_custom_template_for_chart():
    data = [
        {
            'name': '衬衫',
            'value': 5
        },
        {
            'name': '羊毛衫',
            'value': 20
        },
        {
            'name': '雪纺衫',
            'value': 36
        },
    ]

    configure(echarts_template_dir='.')

    data1 = {'衬衫': '34', '羊毛衫': 45, '雪纺衫': 40}
    names, values = Bar.cast(data)
    names1, values1 = Bar.cast(data1)
    bar = Bar("柱状图数据堆叠示例")
    bar.add("商家A", names, values, is_stack=True)
    bar.add("商家B", names1, values1, is_stack=True)
    bar.render(path='new_version_bar.html')
    with codecs.open('new_version_bar.html', 'r', 'utf-8') as f:
        actual_content = f.read()
        assert "</html>" in actual_content
예제 #4
0
def test_custom_templates():
    configure(jshost='https://chfw.github.io/jupyter-echarts/echarts',
              force_js_embed=False)
    page = create_three()
    # page.js_dependencies = ['echarts.min']
    page.render(path='new_version_page.html')
    with codecs.open('new_version_page.html', 'r', 'utf-8') as f:
        actual_content = f.read()
        assert "</html>" in actual_content
예제 #5
0
def test_custom_templates():
    configure(
        jshost='https://chfw.github.io/jupyter-echarts/echarts',
        force_js_embed=False
    )
    page = create_three()
    # page.js_dependencies = ['echarts.min']
    page.render(path='new_version_page.html')
    with codecs.open('new_version_page.html', 'r', 'utf-8') as f:
        actual_content = f.read()
        assert "</html>" in actual_content
예제 #6
0
def test_custom_templates():
    configure(
        jshost="https://chfw.github.io/jupyter-echarts/echarts",
        force_js_embed=False,
    )
    page = create_three()
    # page.js_dependencies = ['echarts.min']
    page.render(path="new_version_page.html")
    with codecs.open("new_version_page.html", "r", "utf-8") as f:
        actual_content = f.read()
        assert "</html>" in actual_content
    CURRENT_CONFIG.jshost = None
예제 #7
0
def test_custom_templates():
    configure(
        jshost="https://chfw.github.io/jupyter-echarts/echarts",
        force_js_embed=False,
    )
    page = create_three()
    # page.js_dependencies = ['echarts.min']
    page.render(path="new_version_page.html")
    with codecs.open("new_version_page.html", "r", "utf-8") as f:
        actual_content = f.read()
        assert "</html>" in actual_content
    CURRENT_CONFIG.jshost = None
예제 #8
0
def test_custom_template_for_chart():
    data = [
        {"name": "衬衫", "value": 5},
        {"name": "羊毛衫", "value": 20},
        {"name": "雪纺衫", "value": 36},
    ]

    configure(echarts_template_dir=".")

    data1 = {"衬衫": "34", "羊毛衫": 45, "雪纺衫": 40}
    names, values = Bar.cast(data)
    names1, values1 = Bar.cast(data1)
    bar = Bar("柱状图数据堆叠示例")
    bar.add("商家A", names, values, is_stack=True)
    bar.add("商家B", names1, values1, is_stack=True)
    bar.render(path="new_version_bar.html")
    with codecs.open("new_version_bar.html", "r", "utf-8") as f:
        actual_content = f.read()
        assert "</html>" in actual_content
예제 #9
0
# https://docs.djangoproject.com/en/2.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "projstatic")
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'login', 'appstatic'),
    os.path.join(BASE_DIR, 'pyech', 'appstatic'),
)
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
SESSION_SAVE_EVERY_REQUEST = True
#SESSION_EXPIRE_AT_BROWSER_CLOSE=True
SESSION_COOKIE_AGE = 60 * 60
LOGIN_URL = "/relog/login/"
WORK_URL = "/work"
configure(jshost=HOST + STATIC_URL + "JS/", force_js_embed=False)