Echarts参数配置

 let barData = [{name:'name1',age:'18',sex:'0'}];
var barOption = {
        title: {
          text: 'echarts图标title',
        },
        legend: {
          show: false, // 是否显示图例
        },
        grid: {
          x: "3.5%",//左侧 y轴内容距离边框的距离(类似padding-left)
        },
        color: ["#35D2FF"], // 条形颜色
        tooltip: { // 鼠标经过 tip提示
          trigger: "item", // 当trigger为’item’时只会显示该点的数据,为’axis’时显示该列下所有坐标轴所对应的数据。 默认为 'item'
          backgroundColor: "rgba(43,43,43,1)",
          borderRadius: 4,
          borderWidth: 1,
          padding: 10,
          // hideDelay:100, // 延迟消失
          extraCssText: // tip样式
            "width:199px!important;height:114px;background:rgba(255,255,255,0.94);box-shadow:0px 10px 35px 0px rgba(9,26,66,0.2);border:none;border-radius:20px;display:flex;flex-direction: column;justify-content: space-between;padding:0;margin:0",
          formatter: function(params) { // tip显示的具体内容
            let name = name,
              age = age,
              sex = sex;
            return `
            <div><em> ${name}</em> </div> 
            <div><em>${num}岁</em> </div> 
            <div>性别<em>${sex}</em></div> `;
          },
          textStyle: {
            color: "rgba(0,0,0,0.45)",
          },
        },
        dataset: {
          dimensions: ["dept_name", "num", "percentage", "dept"],
          source: [...barData], // 绑定数据源
        },
        xAxis: { // x轴
          type: "category",
          axisLine: {
            lineStyle: { // x轴 线条颜色
              color: "#F3F3F3",
            },
          },
          axisLabel: {
            textStyle: {  // x轴 lable样式
              color: "#3B4042",
              fontSize: 14,
              fontWeight: 400,
            },
            rotate: 300, // 旋转角度
            interval: 0, // 间隔
          },
          offset: 5, // 偏移 (标题距离x轴的距离)
        },
        grid:{
          y2:100
        },
        yAxis: {
          min: 0,
          // max: 100,
          minInterval: 1,
          axisLine: {
            lineStyle: {
              color: "#FFF", // y轴颜色
            },
          },
          axisLabel: {
            textStyle: {
              color: "#3B4042", // y轴 刻度
            },
          },
          splitLine: {
            // 辅助线
            show: true,
            lineStyle: {
              color: "#F3F3F3",
              width: 1,
            },
          },
        },
        series: [
          {
            type: "bar",
            barMaxWidth: 10, // 最大宽度
            itemStyle: {
              normal: { barBorderRadius: [15] },
            },
          },
        ],
      };
        myBarChart.setOption(barOption, true);

在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值