pyecharts 通過本地載入js檔案

2021-10-24 04:06:42 字數 2113 閱讀 7600

參考鏈結,博主寫的很好原博文鏈結

條形圖

from pyecharts.charts import bar

from pyecharts import options as opts

from pyecharts.

globals

import themetype

bar =

( bar(

init_opts=opts.initopts(

theme=themetype.light,

js_host=

"./js/"

#本地js路徑))

.add_xaxis(

["襯衫"

,"羊毛衫"

,"雪紡衫"

,"褲子"

,"高跟鞋"

,"襪子"])

.add_yaxis("",

[5,20

,36,10

,75,90

],category_gap=

"50%"

).set_global_opts(

title_opts=opts.titleopts(title=

"主標題"

, subtitle=

"副標題"),

toolbox_opts=opts.toolboxopts(),

legend_opts=opts.legendopts(is_show=

false),

yaxis_opts=opts.axisopts(name=

"y軸標籤"),

xaxis_opts=opts.axisopts(name=

"x軸標籤"))

.set_series_opts(

label_opts=opts.labelopts(is_show=

false),

markpoint_opts=opts.markpointopts(

data=

[ opts.markpointitem(type_=

"max"

,name=

"最大值"),

opts.markpointitem(type_=

"min"

,name=

"最小值")]

)))bar.render(

"bar.html"

)

扇形圖

from pyecharts import options as opt

from pyecharts.charts import pie

from pyecharts.

globals

import themetype

pie =

( pie(

init_opts=opt.initopts(

page_title=

"onlineexam-analyse"

, theme=themetype.light,

js_host=

"./js/"))

.add("",

[('可樂',31

),('雪碧',84

),('橙汁'

,142),

('綠茶',82

),('奶茶'

,110)]

, radius=

['40%'

,'55%'])

# .set_colors(["red", "orange", "blue", "purple"])

.set_global_opts(

title_opts=opt.titleopts(title=

"主標題"

, subtitle=

"副標題"),

toolbox_opts=opt.toolboxopts())

.set_series_opts(label_opts=opt.labelopts(

['可樂'

,'雪碧'

,'橙汁'

,'綠茶'

,'奶茶'])

))pie.render(

"pie.html"

)

通過UIWebView載入讀取本地檔案

uiwebview是蘋果自帶的框架,也算是蘋果程式內部的瀏覽器,可以瀏覽web網頁,也可以開啟html htm pdf docx txt等格式的文字檔案,其實蘋果自帶的瀏覽器safari就是用uiwebview來實現的,具體原理簡單的說就是伺服器將mime的識別符號等放入傳送的資料中,然後告訴瀏覽器...

載入本地Html檔案

uiwebview webview uiwebview alloc initwithframe cgrectmake 0,0,320,480 autorelease nsstring htmlpath nsbundle quartz2d.html htmlpath htmlpath stringby...

載入本地HTML檔案

當我們載入乙個本地html檔案的時候,乙個資料夾裡還有css js image檔案,所以單獨載入乙個html檔案會沒有,只有文字,解決方案如下 載入部分 nsstring pathstr nsbundle mainbundle pathforresource go live oftype html ...