Skip to content

条状图演示

条状图演示https://yundie.xyz/x-charts-demo/index.html?type=bar

参考配置

基础条状图

html
<template>
  <view class="container">
    <t-xcharts
      ref="chart"
      :option="chartOption"
    ></t-xcharts>
  </view>
</template>

<script setup>
import { ref } from 'vue';

const chartOption = ref({
  type: 'bar',
  animation: true,
  dataLabel: true,
  xAxis: {
    disableGrid: true
  },
  yAxis: {
    data: [{
      min: 0,
      max: 100
    }]
  },
  series: [{
    name: '销量',
    data: [15, 20, 45, 37, 43, 34, 50],
    color: '#2979ff'
  }],
  categories: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
});
</script>

配置说明

type

图表类型,设置为 'bar' 表示条状图。

条状图是柱状图的横向版本,适合展示长标签的分类数据。配置方式与柱状图类似。