gaomingcode/gauge.js

100%原生且外观酷炫的JavaScript仪表盘。

安装: 5

依赖者: 0

建议者: 0

安全性: 0

星标: 0

关注者: 0

分支: 391

语言:CoffeeScript

1.3.7 2021-06-05 04:32 UTC

This package is auto-updated.

Last update: 2024-09-05 17:22:02 UTC


README

GitHub Version Packagist Downloads Github License

安装

Composer

composer require gaomingcode/gauge.js

原始ReadMe

100%原生且外观酷炫的动态JavaScript/CoffeeScript仪表盘。

  • 无图片,无外部CSS - 纯canvas
  • 无依赖
  • 高度可配置
  • 分辨率无关
  • 动态变化仪表盘值
  • 在所有主流浏览器中工作
  • MIT许可

用法

var opts = {
  angle: 0.15, /// The span of the gauge arc
  lineWidth: 0.44, // The line thickness
  pointer: {
    length: 0.9, // Relative to gauge radius
    strokeWidth: 0.035 // The thickness
  },
  colorStart: '#6FADCF',   // Colors
  colorStop: '#8FC0DA',    // just experiment with them
  strokeColor: '#E0E0E0'   // to see which ones work best for you
};
var target = document.getElementById('foo'); // your canvas element
var gauge = new Gauge(target).setOptions(opts); // create sexy gauge!
gauge.maxValue = 3000; // set max gauge value
gauge.setMinValue(0);  // set min value
gauge.set(1250); // set actual value

有关交互式演示和所有支持选项的列表,请参阅项目的首页

包装器

gauge.js可以包装到多个框架中。以下是一些示例