pyecharts tooltip_opts formatter使用html css设置格式示例

pyecharts tooltip_opts formatter使用html css设置格式示例_第1张图片

from pyecharts import options as opts
from pyecharts.charts import Graph
import webbrowser

NODE_COUNT=8

nodes_data=[]
links_data=[]

for i in range(NODE_COUNT):
    nodes_data.append(opts.GraphNode(name="结点"+str(i), value=i,symbol_size=10+i))

for i in range(0,NODE_COUNT):
    for j in range(0,NODE_COUNT):
        if i!=j:
            links_data.append(opts.GraphLink(source="结点"+str(i), target="结点"+str(j)))
c = (
    Graph(init_opts=opts.InitOpts(width="1800px",height="900px"))
    .add(
        "",
        nodes_data,
        links_data,
        is_draggable=True,
        repulsion=1000,
        tooltip_opts=opts.TooltipOpts(formatter="节点 {c}
------") ) .set_global_opts( title_opts=opts.TitleOpts(title="Graph-tooltip-formatter-test"), ) .render("Graph-tooltip-formatter-test.html") ) webbrowser.open("Graph-tooltip-formatter-test.html")

 

你可能感兴趣的:(python,python,pyecharts,graph,tooltip_opts,formatter)