Beispiel #1
0
def test_surface3d_default():
    _data = list(create_surface3d_data())
    surface3d = Surface3D("3D 曲面图示例", width=1200, height=600)
    surface3d.add(
        "",
        _data,
        is_visualmap=True,
        visual_range_color=RANGE_COLOR,
        visual_range=[-3, 3],
        grid3d_rotate_sensitivity=5,
    )
    assert "lambert" not in surface3d._repr_html_()
Beispiel #2
0
def plot_3D(path):
    from pyecharts import Surface3D
    
    
    netprofit_data,maxdd_data,sharpratio_data = read_indicator_FastSlow(path)
    
    surface3d = Surface3D("net profit", width=1200, height=600)
    surface3d.add("",netprofit_data,xaxis3d_name="slow",yaxis3d_name="fast",zaxis3d_name="net profit",
                  is_visualmap=True,visual_dimension=2,xaxis3d_min=20,xaxis3d_max =60,yaxis3d_min=1,yaxis3d_max =20,
                  visual_range =[min([item[2] for item in netprofit_data]),max([item[2] for item in netprofit_data])])
    surface3d.render("net profit.html")
    
    surface3d = Surface3D("maxdd", width=1200, height=600)
    surface3d.add("",maxdd_data,xaxis3d_name="slow",yaxis3d_name="fast",zaxis3d_name="maxdd",
                  is_visualmap=True,visual_dimension=2,xaxis3d_min=20,xaxis3d_max =60,yaxis3d_min=1,yaxis3d_max =20,
                  visual_range =[min([item[2] for item in maxdd_data]),max([item[2] for item in maxdd_data])])
    surface3d.render("maxdd.html")
    
    surface3d = Surface3D("sharpe ratio", width=1200, height=600)
    surface3d.add("",sharpratio_data,xaxis3d_name="slow",yaxis3d_name="fast",zaxis3d_name="sharpe ratio",
                  is_visualmap=True,visual_dimension=2,xaxis3d_min=20,xaxis3d_max =60,yaxis3d_min=1,yaxis3d_max =20,
                  visual_range =[min([item[2] for item in sharpratio_data]),max([item[2] for item in sharpratio_data])])
    surface3d.render("sharpe ratio.html")
Beispiel #3
0
def test_surface3d_default(patched):
    fixture = "surface3d_options.json"
    patched.return_value = "1"
    _data = list(create_line3d_data())
    surface3d = Surface3D("3D 曲面图示例", width=1200, height=600)
    surface3d.add(
        "",
        _data,
        is_visualmap=True,
        visual_range_color=RANGE_COLOR,
        visual_range=[-3, 3],
        grid3d_rotate_sensitivity=5,
    )

    actual_options = dumps_actual_options(surface3d.options)
    expected = get_fixture_content(fixture)

    for a, b in zip(actual_options.split("\n"), expected.split("\n")):
        eq_(a.strip(), b.strip())
    "#313695",
    "#4575b4",
    "#74add1",
    "#abd9e9",
    "#e0f3f8",
    "#ffffbf",
    "#fee090",
    "#fdae61",
    "#f46d43",
    "#d73027",
    "#a50026",
]

_data = list(create_surface3d_data())
np.savetxt(os.path.abspath("test.txt"), _data, fmt='%s', delimiter=' ')
surface3d = Surface3D("3D 曲面图示例", width=1200, height=600)
surface3d.add(
    "",
    _data,
    is_visualmap=True,
    visual_range_color=range_color,
    visual_range=[-3, 3],
    grid3d_rotate_sensitivity=5,
)
surface3d.render("Surface3D1.html")


def create_surface3d_data():
    # 2: test2-曲面波图
    for t0 in range(-30, 30, 1):
        y = t0 / 10
Beispiel #5
0
def test_surface3d_must_use_canvas():
    surface3d = Surface3D()
    eq_(surface3d.renderer, "canvas")