This is an Obsidian plugin that helps you do tracking in daily notes and represent the data comprehensively. Here are examples showing what you can track:
From↓ | Track Targets↓ | by Tracker↓ | Get (O)ccurrence/(V)alue |
---|---|---|---|
content | #meditation | searchType: tag searchTarget: meditation |
O |
frontmatter | --- tags: meditation --- |
searchType: tag searchTarget: meditation |
O |
content | #weight:60.5kg | searchType: tag searchTarget: weight |
V |
content | #finance/bank1/transfer:100USD | searchType: tag searchTarget: finance/bank1/transfer |
V |
content | #finance/bank1/transfer:100USD #finance/bank1/income:80USD #finance/bank1/outcome:-120USD |
searchType: tag searchTarget: finance/bank1 |
V |
content | #blood-pressure:180/120 | searchType: tag searchTarget: blood-pressure[0], blood-pressure[1] |
V |
content | dvTarget:: 20.5 | searchType: dvField searchTarget: dvTarget |
V |
content | dvTarget:: 20.5/30.5 | searchType: dvField searchTarget: dvTarget[0], dvTarget[1] |
V |
content | dvTarget:: 20.5, 30.5 | searchType: dvField searchTarget: dvTarget[0], dvTarget[1] separator: ',' |
V |
frontmatter | --- mood: 10 --- |
searchType: frontmatter searchTarget: mood |
V |
frontmatter | --- bp: 184.4/118.8 --- |
searchType: frontmatter searchTarget: bp[0], bp[1] |
V |
frontmatter | --- bp: 184.4, 118.8 --- |
searchType: frontmatter searchTarget: bp[0], bp[1] separator: ',' |
V |
frontmatter | --- bp: [184.4, 118.8] --- |
searchType: frontmatter searchTarget: bp[0], bp[1] |
V |
content | [[journal]] | searchType: wiki searchTarget: journal |
O |
content | ⭐ | searchType: text searchTarget: ⭐ |
O |
content | love | searchType: text searchTarget: love |
O |
content | test@gmail.com test@hotmail.com |
searchType: text serchTarget: '.+\@.+\..+' |
O |
content | #weightlifting: 50 | searchType: text searchTarget: 'weightlifting: (?<value>[\-]?[0-9]+[\.][0-9]+|[\-]?[0-9]+)' |
V |
content | I walked 10000 steps today. | searchType: text searchTarget: 'walked\s+(?<value>[0-9]+)\s+steps' |
V |
content | myvalues 1/2/3 | searchType: text searchTarget: 'myvalues\s+(?<value>[0-9]+)/([0-9]+)/([0-9]+), myvalues\s+([0-9]+)/(?<value>[0-9]+)/([0-9]+), myvalues\s+([0-9]+)/([0-9]+)/(?<value>[0-9]+)' |
V |
content | { a table filled with dates and values } example table |
searchType: table searchTarget: filePath[0][0], filePath[0][1] |
V |
content | { a table filled with dates and values } example table |
searchType: table searchTarget: filePath[1][0], filePath[1][1][0], filePath[1][1][1] |
V |
- From Settings Panel (the icon at the bottom left corner) -> Options -> Community plugins, set 'safe mode' to off.
- In the 'Community plugins' section, click 'Browse' and find the obsidian-tracker plugin by the name 'Tracker'.
- Press the button 'Install' and wait for the completion of the install.
- In the section 'Installed plugins', find and enable the plugin just installed.
- Enjoy tracking.
Download the latest release. Extract and put the three files (main.js, manifest.json, styles.css) to folder '{{obsidian_vault}}/.obsidian/plugins/obsidian-tracker'.
-
Have some targets you want to track in daily notes. Take a look at Target Evaluation for what you can track and how targets are evaluated as numbers.
-
Add a new note for displaying the tracker.
-
Add tracker code blocks manually or using commands. See Commands for more detail.
-
Switch the document view mode to 'Preview', then the code block will get rendered.
For more use cases, please open the examples folder in obsidian with this plugin installed and enabled.
This plugin was designed to read code blocks in YAML format. The key-value pairs in the code blocks tell the plugin what data to collect and how to represent the result.
Here are all the parameters (key-value pairs) defined in this plugin. They are used for collecting data, evaluating targets, data preprocessing, and rendering output.
Providing parameters 'searchType' and 'searchTarget' is the minimum requirement for a successful data collection. The value of the key 'searchType' can be 'tag', 'frontmatter', 'wiki', 'dvField', 'table', or 'text' and the cooresponding 'searchTarget' should be provided according to the specified type.
From version 1.3, you can provide multiple search targets by entering an array of targets separated by a comma. Each of the targets will be identified then the corresponding value will be evaluated and form a dataset indexed by the order in the array (zero-based indexing).
searchTarget: target0, target1, target2, ......
searchType: type0, type1, type2, .....
line:
lineColor: red, blue, yello
Above is an example of multiple target searching. Multiple targets are provided and separated by a comma. If they have a different searchType, provide the same number of types in the same order. In this case, the second search target 'target1' with index 1 has type 'type1'. Other parameters that accept multiple values (e.g. lineColor) can also be provided and will be applied to the corresponding dataset.
Multiple values under a target (value tuple) separated by a slash, e.g. #bloodpressure:180/120mmHg, are also got supported in version 1.3.0. To identify a specific value as a target, use an accessor with bracket notation where the value in the bracket is the index by the order of values. In this case, they are bloodpressure[0] and bloodpressure[1]. You can find the example of this here. You can also use a custom separator by using the parameter 'separator'.
Depends on the 'searchType' and the 'searchTarget' you provided, the evaluation of a target would be different. Simply speaking, you can track the occurrences of a target or the value attached/embedded in it.
To see the detail about the target evaluation, please check the document Target Evaluation.
Currently, obsidian-tracker provides three kinds of rendering output, the default one 'line' for a line chart, 'bar' for a bar chart, and 'summary' for a text block.
For 'line' or 'bar' output, the plugin will generate a customizable chart. For 'summary' output, a text block based on your 'template' parameter will be generated. You can also use pre-defined template variables in the template.
Description for the chart and summary related paremeters can be found here and here respectively.
You can set the default folder location and date format in the plugin's settings panel. You can also override them by key 'folder' and 'dateFormat' in the code block respectively.
Setting Item | Description | Default |
---|---|---|
Default folder location | The folder your daily notes reside | Root of the vault |
Default date format | The date format of your daily note title | 'YYYY-MM-DD' |
For more information about the dateFormat settings, check the TestDateFormats example and moment.js string format.
- Fixed labels not shown in light theme
- Enhanced error handling for searchType 'table'
- New searchType 'table', searching records from a given table
- New searchType 'dvField', searching the inline fields used with Dataview plugin
- Enhance multiple values extraction
- Allow using multiple values in searchType 'text'
- Allow using array values in searchType 'frontmatter'
- Allow using multiple values in searchType 'dvField'
- Allow using multiple values in searchType 'table'
- Allow using custom separator for multiple values extraction
- Improve performance
- Reduce package size
- Enhanced error handling
- Add a new parameter (fixedScale) for the scaling of the output chart
- Add a new parameter (fitPanelWidth) to enable/disable the auto-scaling of the output chart
- Add a new parameter (margin) to help to position the chart
- Tested in Obsidian mobile app on iPhone and iPad
- Fixed bugs
- Support reading and rendering multiple targets
- Support reading and rendering multiple values (a tuple of values) under a target
- New output type 'bar', rendering bar chart
- Add a legend for the chart output
- Fixed bugs
- Fixed files with the specified dateFormat are not recognized
- Restored the plugin's settings panel for dateFormat and folder
- Enable using regular expression in text searching
- New search type 'frontmatter', searching for key-value pairs in the front matter
- New search type 'wiki', searching for wiki links
- Reduced package size
- New output type 'summary'
- Add commands help create Tracker code blocks
- Relaxed the regex for searching tags, allowing tags embedded in sentences
- Fixed issues
- Fixed the searching of nested tag in frontmatter
- Reduced the package size by using the module from Obsidian
- Remove dependencies to Node.js modules
- Add example markdown files
First version released at 2021-03-23
- Track simple tags, value-attached tags, and texts using code blocks
- Represent the tracked data in a customizable line chart
- Allow tracking in-line tags and tags in frontmatter
- Allow tracking nested tags
- Data Collecting
- Support tracking key-value pairs in frontmatter
- Support searching text using regular expression
- Support multiple targets and multiple values.
- Add a parameter xDataset to identify targets to be used as x values
- Allow tracking date and time values
- Get data from a table
- Collect data from dataview plugin's inline fields
- Allow manual data input, includes template varialbes embeded in
- New search type 'codeblock'
- Output Type and Graph
- New output type 'summary', analyzes the input data and represents it using a user-defined text template.
- New output type 'bar', renders bar chart.
- New output type 'table', lists the search result in a formatted table.
- New output type 'heatmap', works like Github calendar heatmap.
- Add parameters for adjusting the size of the graph.
- Multiple outputs from one code block
- Support graphs showing the correlation between sets of data.
- Add a 'targetDataSet' key to graph, allow the graph drawing selected dataset.
- Evaluate template parameters by predefined function and arithmetics.
- Helper
- Add Commands help create Tracker blocks.
- Add an 'Explode' button to the rendered blocks, it will replace the code block with the rendered result.
- Add a helper panel for adding frequently used tracking targets to article.
- Data Processing
- Allow arithmetics operation on dataset and generate new datasets
- Add data post-process function, e.g. 'moving average'
- Performance
- Use PixiJS to do rendering
And more ...
P.S. Features may not be implemented in the order above.
- If you like this plugin or want to support further development, you can Buy Me a Coffee.
- Please report bugs and request features in GitHub Issues