fix(plugins/isocalendar): use local max rather than all-time max for bars scaling (#532) [skip ci]
This commit is contained in:
@@ -40,6 +40,7 @@ export default async function({login, data, graphql, q, imports, queries, accoun
|
|||||||
//Compute the highest contributions in a day, streaks and average commits per day
|
//Compute the highest contributions in a day, streaks and average commits per day
|
||||||
console.debug(`metrics/compute/${login}/plugins > isocalendar > computing stats`)
|
console.debug(`metrics/compute/${login}/plugins > isocalendar > computing stats`)
|
||||||
const {streak, max, average} = await statistics({login, data, graphql, queries})
|
const {streak, max, average} = await statistics({login, data, graphql, queries})
|
||||||
|
const reference = Math.max(...calendar.weeks.flatMap(({contributionDays}) => contributionDays.map(({contributionCount}) => contributionCount)))
|
||||||
|
|
||||||
//Compute SVG
|
//Compute SVG
|
||||||
console.debug(`metrics/compute/${login}/plugins > isocalendar > computing svg render`)
|
console.debug(`metrics/compute/${login}/plugins > isocalendar > computing svg render`)
|
||||||
@@ -64,7 +65,7 @@ export default async function({login, data, graphql, q, imports, queries, accoun
|
|||||||
j = 0
|
j = 0
|
||||||
//Iterate through days
|
//Iterate through days
|
||||||
for (const day of week.contributionDays) {
|
for (const day of week.contributionDays) {
|
||||||
const ratio = day.contributionCount / max
|
const ratio = day.contributionCount / reference
|
||||||
svg += `
|
svg += `
|
||||||
<g transform="translate(${j * -1.7}, ${j + (1 - ratio) * size})">
|
<g transform="translate(${j * -1.7}, ${j + (1 - ratio) * size})">
|
||||||
<path fill="${day.color}" d="M1.7,2 0,1 1.7,0 3.4,1 z" />
|
<path fill="${day.color}" d="M1.7,2 0,1 1.7,0 3.4,1 z" />
|
||||||
|
|||||||
Reference in New Issue
Block a user