ec-echarts tooltip提示框 小圆点(颜色) 小程序

20 篇文章 0 订阅
1 篇文章 0 订阅

在这里插入图片描述
在这里插入图片描述

{
      name: 'R&D经费投入强度(%)',
      yAxisIndex: 1,
      lineStyle: {
        color: '#FFB93F'
      },
      label: {
        show: true,
        position: 'top',
        color: '#FFB93F'
      },
      itemStyle: {
        color: "#FFB93F"
      },
      data: [1.81, 1.86, 1.92, 2.25],
      type: 'line'
    }
import * as echarts from '../ec-canvas/echarts';
function getBarOption() {
  return {
    title: {
      top: -10,
      left: 17,
      subtext: '2016-2019年R&D经费支出及投入强度(亿元、%)',
      subtextStyle: {
        color: '#999',
        fontSize: 12
      }
    },
    legend:{
      data: ['蒸发量', '降水量'],
      show:true
    },
    tooltip: {
      trigger: 'axis',
      confine: true,
    },
    grid: {
      left: 40,
      bottom: 30,
      top: 40,
      right: 35
    },
    xAxis: {
      type: 'category',
      axisLabel: {
        color: '#333',
      },
      axisLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      data: ['2016年', '2017年', '2018年', '2019年']
    },
    yAxis: [{
      nameGap: 10,
      type: 'value',
      axisLabel: {
        color: '#999'
      },
      axisLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      splitLine: {
        lineStyle: {
          // 使用深浅的间隔色
          color: ['rgba(219, 219, 219, 0.3)']
        }
      }
    }, {
      nameGap: 10,
      type: 'value',
      axisLabel: {
        color: '#999'
      },
      axisLine: {
        lineStyle: {
          color: '#999'
        }
      },
      axisTick: {
        lineStyle: {
          color: '#999'
        }
      },
      splitLine: {
        show: false
      }
    }],
    series: [{
      name: 'R&D经费支出(亿元)',
      barWidth: 12,
      label: {
        show: true,
        position: 'top',
        color: '#01A1FD'
      },
      labelLine: {
        show: true
      },
      itemStyle: {
        normal: {
          barBorderRadius: [12, 12, 0, 0],
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [{
              offset: 0, color: '#00A1FD' // 0% 处的颜色
            }, {
              offset: 1, color: '#2CDCFC' // 100% 处的颜色
            }],
            globalCoord: false // 缺省为 false
          }
        }
      },
      emphasis: {
        itemStyle: {
          shadowBlur: 10,
          shadowColor: 'rgba(0, 0, 0, 0.5)',
        }
      },
      data: [40.95, 46.91, 52.4, 63.92],
      type: 'bar'
    }, {
      name: 'R&D经费投入强度(%)',
      yAxisIndex: 1,
      lineStyle: {
        color: '#FFB93F'
      },
      label: {
        show: true,
        position: 'top',
        color: '#FFB93F'
      },
      itemStyle: {
        color: "#FFB93F"
      },
      data: [1.81, 1.86, 1.92, 2.25],
      type: 'line'
    }]
  };
}

Page({
  data: {
    ecBar: {
      onInit: function (canvas, width, height, dpr) {
        const barChart = echarts.init(canvas, null, {
          width: width,
          height: height,
          devicePixelRatio: dpr // new
        });
        canvas.setChart(barChart);
        barChart.setOption(getBarOption());
        return barChart;
      }
    },
  },
  touchStart() {

  },
  touchMove() {

  },
  touchEnd() {

  }
});

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值