Compare commits

..

No commits in common. "ad9dfdc1576149907cb1806b4e6f5b68674ab9be" and "1f2eb2f4833e5712bf5769d28385c75b02e35c04" have entirely different histories.

2 changed files with 4 additions and 9 deletions

View File

@ -1,5 +1,5 @@
script: bun ./app.js script: node ./app.js
cwd: ./ cwd: ./
watch: true watch: true
name: stats:30303 name: stats:30303

View File

@ -24,7 +24,7 @@ function text({ color, name, pc, idx }) {
` `
} }
function pie(langs = [], sum = 0, width, height, mobile) { function pie(langs = [], sum = 0, height, mobile) {
let per = 0.25 let per = 0.25
let deg = per * 2 * Math.PI // 从90度开始计算 let deg = per * 2 * Math.PI // 从90度开始计算
// 圆心坐标,半径 // 圆心坐标,半径
@ -38,11 +38,6 @@ function pie(langs = [], sum = 0, width, height, mobile) {
radius = ~~((height - 64) / 2) - (langs.length > 10 ? 24 : 0) // 最小半径 radius = ~~((height - 64) / 2) - (langs.length > 10 ? 24 : 0) // 最小半径
cx = langs.length > 12 ? 520 : langs.length <= 6 ? 384 : 464 cx = langs.length > 12 ? 520 : langs.length <= 6 ? 384 : 464
cy = radius + (langs.length > 10 ? 64 : 48) cy = radius + (langs.length > 10 ? 64 : 48)
let _cx = width - radius * Math.pow(1.05, langs.length)
if (_cx - cx > 10) {
cx = _cx - 10
}
} }
return langs return langs
@ -85,7 +80,7 @@ export function render(
} }
if (langs.length < 5) { if (langs.length < 5) {
width -= 256 width -= 304
} else if (langs.length > 4 && langs.length < 7) { } else if (langs.length > 4 && langs.length < 7) {
width -= 240 width -= 240
} else if (langs.length > 6 && langs.length <= 12) { } else if (langs.length > 6 && langs.length <= 12) {
@ -148,7 +143,7 @@ export function render(
.join('')} .join('')}
</g> </g>
<g class="lang-pie">${pie(langs, sum, width, height, mobile)}</g> <g class="lang-pie">${pie(langs, sum, height, mobile)}</g>
</svg> </svg>
` `
} }