{"id":13671036,"url":"https://github.com/SnailSword/spie","last_synced_at":"2025-04-27T13:33:31.334Z","repository":{"id":57367427,"uuid":"145402513","full_name":"SnailSword/spie","owner":"SnailSword","description":"轻量级、无依赖的圆头效果环形图控件","archived":false,"fork":false,"pushed_at":"2019-01-29T08:57:15.000Z","size":38,"stargazers_count":41,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-20T02:32:20.306Z","etag":null,"topics":["diagram","spie","svg"],"latest_commit_sha":null,"homepage":"https://snailsword.github.io/spie/demo.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SnailSword.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-20T10:24:39.000Z","updated_at":"2024-07-02T06:07:51.000Z","dependencies_parsed_at":"2022-08-23T19:30:48.151Z","dependency_job_id":null,"html_url":"https://github.com/SnailSword/spie","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnailSword%2Fspie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnailSword%2Fspie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnailSword%2Fspie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnailSword%2Fspie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SnailSword","download_url":"https://codeload.github.com/SnailSword/spie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251145854,"owners_count":21543110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diagram","spie","svg"],"created_at":"2024-08-02T09:00:56.497Z","updated_at":"2025-04-27T13:33:26.325Z","avatar_url":"https://github.com/SnailSword.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"![npmv](https://img.shields.io/npm/v/spie.svg)\n![size](https://img.shields.io/github/size/SnailSword/spie/dist/spie.js.svg)\n\n# SPie\n\n\u003e 轻量级、无依赖的圆头效果环形图控件。 [DEMO](https://snailsword.github.io/spie/demo.html)\n\n## 安装 Installation\n\n### npm\n\n```bash\n$ npm install spie\n```\n\n### 手动安装 Manual\n\n直接下载 `dist/spie.js` 并在 HTML 文件中引入：\n\n```html\n\u003cscript src=\"path/to/spie/dist/spie.js\"\u003e\u003c/script\u003e\n```\n\n### CDN\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/spie@latest/dist/spie.js\"\u003e\u003c/script\u003e\n```\n\n## 使用 Usage\n\n新建一个元素，设置好宽高(绘制的环形图将充满该元素)。\n\n```html\n\u003cdiv id=\"spie-1\" style=\"height: 100px;width: 100px\"\u003e\n```\n\n```js\nlet s1 = s.init(document.getElementById('spie-1'));\ns1.setOption().setData(0.2);\n```\n\n或\n\n```js\nlet s1 = s.init(document.getElementById('spie-1'));\ns1.setOption();\ns1.setData(0.2);\n```\n\n### 自定义参数 Custom Options\n\n```js\ns.setOption({\n    color: '#5fb333'\n}).setData(0.2);\n```\n\n* `color` (default: `'#108cee'`)\n\n  有数据部分的颜色\n\n* `bgc` (default: `'#fff'`)\n\n  圆环底色\n\n* `radius` (default: `[0.6, 0.8]`)\n\n  内外半径 大的为外半径小的为内半径 顺序无所谓 支持0-1的数字或百分数\n\n* `sw` (default: `0.2`)\n\n  线宽`stroke-width` 只有在`radius.length`为1或者内外半径为同一值的的时候才有效。\n\n* `precision` (default: `4`)\n\n  精度 小于`0.1^precision*5`视为`0`, 大于等于`1-0.1^precision*5`视为`1`, 这个配置是为了在需要显示具体数字时防止出现四舍五入到0或1之后圆环没有对应变空变满。设置为`false`或`0`, 会按正常的百分比计算。\n\n* `startingPoint` (default: `0`)\n\n  起始角度 最高点为0，顺时针算0-360度，支持传弧度制或角度制。数字会按角度制处理，`'30rad'`为弧度制。\n\n* `clockwise` (default: `true`)\n\n  是否顺时针旋转\n\n* `animation.show` (default: `true`)\n\n  是否开启动画\n\n* `animation.duration` (default: `0.75`)\n\n  动画持续时间\n\n* `animation.easing` (default: `'ease-in-out'`)\n\n  缓动效果 可选值:\n  `linear`、`ease`、`ease-in`、`ease-out`、`ease-in-out`、 `cubic-bezier(n,n,n,n)`\n\n\n\n\n### 设置数据时延 Delay\n\n```js\ns.setOption().setData(0.2, 1); // delay 1s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSnailSword%2Fspie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSnailSword%2Fspie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSnailSword%2Fspie/lists"}