Just a little update.

I was previously trying to do all calculations with filters, but I found 
myself getting into trouble with more complicated arithmetic.

So I added the math.js plugin, and changed everything to use the $calc 
macro instead of using filters.  For example:

\define WhRate() 0.01118

\define WHCv(W:0 H:1)
*    <$calc>round(($W$ * $H$ * <<WhRate>>),4)</$calc>*
\end
\define WHC(W:0 H:1)
<!-- 🔴 WATTS x HOURS x RATE/WATTHOUR = ◾COST◾ -->
    <$vars cost=<<WHCv $W$ $H$>>>
    <div class="tooltip">
        <<cost>> $
        <span class="tooltiptext">
            Cost (<<cost>> $) <br>
            = <br>
            Watts ($W$ W) <br>
            x Hours ($H$ h) <br>
            x Rate ($(WhRate)$ $/Wh)
        </span>
    </div>
    </$vars>
\end

 
Cheers !

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0fc99cda-9c4c-4d91-b51e-c06a3f5a825bo%40googlegroups.com.

Reply via email to