Echarts笔记——折线图(1)折线图标记区间

Echarts笔记——折线图(1)折线图标记区间

1.折线图类型( line )。

2.markPoint : 图表标注(最大值,最小值)。

3.markLine :  图表标线 ( 平均线 )。

4.markArea :图表标域 (标记区间 )

 

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/echarts.min.js"></script>
    <script src="../../js/jquery.min.js"></script>
</head>
<body>
<div id="main" style="width:1200px;height:800px;"></div>

<script type="text/javascript">
    line_Data2 = [3324, 2352, 4522, 1469, 6379, 5315, 2793, 4324]
    line_Data1 = [2312, 3145, 6754, 8712, 3157, 1023, 5623, 8324]
    x_Data = ['a部门', 'b部门', 'c部门', 'd部门', 'e部门', 'f部门', 'g部门', 'h部门']

     // 基于准备好的dom,初始化echarts实例
    var myChart1 = echarts.init(document.getElementById('main'))
    $(function (ec) {
        var option = {
            title: {
                text: 'a公司一季度各部门销量(主标题)',
                left: '30%',
                textStyle: {
                    color: 'red',
                    fontSize: 30  }
            },
            xAxis: {
                name: '部门',
                type: 'category',
                data: x_Data,
                axisLabel: {        // x轴标签样式
                    textStyle: { fontSize: 20 }
                },
                nameTextStyle: {     // 坐标轴名字样式
                    fontSize: 20 },
            },
            yAxis: {
                name: '销量(件)',
                type: 'value',
                min: 0,
                axisLabel: {            // 坐标轴标签样式设置
                    textStyle: { fontSize: 20 },
                    formatter: '{value} 件',     // 给坐标轴标签加单位
                },
                nameTextStyle: { fontSize: 20 },
            },
            tooltip: { trigger: 'axis', },
            legend: { right: '5%' },
            series: [
                {
                    name: '销量折线图',
                    type: 'line',
                    data: line_Data1,
                    smooth: true,       // 折线图线条光滑
                    markPoint: {        // 标记
                        data: [
                            {name: '最小值', type: 'min'},
                            {name: '最大值', type: 'max'}
                        ],
                        symbolSize: 80,      //标记的大小
                        label: {        // 标记单位
                            formatter: '{c}件'//单位
                        }
                    },
                    markLine:{
                      data:[
                          {name:'平均数',type:'average'}
                      ]
                    },
                    markArea: {         //  提示图表标域,常用于标记图表中某个范围的数据
                        itemStyle: {
                            color: 'rgba(255, 173, 177, 0.4)'
                        },
                        data: [
                            [{xAxis: 'c部门'}
                                , {xAxis: 'e部门'}]
                        ]
                    },
                    areaStyle:{       // 填充样式
                      color:'#bbd3ea'
                    },
                    lineStyle:{
                        type:'dashed',  // 'dashed'虚线  , 'dotted'有斑点的;
                        color:'blue'
                    }
                }
            ]
        };
        myChart1.setOption(option)
    })

</script>
</body>
</html>

 

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

寧三一

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值