javascript - 如何在 Chart.js 上使用 Jitter 在 Boxplot 上显示单个数据点
问题描述
我目前正在使用chart.js 做我的项目,我使用图表类型'boxplot',并且在当前版本中没有关于图表'boxplot' 的文档或信息,所以我使用旧CDN 版本chartjs-chart-box-and-violin -plot,它是成功的,但我仍然必须在图形中显示每个单独的数据点,比如小点,抖动散布有点像,但我不知道是怎么回事,因为没有文档,这是我的意思的例子
const myChart = document.getElementById('myChart').getContext('2d');
const label = ['A','B','C','D','E'];
const datas = [
[85, 19, 53, 100, 76],
[65, 86, 13, 68, 34],
[32, 9, 45, 81, 63],
[13, 94, 64, 75, 21],
[74, 92, 35, 90, 2]
];
const colorRed = 'rgba(255, 99, 132, 0.3)';
const borderRed = 'rgba(255, 99, 132, 1)';
const iChart = new Chart(myChart, {
type: 'boxplot',
data: {
labels: label,
datasets: [{
label: 'EQA-Übereinstimmung',
data: datas,
backgroundColor: colorRed,
borderColor: borderRed,
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
title: {
display: true,
text: 'Test',
fontSize: 20,
},
scales: {
xAxes: [{
maxBarThickness: 35,
}]
},
legend: false,
}
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="boxplot.css">
<script src='https://unpkg.com/chart.js@2.8.0/dist/Chart.bundle.js'></script>
<script src='https://unpkg.com/chartjs-chart-box-and-violin-plot@2/build/Chart.BoxPlot.js'></script>
</head>
<body>
<div class="dashboard">
<canvas id="myChart" width="600" height="400"></canvas>
<script src="userChart.js"></script>
</div>
</body>
</html>
我真的需要一些帮助,伙计们...
解决方案
推荐阅读
- r - R基本函数特征有对称矩阵的问题
- hadoop - 如何将文件从本地机器发送到在 Virtual Box 上运行的 HortonBox 实例?
- javascript - 我正在尝试插入表单内容,但它在控制台上打印 null
- mysql - 如何使用 MySQL 作为构建组件(如 EC2 Image builder Golden AMI)来构建 Docker Image Builder?
- monitoring - 如何从活动检查中获取 mysql 监控值
- python - 在 Google Colab 上运行 Darknet YOLOv4 时出现 CUDA 错误
- arrays - Excel数组在问题开始处不断添加'符号
- node.js - HTTP 请求数据到 JSON
- php - 对于每个嵌套数组,我都遇到了问题
- python - 使用 keras .h5 模型进行预测时出错?