fix: linter

This commit is contained in:
Simon Lecoq
2023-03-15 19:42:53 -04:00
parent 479e6e9a87
commit 566ee2075b
4 changed files with 18 additions and 12 deletions

View File

@@ -18,6 +18,7 @@ npx
personaname personaname
pgn pgn
playerstats playerstats
rbga
rtime rtime
scm scm
shas shas
@@ -30,9 +31,14 @@ steamcommunity
steamid steamid
steamids steamids
steampowered steampowered
tdatum
timecreated timecreated
tspan
ubuntu ubuntu
unlocktime unlocktime
userid userid
xticked
xticks
yargsparser yargsparser
yticked
webtoken webtoken

View File

@@ -809,7 +809,7 @@ export class D3node {
} }
} }
/** Graph utilities */ /**Graph utilities */
export const Graph = { export const Graph = {
/**Timeline graph */ /**Timeline graph */
timeline() { timeline() {
@@ -825,7 +825,7 @@ export const Graph = {
const margin = {top:10, left:10, right:10, bottom:45} const margin = {top:10, left:10, right:10, bottom:45}
const d3n = new D3node() const d3n = new D3node()
const svg = d3n.createSVG(width, height) const svg = d3n.createSVG(width, height)
//Data //Data
const X = data.map(({x}) => x) const X = data.map(({x}) => x)
const start = X.at(0) const start = X.at(0)
@@ -855,7 +855,7 @@ export const Graph = {
.style("text-anchor", "end") .style("text-anchor", "end")
.style("font-size", 20) .style("font-size", 20)
.attr("fill", "rgba(127, 127, 127, .8)") .attr("fill", "rgba(127, 127, 127, .8)")
//Data range //Data range
const y = d3.scaleLinear() const y = d3.scaleLinear()
.domain([high, low]) .domain([high, low])
@@ -869,7 +869,7 @@ export const Graph = {
.selectAll("text") .selectAll("text")
.style("font-size", 20) .style("font-size", 20)
.attr("fill", "rgba(127, 127, 127, .8)") .attr("fill", "rgba(127, 127, 127, .8)")
//Generate graph line //Generate graph line
const datum = Y.map((y, i) => [X.at(i), y]) const datum = Y.map((y, i) => [X.at(i), y])
const tdatum = Y.map((y, i) => [X.at(i), y, T[i]]) const tdatum = Y.map((y, i) => [X.at(i), y, T[i]])
@@ -888,7 +888,7 @@ export const Graph = {
.attr("fill", "transparent") .attr("fill", "transparent")
.attr("stroke", "#87ceeb") .attr("stroke", "#87ceeb")
.attr("stroke-width", 2) .attr("stroke-width", 2)
//Generate graph area //Generate graph area
if (area) { if (area) {
svg.append("path") svg.append("path")
@@ -904,7 +904,7 @@ export const Graph = {
) )
.attr("fill", "rgba(88, 166, 255, .1)") .attr("fill", "rgba(88, 166, 255, .1)")
} }
//Generate graph points //Generate graph points
if (points) { if (points) {
svg.append("g") svg.append("g")
@@ -917,7 +917,7 @@ export const Graph = {
.attr("r", 2) .attr("r", 2)
.attr("fill", "#106cbc") .attr("fill", "#106cbc")
} }
//Generate graph text //Generate graph text
if (text) { if (text) {
svg.append("g") svg.append("g")
@@ -938,7 +938,7 @@ export const Graph = {
.text(d => d[2] ? d[2] : "") .text(d => d[2] ? d[2] : "")
.attr("fill", "rgba(127, 127, 127, .8)") .attr("fill", "rgba(127, 127, 127, .8)")
} }
return d3n.svgString() return d3n.svgString()
}, },
/**Pie Graph */ /**Pie Graph */
@@ -947,7 +947,7 @@ export const Graph = {
const radius = Math.min(width, height) / 2 const radius = Math.min(width, height) / 2
const d3n = new D3node() const d3n = new D3node()
const svg = d3n.createSVG(width, height) const svg = d3n.createSVG(width, height)
//Data //Data
const K = Object.keys(data) const K = Object.keys(data)
const V = Object.values(data) const V = Object.values(data)
@@ -958,7 +958,7 @@ export const Graph = {
const arcs = d3.pie().padAngle(1/radius).sort(null).value(i => V[i])(I) const arcs = d3.pie().padAngle(1/radius).sort(null).value(i => V[i])(I)
const arc = d3.arc().innerRadius(0).outerRadius(radius) const arc = d3.arc().innerRadius(0).outerRadius(radius)
const labels = d3.arc().innerRadius(radius/2).outerRadius(radius/2) const labels = d3.arc().innerRadius(radius/2).outerRadius(radius/2)
svg.append("g") svg.append("g")
.attr("transform", `translate(${width/2},${height/2})`) .attr("transform", `translate(${width/2},${height/2})`)
.attr("stroke", "white") .attr("stroke", "white")

View File

@@ -126,7 +126,7 @@ export default async function({login, data, rest, imports, q, account}, {enabled
].map(({type, data, high, low, ticks, colors = null, labels = null, half = false}) => { ].map(({type, data, high, low, ticks, colors = null, labels = null, half = false}) => {
const width = 480 * (half ? 0.45 : 1) const width = 480 * (half ? 0.45 : 1)
const height = 160 const height = 160
if (type === "line") if (type === "line")
return imports.Graph.line(Object.entries(data).map(([x, y]) => ({x:+x, y})), {low, high, ticks, labels, width, height}) return imports.Graph.line(Object.entries(data).map(([x, y]) => ({x:+x, y})), {low, high, ticks, labels, width, height})
console.log(data) console.log(data)
if (type === "pie") if (type === "pie")

View File

@@ -67,7 +67,7 @@ export default async function({login, graphql, data, imports, q, queries, accoun
let charts = _charts ? true : null let charts = _charts ? true : null
if ((["graph", "chartist"].includes(_charts_type)) && (imports.metadata.plugins.stargazers.extras("charts.type", {extras}))) { if ((["graph", "chartist"].includes(_charts_type)) && (imports.metadata.plugins.stargazers.extras("charts.type", {extras}))) {
console.debug(`metrics/compute/${login}/plugins > stargazers > generating charts`) console.debug(`metrics/compute/${login}/plugins > stargazers > generating charts`)
charts = await Promise.all([{data: total, low: total.min, high: total.max}, {data: increments, low: 0, high: increments.max, sign: true}].map(({data: {dates: set}, low, high, sign = false}) => charts = await Promise.all([{data: total, low: total.min, high: total.max}, {data: increments, low: 0, high: increments.max, sign: true}].map(({data: {dates: set}, low, high, sign = false}) =>
imports.Graph.timeline(Object.entries(set).map(([x, y]) => ({x:new Date(x), y, text:imports.format(y, {sign})})), {low, high, imports.Graph.timeline(Object.entries(set).map(([x, y]) => ({x:new Date(x), y, text:imports.format(y, {sign})})), {low, high,
match:(data, ticks) => data.filter(([x]) => ticks.map(t => t.toISOString().slice(0, 10)).includes(x.toISOString().slice(0, 10))), match:(data, ticks) => data.filter(([x]) => ticks.map(t => t.toISOString().slice(0, 10)).includes(x.toISOString().slice(0, 10))),
}) })