Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I do math to calculate a y-axis value? #311

Closed
larryfast opened this issue Jan 24, 2024 · 4 comments
Closed

Can I do math to calculate a y-axis value? #311

larryfast opened this issue Jan 24, 2024 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@larryfast
Copy link

I have a Y value in seconds but would like the Chart to show Minutes. Is there a syntax for dividing by 60?

Desired Behavior

Currently I'm extracting the Y-value from JSON text:
{"total":{"name":"meditationT","totalTime":4347},"entries": ... }
using
searchTarget: '.meditationT[^:]:(?\d+)'

Is there any magic syntax allowing me to generate a calculated Y value? In my case I want to divide by 60 to get a value in minutes instead of seconds.

Context

The source values are generated by a Timer plugin. I click Start...Stop and the plugin calculates total time in seconds. The plugin keeps a static record of start-stop & total times in a JSON record.
It would be great if I could graph this as Minutes instead of seconds.
FWIW, here's a more complete example of the JSON. This is a single line in my .md files.

{"total":{"name":"meditationT","totalTime":7},"entries":[{"name":"Segment 1","startTime":1706129847,"endTime":1706129854,"subEntries":null}],"editEnabled":true,"format":"hh:mm"}
@lazyguru
Copy link
Collaborator

You might be able to use JS to inject the calculation into the dataview

@lazyguru
Copy link
Collaborator

I re-read this again and I don't think my previous suggestion would work. This sounds like something that would need to be added to the plugin to support some kind of conversion (like either "modifier" entry where you pass a value to modify the dataset by and then a "modifer_action" where you specify how the value is modified [division, addition, subtraction, ...]). Depending on how this is implemented it could get fairly complex. It's not something I personally need so it wouldn't be something I would do, however if you or someone else opens a PR with a solution I'll consider merging it

@lazyguru lazyguru added enhancement New feature or request help wanted Extra attention is needed labels Mar 22, 2024
@larryfast
Copy link
Author

Thanks for the update. At the moment I living with it as is. I'll ping you if put some energy into designing a solution. And I REALLY appreciate the wonderful plugin you created!

@lazyguru
Copy link
Collaborator

No worries. And @pyrochlore created it. I'm just maintaining it at the moment because I also found it really useful and @pyrochlore was too busy (life happens 😊)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants