Echarts 趋势图属性

 var option = {
      // 主要用来控制图表四周留白
      grid: {
        left: '15%',
        top: '20%',
        right: '5%'
      },
      // 提示框组件
      tooltip: {
        trigger: 'axis', //坐标轴触发,主要在柱状图,折线图等会使用类目轴的图表中使用。
        axisPointer: { //去掉移动的指示线
          type: 'none'
        },
        extraCssText:'background:#000;opacity:0.65;'
      },
      formatter: function (params: any) {
        var res= `<div>
        <div style="margin: 0px 0 0;line-height:1;">
          <div style="margin: 0px 0 0;line-height:1;">
          <div style="font-size:12px;color:#fff;line-height:1;">
            ${params[0].name} 
          </div>
          <div style="margin: 10px 0 0;line-height:1;">
            <div style="margin: 0px 0 0;line-height:1;">
            <div style="margin: 0px 0 0;line-height:1;">
              <span style="float:left;font-size:12px;color:#fff;">${params[0].value}</span>
              <div style="clear:both"></div>
            </div>
            <div style="clear:both"></div>
            </div>
            <div style="clear:both"></div>
            </div>
            <div style="clear:both"></div>
          </div>
          <div style="clear:both"></div>
          </div>
          <div style="clear:both"></div>
        </div>
        </div>`
        return res;
      },
      //直角坐标系 grid 中的 x 轴,
      xAxis: {
        type: 'category', //'category' 类目轴,适用于离散的类目数据,为该类型时必须通过 data 设置类目数据。
        // 坐标轴轴线相关设置
        // 坐标轴刻度标签(类目,简单说就是x轴上的内容)的相关设置
        axisLabel: {
          //  是否显示坐标刻度标签(这了指是否显示x轴上的月份)
          show: true,
          showMaxLabel: true,
          // 标签文字的颜色
          color: '#999'
        },
        //x轴刻度线设置
        axisTick: {
          "show": false
        },
        // 类目数据,在类目轴(type: 'category')中有效。
        data: getDate.value,
      },
      //直角坐标系 grid 中的 y 轴,
      yAxis: {
        type: 'value', //'value' 数值轴,适用于连续数据。
        // 坐标轴轴线相关设置
        axisLine: {
          show: false //y轴线消失
        },
        splitLine: {
          //网格线
          lineStyle: {
            type: "dashed", //设置网格线类型 dotted:虚线   solid:实线
            width: 1,
          },
          show: true, //隐藏或显示
        },
        // 坐标轴刻度标签(类目,简单说就是x轴上的内容)的相关设置
        axisLabel: {
          show: true,
          // 标签文字的颜色
          color: '#999'
        },
        //y轴刻度线设置
        axisTick: {
          "show": false
        },
        splitNumber: 5, //坐标轴的分割段数,需要注意的是这个分割段数只是个预估值,最后实际显示的段数会在这个基础上根据分割后坐标轴刻度显示的易读程度作调整.在类目轴中无效。
      },
      series: [{
        type: 'line', //折线图是用折线将各个数据点标志连接起来的图表,用于展现数据的变化趋势。和全局设置type效果一样,表示折线图
        // 系列中的数据内容数组。数组项通常为具体的数据项。
        data: getData.value,
        // 折线条的样式
        lineStyle: {
          color: '#E60012',
          width: 1
        },
        areaStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
            {
              offset: 0,
              color: ' #ffb3b3'
            },
            {
              offset: 1,
              color: '#ffffff'
            }
          ])
        },
        // stack: 'Total',
        label: {
          show: true,
          position: 'top',
          color: '#000',
          fontSize: 6,
          rotate: 45,
        },
        // 折线拐点的样式
        itemStyle: {
          normal: { // 静止时:
            color: '#E60012',
          },
          emphasis: { // 鼠标经过时:
            color: '#E60012',
          }
        },
        smooth:true, //顺滑
        symbolSize: 7 //折线图每7个显示一个点数据
      }]
    };

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值