导航

v2.1.0
整体的构成

漏斗图

展示同一流程的各个阶段,以及流程如何逐步收窄。

本页内容

漏斗图展示同一流程的各个阶段,以及有多少对象到达每个阶段,例如访问、注册、激活和付费。每个数据系列对应一个阶段,宽度由该阶段数值相对于第一阶段的比例决定,并收窄至下一阶段的宽度。流失量最大的地方,图形收窄得最明显。阶段名称显示在图形旁,名称后依次显示该阶段的数值及其占第一阶段的比例。

漏斗图

<div class="card max-w(560) mx-auto">  <div class="card-header">    <h3 class="card-title">Sign-up</h3>    <p class="card-description">From a visit to a paid plan, this month</p>  </div>  <figure class="chart" id="signup"></figure></div><script>addEventListener('DOMContentLoaded', function () {MasterUI.chart(document.getElementById('signup'), {  type: 'funnel',  label: 'Sign-up funnel this month: people at each stage',  series: [    { name: 'Visits', value: 12480 },    { name: 'Sign-ups', value: 4210 },    { name: 'Activated', value: 2380 },    { name: 'Paid', value: 642 }  ]})})</script><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { Chart } from './ui/chart'<div className="card max-w(560) mx-auto">  <div className="card-header">    <h3 className="card-title">Sign-up</h3>    <p className="card-description">From a visit to a paid plan, this month</p>  </div>  <Chart    id="signup"    type="funnel"    label="Sign-up funnel this month: people at each stage"    series={[      { name: 'Visits', value: 12480 },      { name: 'Sign-ups', value: 4210 },      { name: 'Activated', value: 2380 },      { name: 'Paid', value: 642 }    ]}  /></div>
<script>  import Chart from './ui/Chart.svelte'</script><div class="card max-w(560) mx-auto">  <div class="card-header">    <h3 class="card-title">Sign-up</h3>    <p class="card-description">From a visit to a paid plan, this month</p>  </div>  <Chart    id="signup"    type="funnel"    label="Sign-up funnel this month: people at each stage"    series={[      { name: 'Visits', value: 12480 },      { name: 'Sign-ups', value: 4210 },      { name: 'Activated', value: 2380 },      { name: 'Paid', value: 642 }    ]}  /></div>
<script setup>import Chart from './ui/Chart.vue'</script><template>  <div class="card max-w(560) mx-auto">    <div class="card-header">      <h3 class="card-title">Sign-up</h3>      <p class="card-description">From a visit to a paid plan, this month</p>    </div>    <Chart      id="signup"      type="funnel"      label="Sign-up funnel this month: people at each stage"      :series="[        { name: 'Visits', value: 12480 },        { name: 'Sign-ups', value: 4210 },        { name: 'Activated', value: 2380 },        { name: 'Paid', value: 642 }      ]"    />  </div></template>

按流程顺序传入各阶段,每个阶段提供一个 value。各阶段的颜色逐级变浅,从实色过渡到浅色,让读者既能通过宽度,也能通过色调看出流程的变化。漏斗图适用于同一流程,且各阶段涵盖的对象都是第一阶段的子集。对于按地区划分的销售额等独立分类数据,请使用柱状图。

#选项

选项默认值
label无绘图区的无障碍名称,说明图表展示的内容及其单位
series[]每个数据系列包含 name 和与图表类型对应的数据字段:values、value、points、ranges 或 children。还可指定 category、type、low 和 high,以及圆环的 max
format, tickFormat由区域设置决定数值和刻度的显示格式。散点图的横轴使用 xFormat
current无标记了 aria-current 的数据点索引

所有图表类型共用相同的读数显示、按键操作、图例、颜色和刻度。有关这些行为以及所有选项、类和自定义属性,请参阅 图表。