I want to convert "Dataview" code to "Dataviewjs" code.

What I’m trying to do

```dataviewjs
const daysPath = dv.current().file.folder;

const attributes = {
	'panic': {
		label: 'Panic',
		average: 10,
	},
	'money-spent': {
		label: 'Money Spent',
		backgroundColor: 'rgba(85, 174, 229, 0.2)',
		borderColor: 'rgba(85, 174, 229, 1)',
		average: 20,
	},
	'prayer': {
		label: 'Prayer',
		backgroundColor: 'rgba(255, 211, 101, 0.2)',
		borderColor: 'rgba(255, 211, 101, 1)',
		average: 5,
	},
	'steps': {
		label: 'Steps',
		backgroundColor: 'rgba(141, 82, 188, 0.2)',
		borderColor: 'rgba(141, 82, 188, 1)',
		average: 10000,
	},
	'hours-worked': {
		label : 'Hours Worked',
		backgroundColor: 'rgba(143, 208, 50, 0.2)',
		borderColor: 'rgba(143, 208, 50, 1)',
		average: 6
	},
};

const date = "**";

customJS.DvCharts.renderWeeklyChart({
	dv,
	context: this,
	daysPath: '**',
	attributes,
	type: 'average',
	date
})


I want to integrate the following code into the code above.


FROM #event AND -“Şablon”
WHERE week = this.week



### Things I have tried

I'm trying to find someone who understands these codes because I don't understand them at all. I haven't found anyone to help me for days.

Can you describe what your code does? I’m unfamiliar with a few of those methods.

The customJS.DvCharts.renderWeeklyChart() is not a standard function of neither dataviewjs nor CustomJS, so you need to provide more information before we can suggest how to limit your weekly query.

In general though, the criteria you suggest could usually be done through something like:

dv.pages('#event AND -"Şablon"')
  .where(p => p.week == dv.current().week)

Where to put in your script is the part needing more information. Most likely you need to go into the definition of the DvCharts class and modify. If you’re lucky, it’s possible to add this as yet another parameter to the renderWeeklyChart() function.

This code shows the statistics of habits. What I want to do is to pull the data I want from the notes with the “event” tag. I want to pull this data with the “week” tag from the grades that are in the same week as my current grade. For this, the “dataview” code does not necessarily need to be integrated. If what I want can be done with the “dataviewjs” code, that’s fine too.

Although I learnt “dataview” with great efforts, I don’t know how the others are, what they look like. This code shows the statistics of habits. What I want to do is to pull the data I want from the notes with the “event” tag. I want to pull this data from the grades that are in the same week as my current grade with the “week” tag.

You’re still not answering the main question on what is that renderWeeklyCharts() function, and how is it defined. It’s not a standard function, and before we know how it’s defined we can’t help you.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.