This commit is contained in:
Tykayn 2023-09-22 16:09:39 +02:00 committed by tykayn
parent 8a0bbb06dc
commit e7a1921a3b
1 changed files with 13 additions and 11 deletions

View File

@ -4,12 +4,17 @@ import {promises as fs} from 'fs';
import * as dataOrgmode from '/home/tykayn/Nextcloud/ressources/social sorting/output/export_all_tasks.org_parsed.json'
const ouput_folder = '/home/tykayn/Nextcloud/ressources/social sorting/output/'
const width = 1000 // define width and height of canvas
const height = 1000
const typeOfRender = 'png'
const chartType = 'line'
// time in : weeks, months, years, days
// const time_agreggate = 'days'
// const time_agreggate = 'weeks'
const time_agreggate = 'months'
// const time_agreggate = 'years'
// const time_agreggate = 'months'
const time_agreggate = 'years'
function convertStats(tasks: any) {
let converted = []
let weeks = Object.keys(tasks['statistics']['statistics']['dates'][time_agreggate]);
@ -18,20 +23,20 @@ function convertStats(tasks: any) {
let dataSets_done = {
label: 'Done tasks',
data: [],
backgroundColor: 'rgb(115,190,75)',
backgroundColor: 'rgb(81,148,84)',
fill: {
target: 'origin',
above: 'rgb(151,208,221)',
above: 'rgb(81,148,84)',
below: 'rgb(115,190,75)',
}
}
let dataSets_created = {
label: 'Created tasks',
data: [],
backgroundColor: 'rgb(151,208,221)',
backgroundColor: 'rgb(69,219,255)',
fill: {
target: 'origin',
above: 'rgb(151,208,221)',
above: 'rgb(69,219,255)',
below: 'rgb(115,190,75)',
}
}
@ -46,7 +51,7 @@ function convertStats(tasks: any) {
dataSets_created.data.push(0)
}
if (info.closed) {
dataSets_done.data.push(-info.closed)
dataSets_done.data.push(info.closed)
} else {
dataSets_created.data.push(0)
}
@ -65,10 +70,7 @@ function convertStats(tasks: any) {
let convertedStats = convertStats(dataOrgmode)
console.log('convertedStats', convertedStats)
const width = 1000 // define width and height of canvas
const height = 1000
const typeOfRender = 'png'
const chartType = 'bar'
async function main(): Promise<void> {