obsidian-tracker icon indicating copy to clipboard operation
obsidian-tracker copied to clipboard

Threshold is Ignored in Month Graphs When Using Scaled Colors

Open mkarrmann opened this issue 1 month ago • 0 comments

Expected Behavior

The threshold parameter for month graphs has consistent behavior, regardless of whether circleColorByValue is set.

Current Behavior

The threshold field for month graphs does nothing when circleColorByValue (along with yMin and yMax) are set.

Possible Solution

The block of code I link below to const showCircle = curValue != null && curValue > threshold;. This should be the sole consideration for whether a value is set/

Steps to Reproduce (for bugs)

Create a tracker of type month with parameters similar to this:

searchType: frontmatter
searchTarget: snoozed mins
folder: /General/Periodic/Daily
datasetName: Meditation Minutes
month:
	mode: circle
	circleColorByValue: true
	yMin: 00
	yMax: 100
	threshold: 0

In a note, set the value equal to 0 for a day. Note that the circle still appears.

Context

This isn't exactly a bug, since from the code it's clear this is completely intentional:

https://github.com/pyrochlore/obsidian-tracker/blob/3550d12f79253ec1d06a94fb70ce469c2f0eccb5/src/month.ts#L646-L665

It was added in this commit which made a handful of changes.

However, I can't think of any convincing reason why this behavior should be in place. I found it very surprising to set a threshold and find that it had no effect. While obviously the color will give me a sense of whether the value is near the threshold, in some situations I may care a lot of about the value being exactly 0 vs. it being very small.

The best argument I can think of for this current behavior is: "Many people don't set any threshold, in which they are not expecting there to be any threshold. So, it is surprising to the user when they try using circleColorByValue with a yMin beneath the default value of threshold (0) and find that the circle don't appear". However, this isn't problem isn't specific to using circleColorByValue, and actually the core problem is that the default value of threshold is 0 instead of "no threshold" (but I know that making that change would be something of a breaking change, and potentially annoying for some users).

mkarrmann avatar Jun 03 '24 03:06 mkarrmann