Plotting Task Completions with DataviewJS and Obsidian Charts

A screenshot of a variety of different task dashboards in Obsidian.

Have you tried plotting in Obsidian?

Unfortunately, it can be challenging and technical.

But not today! If you want a way to track task completions over time, then look no further.

This is the easiest method I’ve found for task plotting in Obsidian, and it looks like this:

A stylized screenshot of several differently colored task dashboards in Obsidian.

Creating graphs is one of my favorite tricks in Obsidian, and I use data visualization every day in my own vault.

I wrote about this before now, but that article was intended for inspiration and not instruction. I asked readers to let me know if they want more details, and I received many requests for specific instructions.

You want instructions? Well here they are!


In order to create graphs in your own vault, there are a couple of community plugins that you need to install. If you haven’t already, search for and install these two plugins in your vault (click the links to open in Obsidian):

Then check your Dataview settings and make sure that “Enable JavaScript Queries” is ON. We’ll need that soon.

This solution depends on tasks completed in the style of the Tasks plugin. That means your tasks each have to have a completion date attached to them, preceded by a checkmark emoji (✅). The Tasks plugin isn’t mandatory, but it makes formatting tasks easy.

Note: If you haven’t used community plugins before, you might want to read How to use Community Plugins and a Beginner’s Guide to Dataview.

Plotting in Obsidian by using a script

Plotting in Obsidian can be complicated. That’s why, for the purposes of this article, I have created a simple script that anyone can use. Even if you know nothing about code, you can use this script.

You can see the script here. Download the file and place it somewhere within your vault.

Once you have the JS file included in your vault, copy this text and paste it into a new note in your vault (I call this note “Tasks Completed” but you can name it whatever you like):

days: 30
months: 6
years: 3
lineColor: '#de454e'
await dv.view("tasks-dashboard", {container: this.container});

If everything is configured properly, you should see something like this:

A screenshot of the default Tasks Dashboard.

How does the script work?

The Tasks Dashboard script relies on a few custom properties within your note. These custom properties allow you to change how the script operates.

Note: If Properties are new to you, check out our An Introduction to Obsidian Properties and Five Pro Tips for Obsidian Properties.

In the note you just created, the custom properties are all at the top of your file. They are:

  • days: change how many days the graph displays
  • months: change how many months the graph displays
  • years: change how many years the graph displays
  • projectfolder: By default this script searches your whole vault for tasks. Project folder allows you to limit the search to a specific folder or tag. If you want to limit the script to a folder, add the path to the folder in quotes, e.g. “path/to/folder”
  • lineColor: This allows you to change the color of your graph. Any hexadecimal color will work here, or you can leave it as the default.

Feel free to change the above properties to fine-tune your graph. I typically like having 30 days, 6 months, and 3 years for my dashboards, but you may find other ranges that work better for you.

You can also remove any of the date properties and the appropriate graph will disappear. So if you don’t have years of data, or you don’t find that metric useful, feel free to remove the years property and the graph will disappear.


If you manage tasks in Obsidian, I hope you’ll give this script a try. I’d love to hear if it works for you!

If you do use tasks but this script doesn’t work for you, feel free to reach out and let me know. If there’s a common use-case that this script doesn’t cover, I’d love to hear about it.

14 responses to “Plotting Task Completions with DataviewJS and Obsidian Charts”

  1. Thanks for the script. Easier to read than to write when not accustomed to js 😉
    Still I am stuck with an error msg ‘Dataview: custom view not found for ‘tasks-dashboard/view.js’ or ‘tasks-dashboard.js’.’ and I cannot figure out what that can mean. Any hint?

    1. Hi Guillaume! That error means that Dataview can’t find the correct script. You’ll need to download the script from this link and include it in your vault.

      Or, if you’ve already done that, perhaps the script was renamed? It needs to be named tasks-dashboard.js. Make sure Obsidian didn’t convert it into a Markdown file (then it would be called

      1. thanks for your answer. I had saved correctly in .js but the filename was inacurrate. Works perfectly now! Congrats for this amazing work

        1. Ah yep, that’s happened to me before too. You bet, glad you are enjoying it!

  2. I love this! But, I can’t seem to get the syntax right for limiting the tasks to a single project folder or tag, possibly due to the Properties update.

    For reference, I’ve been trying to use projectfolder: #’🔷Projects/Project Name’
    and it’s pulling more completed tasks that there are in that folder. Any suggestions?

    1. Hi JK! If you’re looking to use a folder, the syntax is a little different. Tags use the hashtag (#this/is/a/tag), folders use double quotes (“This/is/a/folder”)

      So if you’re trying to scope the graph to a folder, your yaml (or property) should look like this:

      projectfolder: "🔷Projects/Project Name"

      Letters are case sensitive, so make sure your folder path is exactly the same as the actual folders in your vault.

  3. Hi, I have 2 questions (complete noob in all this).
    The script is great and helps a lot but it only seems to pick up completed tasks from my daily note. I have various tasks in other notes (action points in meeting notes etc.) and completing these is not reflected in the graph.
    Second question: How can I add a graph for “weeks” i.e. a graph that shows the total of all completed tasks per week?

    1. Hello! Hm… That’s odd. Do you have the projectfolder set? And do you use the Tasks plugin? This script relies on the Tasks format for completed tasks (- [x] Like this ✅ 2021-09-16), so if you aren’t using that format then this script won’t work.

      This script doesn’t currently support weeks, but that’s a good idea! I may update it in the future to support that.

      1. Thanks for the answer!
        In the meantime, I figured out the reason for the first issue. First I tried with setting project folders etc. However, the actual reason is: When clicking/completing tasks from the to do list on the side bar, it does not add the “✅ 2021-09-16” format to the completed tasks. So the workaround is to check them directly in the respective note instead of the side bar. However, would bi nice to know if its possible to automate it in a way so that I can still use the todo list on the side.

        Let me know once there is a weeks option added 🙂
        I’m only using obsidian since a few month so my daily graph looks like an earthquake and the month graph (let alone the one for years) is too broad and doesn’t give much insight.

        1. Hey,
          you have to check the ‘Set done date on every completed task’ in the Tasks plugin preferences. That should do the job

          1. Thanks for the reply!

            I already have this. But it seems only to be triggered when I check the boxes IN the note. Not from the “TODOs” on the side.

        2. “To do list in the sidebar”…

          Do you use another plugin for this? Maybe the Reminders plugin?

          If so, it may not work with the Tasks plugin. You may have to find another solution for adding tasks to your sidebar (I use a pinned note myself)

          If that’s not the issue, then you might want to ask on the help section of the Obsidian Forum. Lots of smart people over there, and it’s a easier to figure out the details of your workflow in a forum context.

  4. I am getting this error:

    Evaluation Error: SyntaxError: missing ) after argument list
    at new Function ()
    at DataviewInlineApi.view (plugin:dataview:18565:20)
    at async eval (eval at (plugin:dataview), :1:54)
    at async DataviewJSRenderer.render (plugin:dataview:18651:13)

  5. Fixed it. There was some garbage character in the .js file.

    It works awesome! Thanks a lot!

Leave a Reply

Your email address will not be published. Required fields are marked *