HTML
<!DOCTYPE html>
<html lang="zh" >
<head>
<meta charset="UTF-8">
<title>jQuery Sparklines Box plot field order</title>
</head>
<body>
对于方框图,可以使用tooltipFormatFieldlist和tooltipFormFieldlistKey选项控制显示哪些字段以及显示顺序。例如,要仅显示中值、下四分位数和上四分位数值,请按以下顺序:<span class="boxfieldorder">4,27,34,52,54,59,61,68,78,82,85,87,91,93,100</span>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery-sparklines/2.1.2/jquery.sparkline.min.js"></script>
</body>
</html>
CSS
.jqstooltip { box-sizing: initial; }
body { color: #4d5259; font-size: 16px; font-family: "Microsoft JhengHei","Microsoft YaHei",Helvetica,"Meiryo UI","Malgun Gothic","Segoe UI","Trebuchet MS","Monaco",monospace,Tahoma,STXihei,"华文细黑",STHeiti,"Helvetica Neue","Droid Sans","wenquanyi micro hei",FreeSans,Arimo,Arial,SimSun,"宋体",Heiti,"黑体",sans-serif; padding: 0px; margin: 0px; line-height: 32px }
JavaScript
var values = [1, 3, 5, 3, 8];
$('.boxfieldorder').sparkline(values, {
type: 'box',
tooltipFormatFieldlist: ['med', 'lq', 'uq'],
tooltipFormatFieldlistKey: 'field'
});