标签:资料 monthly 代码 set 图片 inf github meta java
chart.xkcd 可以用来绘制手绘样式的图表,使用简单,样式也挺好看
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<svg class="line-chart"></svg>
<script src="https://cdn.jsdelivr.net/npm/chart.xkcd@1/dist/chart.xkcd.min.js"></script>
<script>
const svg = document.querySelector(‘.line-chart‘)
?
new chartXkcd.Line(svg, {
title: ‘Monthly income of an indie developer‘,
xLabel: ‘Month‘,
yLabel: ‘$ Dollors‘,
data: {
labels:[‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘, ‘6‘,‘7‘, ‘8‘, ‘9‘, ‘10‘],
datasets: [{
label: ‘Plan‘,
data: [30, 70, 200, 300, 500 ,800, 1500, 2900, 5000, 8000],
}, {
label: ‘Reality‘,
data: [0, 1, 30, 70, 80, 100, 50, 80, 40, 150],
}]
},
});
</script>
</body>
</html>
使用live-server
live-server
https://timqian.com/chart.xkcd/
https://github.com/timqian/chart.xkcd
标签:资料 monthly 代码 set 图片 inf github meta java
原文地址:https://www.cnblogs.com/rongfengliang/p/11432226.html