Skip to content

Commit

Permalink
Update documents
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrochlore committed Jul 27, 2021
1 parent 64efa45 commit 8cc4f4c
Show file tree
Hide file tree
Showing 11 changed files with 242 additions and 176 deletions.
37 changes: 15 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
# Obsidian Tracker Plugin

![GitHub release](https://img.shields.io/github/v/release/pyrochlore/obsidian-tracker)

<img src="https://raw.githubusercontent.com/pyrochlore/obsidian-tracker/master/docs/images/screenshot_v1.7.png" width="800">

This is an [Obsidian](https://obsidian.md/) plugin that helps you do tracking in notes and represent the collected data comprehensively.
This is an [Obsidian](https://obsidian.md/) plugin that helps you collect data from notes and represent it comprehensively.

[Here](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/Examples.md) is a table containing simplified examples showing what you can track.

## !!! Breaking Changes !!!

[Here](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/Examples.md) is a simplified table of examples showing what you can track.
From version 1.9.0, template variables, e.g. '{{sum}}', are deprecated. Instead, Tracker provide operators (+, -, *, /, %) and functions (dataset(), sum(), maxStreak(), ......etc) to help us do data processing. For users having code blocks from previous version, please replace '{{sum}}' by '{{sum()}}' or '{{sum(1)}}' by '{{sum(dataset(1))}}'. More information about the new expressions could be found [here](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/Expressions.md).

## What's New
Version 1.8.0
- Add a new `searchType` `task`, retrieving data from tasks ([examples](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestTask.md))
- Enhancement
- Month view ([examples](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestCalendar.md))
- Add parameter `circleColorByValue` to show color based on the value
- Support multiple targets (dataset), change the dataset by clicking the header
- Add a button to show current month
- Accept ISO-8601 date as `dateFormat` ([examples](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestDateFormats.md#iso-8601-date-format))
- Relative date input for `startDate` and `endDate` ([examples](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestDateFormats.md#relative-date-input-for-startdate-and-enddate))
- Fixed missing dvField values at the last line of files

Version 1.8.1
- Fixed bugs while using month view with parameter `xDataset`

Version 1.8.2
- Fixed tasks searching not working for multiple targets

Version 1.9.0
- Add a new output type `pie`, rendering a pie chart ([examples](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestPieChart.md))
- Allow expressions (operators and functions) as data inputs for output type `summary`, `bullet`, and `pie` (examples: [expression](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestExpression.md), [summary](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestSummary.md), [bullet](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestBullet.md), [pie](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestPieChart.md))
- Allow formatting evaluated expressions by a follwing format string ([examples](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestExpression.md))

## Usage

1. Have some targets you want to track in daily notes.
2. Add a new note for displaying the tracker.
3. Add tracker code blocks manually or using [commands](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/Commands.md).
3. Add tracker code blocks manually ([examples](https://github.com/pyrochlore/obsidian-tracker/tree/master/examples)) or using [commands](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/Commands.md).
4. Switch the document view mode to 'Preview', then the code block will get rendered.

<img src="https://raw.githubusercontent.com/pyrochlore/obsidian-tracker/master/docs/images/usage_v1.3.gif" width="400">

For more use cases, please download and open the [examples](https://github.com/pyrochlore/obsidian-tracker/tree/master/examples) folder in obsidian with this plugin installed and enabled.

## More Details You May Want to Know
- [Installation](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/Installation.md): Install the plugin from Obsidian or install it manually
- [Concepts](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/Concepts.md): Explain how this plugin works and what to setup
- [Target Evaluation](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/TargetEvaluation.md)
- [Input Parameters](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/InputParameters.md)
- [Template Variables](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/TemplateVariables.md)
- [Expressions](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestExpression.md)
- [Examples](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/Examples.md)
- [Plugin Settings](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/Settings.md)
- [Release Notes](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/ReleaseNotes.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/Commands.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Commands

To smooth the process of making trackers, obsidian-tracker provides three commands (There will be more in the future release), "Add Line Chart Tracker", "Add Bar Chart Tracker", and "Add Summary Tracker; Just type Ctrl/Cmd+P to activate the command palette, then type "Tracker" to search these commands.
To smooth the process of making trackers, obsidian-tracker provides three commands (There will be more in the future release), "Add Line Chart Tracker", "Add Bar Chart Tracker", and "Add Summary Tracker". Just type Ctrl/Cmd+P to activate the command palette, then type "Tracker" to search these commands.

After a command is executed, a code block will be added to the next line below your cursor position for you. The added code block will contain the most frequently used keys. To see the complete list of input parameters and description, please check [this document](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/InputParameters.md).
12 changes: 7 additions & 5 deletions docs/Concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ To see the detail about the target evaluation, please check the document [Target

### Rendering Output

Currently, obsidian-tracker provides five kinds of rendering output: `line`, `bar`, `summary`, `bullet`, and `month`. You have to provide at least one output parameter in a code block.
Currently, obsidian-tracker provides five kinds of rendering output: `line`, `bar`, `summary`, `bullet`, `month` and `pie`. You have to provide at least one output parameter in a code block.

With output set to `line` or `bar`, Tracker plugin will generate a customizable chart. These charts are very good at seeing the variation of collected number in the notes.
With output type set to `line` or `bar`, Tracker plugin will generate a customizable chart. These charts are very good at seeing the variation of collected number in the notes.

With the `summary` output, a text block based on your '**template**' parameter will be created. You can use [pre-defined template variables](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/TemplateVariables.md) like '{{sum}}' or '{{maxStreak}}' in the template parameter, to get a statistical summary of collected data.
With the output type `summary`, a text block based on your '**template**' parameter will be created. You can use [expressions](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/Expressions.md) like '{{sum()}}' or '{{maxStreak()}}' in the template parameter, to get a statistical summary of collected data.

`bullet` output creates a [bullet chart](https://en.wikipedia.org/wiki/Bullet_graph) and could serve as a gauge showing the status (level, performance, progress) of a dataset.
Output type `bullet` creates a [bullet chart](https://en.wikipedia.org/wiki/Bullet_graph) and could serve as a gauge showing the status (level, performance, progress) of a dataset.

`month` output creates a month view with circled dates exceeding the given threshold and streaks showing how long it persisted.
Output type `month` creates a month view with circled dates exceeding the given threshold and streaks showing how long it persisted.

Output type `pie` creates a pie chart. The `data` parameter should be applied for circular sectors you want to add. Parameter `label` and `extLabel` are used for displaying labels and `dataName` is used for the diplay names on legend.

Detailed description for all parameters of the output types can be found [here](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/InputParameters.md).
5 changes: 3 additions & 2 deletions docs/Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,18 @@ List of all examples
- [Calendar](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestCalendar.md)
- [Date Formats](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestDateFormats.md)
- [Dataview Inline Field](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestDvField.md)
- [Expression](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestExpression.md)
- [File Meta](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestFileMeta.md)
- [Legends](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestLegends.md)
- [Multiple Targets / Multiple Values](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestMultipleTargetsMultipleValues.md)
- [Pie Chart](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestPieChart.md)
- [Scaling and Positioning](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestScalingAndPositioning.md)
- [Table](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestTable.md)
- [Task](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestTask.md)
- [Template Variables](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestTemplateVariables.md)
- [Time Values](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestTimeValues.md)
- [Word Counting](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestWordCounting.md)
- [X Dataset](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestXDataset.md)
- [Regular Expression](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TrackUsingRegex.md)
- [Regular Expression](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestRegex.md)
- [Weight Tracker](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/WeightTracker.md)
- [Wiki](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/WikiTracker.md)

95 changes: 95 additions & 0 deletions docs/Expressions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Expressions

Expressions could help us create new and meaningful data from the original collected data by using operators and functions.

## !!! Breaking Changes !!!

From version 1.9.0, template variables, e.g. '{{sum}}', are deprecated. Instead, Tracker provide operators (+, -, *, /, %) and functions (dataset(), sum(), maxStreak(), ......etc) to help us do data processing. For users having code blocks from previous version, please replace '{{sum}}' by '{{sum()}}' or '{{sum(1)}}' by '{{sum(dataset(1))}}'.

## Where to Use

Currently, we can only use expressions in some parameters. These includes `template` in `summary` output, `value` in `bullet` output, and `data` `label` `extLabel` in `pie` output. In future release, we might add a parameter `dataset` accepting expressions to be used with other output type.

## How to Use

Expressions should be be wrapped in curly brackets. By Using the combination of operatora and funtions listed beloew, Tracker will try to resolve the whole expression in brackets and then generate a number or a string according to what was requested.

If the resolved expreasion is a string, we can optionally provide a format string by adding it right after the expression and two extra colons.

The following tables show all the operators and functions available for now. Please make sure the input type and output type when you are combining them together. Examples could be found [here](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestExpression.md)).

## List of Operators

### Uniry Operators

| Function | Description | Operant | Output |
|:---------|:------------|:--------|:------|
| + | positive | number or dataset | number or dataset |
| - | negative | number or dataset | number or dataset |

### Binary Operators

| Function | Description | Left Operant | Right Operant | Output |
|:---------|:------------|:-----|:------|:-------|
| + | plus | number or dataset | number or dataset | number or dataset |
| - | minus | number or dataset | number or dataset | number or dataset |
| * | multiply | number or dataset | number or dataset | number or dataset |
| / | divide | number or dataset | number or dataset | number or dataset |
| % | modulo | number or dataset | number or dataset | number or dataset |

e.g.
number + number --> number
dataset + number --> dataset
number + dataset -> dataset
dataset + dataset --> dataset

## List of Functions

### Get dataset from index

| Function(Input Args): Output | Description |
|:------------------|:-----------|
| dataset(id: number): Dataset | Get dataset from dataset id (the order in `searchTarget` |

### Functions Accept Dataset and return a value

If the input dataset is missing, it will use the first available Y dataset found.

| Function(Input Args): Output | Description |
|:------------------|:-----------|
| min(dataset: Dataset): number | Minimum value of the dataset |
| minDate(dataset: Dataset): Date | Latest date of minimum value |
| max(dataset: Dataset): number | Maximum value of the dataset |
| maxDate(dataset: Dataset): Date | Latest date of maximum value |
| startDate(dataset: Dataset): Date | Start date of the dataset |
| endDate(dataset: Dataset): Date | End date of the dataset |
| sum(dataset: Dataset): number | Summation of values of the dataset |
| numTargets(dataset: Dataset): number | Total counts of targets |
| numDays(dataset: Dataset): number | Days from startDate to endDate |
| numDaysHavingData(dataset: Dataset): number | Number of days having data |
| maxStreak(dataset: Dataset): number | Maximum continuous days without breaks |
| maxStreakStart(dataset: Dataset): Date | Start date of the max streak |
| maxStreakEnd(dataset: Dataset): Date | End date of the max streak |
| maxBreaks(dataset: Dataset): number | Maximum break days |
| maxBreaksStart(dataset: Dataset): Date | Start date of the maximum break days |
| maxBreaksEnd(dataset: Dataset): Date | End date of the maximum break days |
| currentStreak(dataset: Dataset): number | Current continuous days |
| currentStreakStart(dataset: Dataset): Date | Start date of current streak |
| currentStreakEnd(dataset: Dataset): Date | End date of current streak |
| currentBreaks(dataset: Dataset): number | Current break days |
| currentBreaksStart(dataset: Dataset): Date | Start date of current breaks |
| currentBreaksEnd(dataset: Dataset): Date | End date of current breaks |
| average(dataset: Dataset): number | Average value of the dataset |
| median(dataset: Dataset): number | Median value of the dataset |
| variance(dataset: Dataset): number | Variance value of the dataset |

### Functions Accept Dataset and Return Dataset

| Function | Description |
|:---------|:-----------|
| normalize(dataset: Dataset): Dataset | rescale the Y values to [0, 1] |
| setMissingValues(dataset: Dataset, missingValue: number): Dataset | set the missing values |

## Missing Values

Notice that the missing values (null values) are ignored in function like sum or average. Moreover, a value plus a missing value will leads to null value (missing value). To avoid these, you can set those missing values to a value by using parameter `penalty` or use expression function `setMissingValues`.
Loading

0 comments on commit 8cc4f4c

Please sign in to comment.