Skip to content
Discussion options

You must be logged in to vote

fumbled my way to this... which works if it will help anyone else...

let prop = "studyHours"
let colour = "steelblue"

let array = dv.pages().where(p => p[prop]).sort(k => k.file.cday, 'asc').array();

var result = [];

array.reduce(function(res, value) {
  if (!res[value.file.cday]) {
    res[value.file.cday] = { cday: value.file.cday, [prop]: 0 };
    result.push(res[value.file.cday])
  }
  res[value.file.cday][prop] += value[prop];
  return res;
}, {});

let myVals =[]
let myLabels = []

result.forEach
(
p =>
	{
	myLabels.push(
	Intl.DateTimeFormat('en', { day: 'numeric', month: 'short' }).format(p.cday));

	myVals.push(p[prop]);
	}
);


const chartData2 = {
type: 'bar',

data: {
    d…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by davidlythgoe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant