JavaScript图形编程

3
2个回答

1

我猜你可以用一些修改来使用Chartist.js,看看我在CodePen上创建的示例

https://codepen.io/icaronz/pen/qBbvmNR

基本上,您需要设置Chartist.js不具有任何轴值:
var chart = new Chartist.Line('.ct-chart', {
  labels: [1, 2, 3, 4],
  series: [
    [1, 4, 2, 5],
    [2, 3, 1, 4]
  ]
}, {
  showPoint: false,
  showLine: false,
  showArea: true,
  fullWidth: true,
  showLabel: false,
  axisX: {
    showGrid: false,
    showLabel: false,
    offset: 0
  },
  axisY: {
    showGrid: false,
    showLabel: false,
    offset: 0
  },
  chartPadding: 0,
  low: 0,
  width: 400,
  height: 200
});

此外,不要忘记从CDN导入必要的CSS和JS。
<script src="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.js"></script>
<link href="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.css" rel="stylesheet" type="text/css" />

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接