depending on the value, we need to draw bars as shown below. What do you suggest? canvas, svg or some charting tools?

depending on the value, we need to draw bars as shown below. What do you suggest? canvas, svg or some charting tools?

为什么不只使用普通的旧<div>元素?您可以使用 CSS 宽度作为百分比来设置条的长度,使用固定大小的父元素,这应该可以满足您的需求。下面的示例,根据需要重新设计:
<html>
<head>
<style>
div{
border: 1px solid black;
}
</style>
</head>
<body>
<div style="width: 200px; height: 20px;">
<div style="width: 30%; height: 18px; background-color: red"></div>
</div>
</body>
</html>