mirror of
https://github.com/pyecharts/pyecharts.git
synced 2025-12-08 20:59:23 +00:00
🎨 final touch on the django and flask example code
This commit is contained in:
parent
213977a662
commit
1a6cbf02a7
@ -1,6 +1,11 @@
|
||||
from __future__ import unicode_literals
|
||||
import math
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.template import loader
|
||||
from pyecharts import Line3D
|
||||
|
||||
from pyecharts.constants import DEFAULT_HOST
|
||||
|
||||
|
||||
def index(request):
|
||||
@ -8,16 +13,13 @@ def index(request):
|
||||
l3d = line3d()
|
||||
context = dict(
|
||||
myechart=l3d.render_embed(),
|
||||
host="https://chfw.github.io/jupyter-echarts",
|
||||
host=DEFAULT_HOST,
|
||||
script_list=l3d.get_js_dependencies()
|
||||
)
|
||||
return HttpResponse(template.render(context, request))
|
||||
|
||||
|
||||
def line3d():
|
||||
from pyecharts import Line3D
|
||||
|
||||
import math
|
||||
_data = []
|
||||
for t in range(0, 25000):
|
||||
_t = t / 1000
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import random
|
||||
from pyecharts import Scatter3D
|
||||
from pyecharts.constants import DEFAULT_HOST
|
||||
from flask import Flask, render_template
|
||||
|
||||
|
||||
@ -9,10 +10,9 @@ app = Flask(__name__)
|
||||
@app.route("/")
|
||||
def hello():
|
||||
s3d = scatter3d()
|
||||
script_host = "https://chfw.github.io/jupyter-echarts"
|
||||
return render_template('pyecharts.html',
|
||||
myechart=s3d.render_embed(),
|
||||
host=script_host,
|
||||
host=DEFAULT_HOST,
|
||||
script_list=s3d.get_js_dependencies())
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ def scatter3d():
|
||||
'#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
|
||||
scatter3D = Scatter3D("3D scattering plot demo", width=1200, height=600)
|
||||
scatter3D.add("", data, is_visualmap=True, visual_range_color=range_color)
|
||||
return scatter3D.render_embed()
|
||||
return scatter3D
|
||||
|
||||
|
||||
def generate_3d_random_point():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user