当前位置:   article > 正文

大数据—数据可视化—Pyecharts配置项_pycharts系列配置之标签设置

pycharts系列配置之标签设置

文章目录

一,基础图表

二,生成数据的库 Faker

三,pyecharts主题风格库

四,配置项

五,全局配置
------1,InitOpts:初始化配置项
------2,TitleOpts:标题配置项
------3,DataZoomOpts:区域缩放配置项
------4,LegendOpts:图例配置项
------5,VisualMapOpts:视觉映射配置项
------6,TooltipOpts:提示框配置项

六,系列配置项
------1,ItemStylenOpts: 图元样式配置项
------2,LineStyleOpts: 线样式配置项
------3,LadelOpts: 标签配置项
------4,MarkPointOpts: 标记点

全局配置全代码
系统配置全局代码


导入Pyecharts库

  • import pyecharts

基础图表

  • Bar(柱状图/条形图)
  • Bar3D(3D 柱状图)
  • Boxplot(箱形图)
  • EffectScatter(带有涟漪特效动画的散点图)
  • Funnel(漏斗图)
  • Gauge(仪表盘)
  • Geo(地理坐标系)
  • GeoLines(地理坐标系线图)
  • Graph(关系图)
  • HeatMap(热力图)
  • Kline/Candlestick(K线图)
  • Line(折线/面积图)
  • Line3D(3D 折线图)
  • Liquid(水球图)
  • Map(地图)
  • Parallel(平行坐标系)
  • Pie(饼图)
  • Polar(极坐标系)
  • Radar(雷达图)
  • Sankey(桑基图)
  • Scatter(散点图)
  • Scatter3D(3D 散点图
  • Surface3D(3D 曲面图
  • ThemeRiver(主题河流图)
  • Tree(树图) TreeMap(矩形树图)
  • WordCloud(词云图)

生成数据的库 Faker

导入Faker库

  • from pyecharts.faker import Faker

生成随机相同属性的数据 ( 7个名词 )

  • Faker.choose( )

随机生成7个数

  • Faker.vlaues( )

随机生成7个车名

  • Faker.cars

随机生成7个国家

  • Faker.country

pyecharts主题风格库

导入主题库

  • from pyecharts.globals import ThemeType

添加在初始化配置项

  • theme = ThemeType.主题 ## (主题大写)

主题

LIGHT —>明亮风格
DARK —>暗黑风
CHALK —>粉笔风
ESSOS —>厄索斯大陆
INFOGRAPHIC —>信息风
MACARONS —>马卡龙
PURPLE_PASSION —>紫色风情
ROMA —>罗马风
ROMANTIC —>浪漫风
SHINE —>闪耀风
VINTAGE —>复古风
WALDEN —>瓦尔登湖
WESTEROS —>维斯特洛大陆
WONDERLAND —>仙境
HALLOWEEN —>万圣节风


绘图常用颜色

蓝色(blue)
红色(red)
橙色(orange)
绿色(green)
紫色(purple)
黑色(black)
灰色(grey)
粉色(pink)
白色(white)
黄色(yellow)
棕色(brown)
青色(Cyan)


pyrcharts 常见的图标:

circle 圆形
rect 矩形
roundRect 圆角矩形
triangle 三角形
diamond 菱形
arrow 飞镖形


配置项

在这里插入图片描述

InitOpts:初始化配置项
TitleOpts:标题配置项
DataZoomOpts:区域缩放配置项
LegendOpts:图例配置项
VisualMapOpts:视觉映射配置项
TooltipOpts:提示框配置项
AxisOpts: 坐标轴配置项
ItemStylenOpts: 图元样式配置项
LineStyleOpts: 线样式配置项
LadelOpts: 标签配置项
MarkPointOpts: 标记点-


全局配置

InitOpts:初始化配置项

from pyecharts import options as opts ## 全局配置
from pyecharts.charts import Bar ## 柱状图
bar = (
    Bar(
        ## InitOpts:初始化配置项
        init_opts = opts.InitOpts(  # 图表画布大小,css长度单位
            width = "700px",    # 宽度
            height = "400px",    # 高度
            page_title = "网页标题",
            theme = ThemeType.LIGHT,   # 主题        
    	)
    )
    .add_xaxis(Faker.choose()) # x轴
    .add_yaxis("商家A",Faker.values()) # y轴
    .add_yaxis("商家B",Faker.values()) # "商家"处为数据图例
    #.reversal_axis() ## 旋转轴
).render("初始化配置项.html")  # 保存文件为html格式,引号内填文件名。
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

TitleOpts:标题配置项

bar = (
    Bar(
    .set_global_opts(
        ### TitleOpts:标题配置项    
        title_opts = opts.TitleOpts(
            title = "柱状图",  # title添加主标题配置
            title_link = "http://www.baidu.com",  # 主标题跳转链接
            title_target = "blank",  # blank 新窗口打开,self 当前窗口打开
            
            subtitle = "副标题",  # subtitle 副标题
            subtitle_link = "http://www.baidu.com",  # 副标题跳转链接
            subtitle_target = "blank",  # blank 新窗口打开,self 当前窗口打开

            ## 标题位置
            # left靠左, right靠右, center居中, pos_top靠上, bottom靠下
            pos_left = "20%",  # 百分比位置,
            pos_top = "10px",  # css长度单位
            padding = 10,   # 内边距
            item_gap = 10   # 主标题和副标题之间的间隙
        ),
    .add_xaxis(Faker.choose()) # x轴
    .add_yaxis("商家A",Faker.values()) # y轴
    .add_yaxis("商家B",Faker.values()) # "商家"处为数据图例.render("标题配置项.html")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

DataZoomOpts:区域缩放配置项

bar = (
    Bar(
    .set_global_opts(
		### DataZoomOpts:区域缩放配置项
        datazoom_opts = opts.DataZoomOpts(
            is_show = True,   # 是否显示组件
            type_ = "slider",  # 组件类型:slider, inside鼠标滚动
            is_realtime = True, # 拖动时是否实时更新图表 True|Fales
            
            range_start = 20,  # 数据窗口的起始百分比
            range_end = 80,   # 数据窗口的结束百分比
            orient = "horizontal", # horizontal水平显示,vertical垂直显示
            is_zoom_lock = True,   # 是否锁定选择区域 True|Fales
        ),
    .add_xaxis(Faker.choose()) # x轴
    .add_yaxis("商家A",Faker.values()) # y轴
    .add_yaxis("商家B",Faker.values()) # "商家"处为数据图例.render("区域缩放配置项.html")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

LegendOpts:图例配置项

bar = (
    Bar(
    .set_global_opts(
        ###  LegendOpts:图例配置项
        legend_opts = opts.LegendOpts(
            type_ = "plain",    ## 图例类型:plain普通图例,scroll:可以滚动翻页的图例,用于图例比较多的情况
            is_show = True,     # 是否显示图例
            pos_left = "50%",   # 图例位置:left靠左, right靠右, center居中, pos_top靠上, bottom靠下
            orient = "horizontal",   # horizontal水平,vertical垂直
            
            selected_mode = True,  # 是否开启图例点击 True|Fales
            align = 'left',     # 图标对于文字的位置:left靠左, right靠右, center居中
            padding = 10,    # 内边距
            
            item_gap = 5,    # 图例中每一项之间的间距
            item_width = 30,    # 项的宽度
            item_height = 20,   # 项的宽度
            
            inactive_color = "#ccc", # 图例关闭时的颜色
            legend_icon = "circle"  # 图例的形状
            ## pyrcharts 常见的图标:
            # circle 圆形
            # rect 矩形
            # roundRect 圆角矩形
            # triangle 三角形
            # diamond 菱形
            # arrow 飞镖形
        ),
    .add_xaxis(Faker.choose()) # x轴
    .add_yaxis("商家A",Faker.values()) # y轴
    .add_yaxis("商家B",Faker.values()) # "商家"处为数据图例.render("图例配置项.html")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32

VisualMapOpts:视觉映射配置项

bar = (
    Bar(
    .set_global_opts(
        ###  VisualMapOpts:视觉映射配置项
        visualmap_opts = opts.VisualMapOpts(
            is_show = True,   # # 是否显示视觉映射 True|Fales
            type_ = "color",  # color 或 size
            ## 超过最大或最小值显示最大或最小的颜色
            min_ = 0,   # 最小值
            max_ = 150,  # 最大值
            
            range_opacity = 0.5,     # 图片和文字透明度
            range_text = ["max","min"],   # 两端的文本
            range_color = ["blue",'yellow',"red"],   # 过渡颜色
            
            orient = "vertical",   # horizontal水平,vertical垂直
            ## left靠左, right靠右, center居中, top靠上, bottom靠下
            pos_right = "0%",  # 百分比位置,
            pos_bottom = "10px",  # css长度单位
            is_piecewise = True,  # 是否为分段型
            is_inverse = True,    # 是否反转
        ),
    .add_xaxis(Faker.choose()) # x轴
    .add_yaxis("商家A",Faker.values()) # y轴
    .add_yaxis("商家B",Faker.values()) # "商家"处为数据图例.render("视觉映射配置项.html")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

TooltipOpts:提示框配置项

bar = (
    Bar(
    .set_global_opts(
        ###  TooltipOpts:提示框配置项
        tooltip_opts = opts.TooltipOpts(
            is_show = True,   # 是否显示提示框 True|Fales

            ## 触发类型
            #  item: 数据项,一般用于散点图,柱形图,折线图,饼图
            #  axis: 坐标轴,提示线,主要用于条形图,折线图等
            trigger = "item",
            ## 触发条件:
            trigger_on = "mousemove",    # mousemove 鼠标移入 | click 点击触发
            
            ## 标签内容的格式
            #  字符串的模板变量:
            #  {a}: 系列名series_name
            #  {b}: 数据名
            #  {c}: 值
            formatter = "{a}:{b}-{c}",  # 标签内容的格式  
            
            background_color = "black",   # 背景颜色 
            border_color = "white",  # 边框颜色 
            border_width = 3,  # 边框宽度
        ),
    .add_xaxis(Faker.choose()) # x轴
    .add_yaxis("商家A",Faker.values()) # y轴
    .add_yaxis("商家B",Faker.values()) # "商家"处为数据图例.render("提示框配置项.html")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

系列配置项

ItemStylenOpts: 图元样式配置项

bar = (
    Bar(
    .set_global_opts(
        ## ItemStylenOpts: 图元样式配置项
        itemstyle_opts = opts.ItemStyleOpts(
            ## 图的颜色
            #  适用纯色
            #  RGB   "rgb(100,100,100)"
            #  RGBA  "rgba(100,100,100,0.5)"  #最后项填透明度
            color = "red",
            #  单独设置透明度
            opacity = 0.6,   # 图透明度
        ),
    .add_xaxis(Faker.choose()) # x轴
    .add_yaxis("商家A",Faker.values()) # y轴
    .add_yaxis("商家B",Faker.values()) # "商家"处为数据图例.render("图元样式配置项.html")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

LineStyleOpts: 线样式配置项

bar = (
    Bar(
    .set_global_opts(
        ### LineStyleOpts: 线样式配置项
        linestyle_opts = opts.LineStyleOpts(
            width = 2,   # 线宽
            color = "green",  # 线颜色
            type_ = "dashed",   # solid实线 | dashed虚线 | dotted点线
        ),
    .add_xaxis(Faker.choose()) # x轴
    .add_yaxis("商家A",Faker.values()) # y轴
    .add_yaxis("商家B",Faker.values()) # "商家"处为数据图例.render("线样式配置项.html")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

LadelOpts: 标签配置项

bar = (
    Bar(
    .set_global_opts(
        ### LineStyleOpts: 线样式配置项
        linestyle_opts = opts.LineStyleOpts(
            width = 2,   # 线宽
            color = "green",  # 线颜色
            type_ = "dashed",   # solid实线 | dashed虚线 | dotted点线
        ),
    .add_xaxis(Faker.choose()) # x轴
    .add_yaxis("商家A",Faker.values()) # y轴
    .add_yaxis("商家B",Faker.values()) # "商家"处为数据图例.render("标签配置项.html")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

MarkPointOpts: 标记点

bar = (
    Bar(
    .set_global_opts(
        ### MarkPointOpts: 标记点
        markpoint_opts = opts.MarkPointOpts(
            data = [
                ## type_:特殊标记类型,min, max, average平均值
                ## symbol: 特殊标记类图型更改 
                # circle 圆形
                # rect 矩形
                # roundRect 圆角矩形
                # triangle 三角形
                # diamond 菱形
                # arrow 飞镖形
                ## symbol_size: 标记图形大小
                opts.MarkPointItem(type_= "max",symbol = "arrow",symbol_size = 30),
                opts.MarkPointItem(type_= "min",symbol = "arrow",symbol_size = 30)
            ]
        ),
    .add_xaxis(Faker.choose()) # x轴
    .add_yaxis("商家A",Faker.values()) # y轴
    .add_yaxis("商家B",Faker.values()) # "商家"处为数据图例.render("标记点.html")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

全局配置全代码


## 全局配置项 
from pyecharts import options as opts ## 全局配置
from pyecharts.charts import Bar ## 柱状图
bar = (
    Bar(
        ## InitOpts:初始化配置项
        init_opts = opts.InitOpts(  # 图表画布大小,css长度单位
            width = "700px",    # 宽度
            height = "400px",    # 高度
            page_title = "网页标题",
            theme = ThemeType.LIGHT,   # 主题
            # LIGHT 明亮风格
            # DARK  暗黑风
            # CHALK 粉笔风
            # ESSOS 厄索斯大陆
            # INFOGRAPHIC 信息风
            # MACARONS 马卡龙
            # PURPLE_PASSION 紫色风情
            # ROMA 罗马风
            # ROMANTIC 浪漫风
            # SHINE 闪耀风
            # VINTAGE 复古风
            # WALDEN 瓦尔登湖
            # WESTEROS 维斯特洛大陆
            # WONDERLAND 仙境
            # HALLOWEEN 万圣节风
            #bg_color = "pink"   # 背景颜色
        )
    )
    .add_xaxis(Faker.choose()) # x轴
    .add_yaxis("商家A",Faker.values()) # y轴
    .add_yaxis("商家B",Faker.values()) # "商家"处为数据图例
    #.reversal_axis() ## 旋转轴
    # 全局配置项
    .set_global_opts(
        ### TitleOpts:标题配置项    
        title_opts = opts.TitleOpts(
            title = "柱状图",  # title添加主标题配置
            title_link = "http://www.baidu.com",  # 主标题跳转链接
            title_target = "blank",  # blank 新窗口打开,self 当前窗口打开
            
            subtitle = "副标题",  # subtitle 副标题
            subtitle_link = "http://www.baidu.com",  # 副标题跳转链接
            subtitle_target = "blank",  # blank 新窗口打开,self 当前窗口打开

            ## 标题位置
            # left靠左, right靠右, center居中, pos_top靠上, bottom靠下
            pos_left = "20%",  # 百分比位置,
            pos_top = "10px",  # css长度单位
            padding = 10,   # 内边距
            item_gap = 10   # 主标题和副标题之间的间隙
        ),
        ### DataZoomOpts:区域缩放配置项
        datazoom_opts = opts.DataZoomOpts(
            is_show = True,   # 是否显示组件
            type_ = "slider",  # 组件类型:slider, inside鼠标滚动
            is_realtime = True, # 拖动时是否实时更新图表 True|Fales
            range_start = 20,  # 数据窗口的起始百分比
            range_end = 80,   # 数据窗口的结束百分比
            orient = "horizontal", # horizontal水平显示,vertical垂直显示
            is_zoom_lock = True,   # 是否锁定选择区域 True|Fales
        ),
        ###  LegendOpts:图例配置项
        legend_opts = opts.LegendOpts(
            type_ = "plain",    ## 图例类型:plain普通图例,scroll:可以滚动翻页的图例,用于图例比较多的情况
            is_show = True,     # 是否显示图例
            pos_left = "50%",   # 图例位置:left靠左, right靠右, center居中, pos_top靠上, bottom靠下
            orient = "horizontal",   # horizontal水平,vertical垂直
            selected_mode = True,  # 是否开启图例点击 True|Fales
            align = 'left',     # 图标对于文字的位置:left靠左, right靠右, center居中
            padding = 10,    # 内边距
            item_gap = 5,    # 图例中每一项之间的间距
            item_width = 30,    # 项的宽度
            item_height = 20,   # 项的宽度
            inactive_color = "#ccc", # 图例关闭时的颜色
            legend_icon = "circle"  # 图例的形状
            ## pyrcharts 常见的图标:
            # circle 圆形
            # rect 矩形
            # roundRect 圆角矩形
            # triangle 三角形
            # diamond 菱形
            # arrow 飞镖形
        ),
        ###  VisualMapOpts:视觉映射配置项
        visualmap_opts = opts.VisualMapOpts(
            is_show = True,   # # 是否显示视觉映射 True|Fales
            type_ = "color",  # color 或 size
            ## 超过最大或最小值显示最大或最小的颜色
            min_ = 0,   # 最小值
            max_ = 150,  # 最大值
            range_opacity = 0.5,     # 图片和文字透明度
            range_text = ["max","min"],   # 两端的文本
            range_color = ["blue",'yellow',"red"],   # 过渡颜色
            orient = "vertical",   # horizontal水平,vertical垂直
            ## left靠左, right靠右, center居中, top靠上, bottom靠下
            pos_right = "0%",  # 百分比位置,
            pos_bottom = "10px",  # css长度单位
            is_piecewise = True,  # 是否为分段型
            is_inverse = True,    # 是否反转
        ),
        ###  TooltipOpts:提示框配置项
        tooltip_opts = opts.TooltipOpts(
            is_show = True,   # 是否显示提示框 True|Fales

            ## 触发类型
            #  item: 数据项,一般用于散点图,柱形图,折线图,饼图
            #  axis: 坐标轴,提示线,主要用于条形图,折线图等
            trigger = "item",
            ## 触发条件:
            trigger_on = "mousemove",    # mousemove 鼠标移入 | click 点击触发
            
            ## 标签内容的格式
            #  字符串的模板变量:
            #  {a}: 系列名series_name
            #  {b}: 数据名
            #  {c}: 值
            formatter = "{a}:{b}-{c}",  # 标签内容的格式  
            ## 背景颜色
            background_color = "black",   # 背景颜色 
            # 蓝色(blue)
            # 红色(red)
            # 橙色(orange)
            # 绿色(green)
            # 紫色(purple)
            # 黑色(black)
            # 灰色(grey)
            # 粉色(pink)
            # 白色(white)
            # 黄色(yellow)
            # 棕色(brown)
            # 青色(Cyan)
            border_color = "white",  # 边框颜色 
            border_width = 3,  # 边框宽度
        ),
        ### AxisOpts: 坐标轴配置项
        xaxis_opts = opts.AxisOpts(
            is_show = True,  # 是否显示x轴
            
            ## 坐标轴的类型:
            #  value: 数值轴,用于连续数据
            #  category: 类目轴,适用于离散数据,比如星期一,星期二等
            #  tame: 时间轴,适用于连续的时序数据
            type_ = "category"
        ),
        yaxis_opts = opts.AxisOpts(
            is_show = True,
            axisline_opts = opts.AxisLineOpts(is_show = False),  # 是否显示y轴的线 True|Fales
            axistick_opts = opts.AxisLineOpts(is_show = False),  # 是否显示y轴的刻度 True|Fales
        )
    )
).render("全局配置.html")

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154

系统配置全局代码

## 系列配置项
from pyecharts.charts import Line
line = (
    Line(
        # InitOpts: 初始化配置项
        init_opts = opts.InitOpts(
            width = "700px",
            height = "400px"
        )
    )
    .add_xaxis(Faker.choose())
    .add_yaxis("商家A",Faker.values())
    .add_yaxis("商家B",Faker.values())
    ## 全局配置项
    .set_global_opts (
        title_opts = opts.TitleOpts(title = "折线图"),  # 标题
        tooltip_opts = opts.TooltipOpts(trigger = "axis")   # 提示线
    )
    ### 系列配置项
    .set_series_opts(
        ## ItemStylenOpts: 图元样式配置项
        itemstyle_opts = opts.ItemStyleOpts(
            ## 图的颜色
            #  适用纯色
            #  RGB   "rgb(100,100,100)"
            #  RGBA  "rgba(100,100,100,0.5)"  #最后项填透明度
            color = "red",
            #  单独设置透明度
            opacity = 0.6,   # 图透明度
        ),
        ### LineStyleOpts: 线样式配置项
        linestyle_opts = opts.LineStyleOpts(
            width = 2,   # 线宽
            color = "green",  # 线颜色
            type_ = "dashed",   # solid实线 | dashed虚线 | dotted点线
        ),
        ### LadelOpts: 标签配置项
        label_opts = opts.LabelOpts(
            # 标签在数据的位置:left左, right右, top上,bottom下方
            # inside里面, insideLeft, insideRight, insideTop, insideBottom 等
            position = "left",  # 位置
            color = "red",   # 标签字体颜色
            font_size = 10,  # 标签字体大小 
            font_style = "italic",  # normal非斜体 | italic斜体
            font_weight = "bold",   # bold 字体加粗
            rotate = -40,   # 标签旋转,-90到90
        ),
        ### MarkPointOpts: 标记点
        markpoint_opts = opts.MarkPointOpts(
            data = [
                ## type_:特殊标记类型,min, max, average平均值
                ## symbol: 特殊标记类图型更改 
                # circle 圆形
                # rect 矩形
                # roundRect 圆角矩形
                # triangle 三角形
                # diamond 菱形
                # arrow 飞镖形
                ## symbol_size: 标记图形大小
                opts.MarkPointItem(type_= "max",symbol = "arrow",symbol_size = 30),
                opts.MarkPointItem(type_= "min",symbol = "arrow",symbol_size = 30)
            ]
        ),
        ### MarkLineOpts: 标记线
        markline_opts = opts.MarkLineOpts(
            data = [
                opts.MarkLineItem(type_ = "average"),
            ],
            label_opts = opts.LabelOpts(
                color = "red"
            )
        )
    )
).render("系统配置.html")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74

谢谢观看!!!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/代码探险家/article/detail/843016
推荐阅读
相关标签
  

闽ICP备14008679号