refactored and added custom average chart #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey, I hope you are doing great, before you merge read this !
So i wanted to put code in module and see possibilities in Obsidian, I ended up using the plugin CustomJS, and I added the custom chart type on average.
So in order to use:
Folder
in options to point atScripts/CustomJS
folderdaysPath
(names have changed don't worry)Well almost, code gets more complicated when we refactor, I took CustomJS because it provides a unique path to look for modules in a simple way, with others solutions I would have needed to hardcode the path, eurghh.
renderWeeklyChart
, those params are described in the js file in the function description.type
param allows you to make the chart on average, simply pass'average'
to have it, otherwise you can omit the param :)attributes
is now an object instead of a map.renderSingleAttrChart
, it simply allows to render a single attr on daily basis, you can leave it there :)CustomJS does not make things tricky, it simply loads the class and make them available anywhere. But that is the good thing, you can also import code in the same way in templater expressions to fully refactor.
And I think it is it, I hope this is not too complicated, feel free to ask for infos !
Best, Olivier