plugin:tablecalc
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:tablecalc [2019-07-08 20:11] – [Bug report] shshsh | plugin:tablecalc [2024-01-21 20:13] (current) – [III] fix typo Aleksandr | ||
---|---|---|---|
Line 6: | Line 6: | ||
email : stalker@narezka.org | email : stalker@narezka.org | ||
type : syntax | type : syntax | ||
- | lastupdate : 2018-04-11 | + | lastupdate : 2020-08-27 |
- | compatible : Lemming, Anteater, Rincewind, Hrun, Detritus, Elenor of Tsort, Frusterick Manners | + | compatible : Lemming, Anteater, Rincewind, Hrun, Detritus, Elenor of Tsort, Frusterick Manners, Greebo, Hogfather, Igor, Jack Jackrum |
depends | depends | ||
conflicts | conflicts | ||
Line 13: | Line 13: | ||
tags : tables calculation math | tags : tables calculation math | ||
- | downloadurl: | + | downloadurl: |
bugtracker : | bugtracker : | ||
sourcerepo : | sourcerepo : | ||
Line 23: | Line 23: | ||
===== Overview ===== | ===== Overview ===== | ||
- | Sometimes one may need to do simple calculations in DokuWiki table. The idea was taken from [[plugin: | + | Sometimes one may need to do simple calculations in DokuWiki table. The idea was taken from [[plugin: |
===== Download and Installation ===== | ===== Download and Installation ===== | ||
Line 31: | Line 30: | ||
* [[http:// | * [[http:// | ||
- | |||
===== Syntax ===== | ===== Syntax ===== | ||
- | To perform a calculation you need to insert XL-style formula into work sheet. Any expression must be started with '' | + | To perform a calculation you need to insert XL-style formula into work sheet. Any expression must be started with '' |
< | < | ||
r0c4 | r0c4 | ||
</ | </ | ||
- | Please note, that row ('' | + | :!: Please note, that row ('' |
+ | |||
+ | ^ | ||
+ | ^ 0 | r0c0 | r0c1 | r0c2 | | ||
+ | ^ 1 | r1c0 | r1c1 | r1c2 | | ||
+ | ^ 2 | r2c0 | r2c1 | r2c2 | | ||
+ | |||
+ | Row and column prefixes can be swapped. The following is equal of the above: | ||
< | < | ||
c4r0 | c4r0 | ||
Line 73: | Line 78: | ||
The following functions are implemented: | The following functions are implemented: | ||
- | '' | + | ^ Func ^ Description |
- | + | | average(range) | |
- | ^ Func | + | | cell(column,row) | Returns |
- | | cell(x, | + | | check(condition,true,false) | Executes '' |
- | | row() | Returns current row | | + | | col() | Returns current column |
- | | col() | Returns current column | + | | compare(a,b,operation) |
- | | range(x1, | + | | count(range) |
- | | sum(range) | + | | countif(range,b,operation) |
- | | count(range) | + | | label(string) | Binds label to the table | |
- | | round(number; | + | | max(range) |
- | | label(string) | + | | min(range) |
- | | average(range) | + | | range(column1, |
- | | min(range) | + | | round(number, |
- | | max(range) | Returns minimum value within specified range | | + | | row() | Returns current row | |
- | | check(condition;true;false) | + | | sum(range) |
- | | compare(a;b;operation) | + | | calc() |
- | | countif(range;b;operation) | + | |
- | | calc() | + | |
Though you can use colon as delimiter in functions semi-colon is preferred and recommended. | Though you can use colon as delimiter in functions semi-colon is preferred and recommended. | ||
- | |||
===== Operators ===== | ===== Operators ===== | ||
Line 100: | Line 102: | ||
^ Operator | ^ Operator | ||
- | | + | Addition and unary plus | | + | | + | Addition and unary plus | |
- | | - | Subtraction and unary negative | | + | | - | Subtraction and unary negative |
- | | * | Multiplication | | + | | * | Multiplication |
- | | / | Division | | + | | %%**%% |
- | | % | Modulus (division remainder) | | + | | / | Division |
- | | & | Logical AND | | + | | % | Modulus (division remainder) |
- | | %%<< | + | | & | Logical AND | |
- | | %%>> | + | | %%<< |
+ | | %%>> | ||
===== Examples ===== | ===== Examples ===== | ||
Line 139: | Line 142: | ||
| 1 | 2 | 3 | 4 | | | 1 | 2 | 3 | 4 | | ||
| 5 | 6 | 7 | 8 | | | 5 | 6 | 7 | 8 | | ||
- | | **~~=sum(r0c0: | + | | **~~=sum(r0c0: |
</ | </ | ||
Line 273: | Line 276: | ||
</ | </ | ||
- | | 1 | True | | + | | 1 | True |
- | | 0 | False | | + | | 0 | False | |
- | | x | False | | + | | x | False | |
- | | | False | | + | | | False | |
- | | | False | | + | | | False | |
Line 305: | Line 308: | ||
==== XI ==== | ==== XI ==== | ||
- | ^ Operator | + | ^ Operator |
- | | + | %%~~= 3 + 2 ~~%% | 5 | | + | | + | %%~~= 3 + 2 ~~%% |
- | | - | %%~~= 3 - 2 ~~%% | 1 | | + | | - | %%~~= 3 - 2 ~~%% |
- | | * | %%~~= 3 * 2 ~~%% | 6 | | + | | * | %%~~= 3 * 2 ~~%% |
- | | / | %%~~= 6 / 2 ~~%% | 3 | | + | | %%**%% |
- | | % | %%~~= 7 % 2 ~~%% | 1 | | + | | / | %%~~= 6 / 2 ~~%% |
- | | unary + | %%~~= +2 ~~%% | + | | % | %%~~= 7 % 2 ~~%% |
- | | unary - | %%~~= -2 ~~%% | + | | unary + | %%~~= +2 ~~%% | 2 | |
- | | & | %%~~= 3 & 2 ~~%% | 2 | | + | | unary - | %%~~= -2 ~~%% | -2 | |
- | | %%<< | + | | & | %%~~= 3 & 2 ~~%% |
- | | %%>> | + | | %%<< |
+ | | %%>> | ||
Line 347: | Line 351: | ||
===== ChangeLog ===== | ===== ChangeLog ===== | ||
+ | |||
+ | __26.08.2020__ | ||
+ | * Fixed Hogfather compatibility issues | ||
+ | |||
__11.04.2018__ | __11.04.2018__ | ||
- | | + | |
- | * Added plugin.info.txt | + | * Added plugin.info.txt |
- | * Fixed cross references between tables | + | * Fixed cross references between tables |
__05.07.2017__ | __05.07.2017__ | ||
Line 360: | Line 368: | ||
__09.02.2017__ | __09.02.2017__ | ||
- | | + | |
__31.01.2017__ | __31.01.2017__ | ||
- | | + | |
- | * Plugin execution code was significantly revisioned and corrected | + | * Plugin execution code was significantly revisioned and corrected |
__14.04.2010__ | __14.04.2010__ | ||
- | | + | |
- | * Added cross-table resolver and forward calculations | + | * Added cross-table resolver and forward calculations |
- | * Added min(),max() and average() functions | + | * Added min(),max() and average() functions |
- | * Added ability to use semi-colon as a function parameters separator | + | * Added ability to use semi-colon as a function parameters separator |
- | * Added compare functions | + | * Added compare functions |
- | * Added string escaping (#) | + | * Added string escaping (#) |
- | * Fixed javascript/ | + | * Fixed javascript/ |
- | * Fixed invalid HTML ID's usage | + | * Fixed invalid HTML ID's usage |
__07.09.2009__ | __07.09.2009__ | ||
- | | + | |
===== Discussion ===== | ===== Discussion ===== | ||
Line 618: | Line 626: | ||
--- // | --- // | ||
+ | >> Above was fixed, but similar bug now appears in Chrome etc. browsers, but not Firefox etc. browsers. | ||
+ | --- [[user> | ||
==== Looping ==== | ==== Looping ==== | ||
Unfortunately the new version loops on my page, which is more complex than the example I give above. | Unfortunately the new version loops on my page, which is more complex than the example I give above. | ||
+ | |||
+ | ==== Decimals ==== | ||
+ | |||
+ | > | ||
+ | > | ||
+ | >Also, what about delimiters in general? Large numbers like 1000000 are easily readable as 1.000.000, | ||
+ | --- [[user> | ||
+ | |||
+ | > The following code in your [[devel: | ||
+ | > | ||
+ | > <code php> | ||
+ | setTimeout(function() { | ||
+ | | ||
+ | var $calc_decimal = jQuery(this).text().split(' | ||
+ | jQuery(this).text($calc_decimal); | ||
+ | }); | ||
+ | }, 100); | ||
+ | } </ | ||
+ | > | ||
+ | > ・ at least ONE cell of ANY table on the page needs to be set up with tablecalc syntax: ~~= ... ~~ | ||
+ | > ・ then ALL dots in ALL tables on the page are converted to commas on pageload (only for visual display) | ||
+ | > ・ in page edit mode (or edittable) decimal delimiters are still to be filled in as dots " | ||
+ | > --- [[user> | ||
+ | |||
+ | ==== Incompatibility with Chrome and Brave? ==== | ||
+ | |||
+ | I have been using TableCalc for months now and haven' | ||
+ | |||
+ | https:// | ||
+ | http:// | ||
+ | --- [[user> | ||
+ | |||
+ | > There appears to be a javascript problem in Chrome/ | ||
+ | > | ||
+ | > See an example at https:// | ||
+ | > | ||
+ | > This is the Tablecalc issue that I run into most frequently; I suspect the above is similarly related to the way that Chrome etc. handle the javascript created by Tablecalc pages. | ||
+ | > --- [[user> | ||
+ | |||
+ | > | ||
+ | >PHP can only show you results on the page when Javascript is ready with calculation. Since this is a javascript plugin, some timeout has to be adjusted. The more math work is given to tablecalc, the more timeout it needs to complete the task before the page can be loaded by PHP using those results. Look for this line of code in **/ | ||
+ | > | ||
+ | > <code php> | ||
+ | >Save your file, close and restart your browser and navigate back to the wiki page. Now, it will work in Edge, Chrome, Firefox and IE11. (Tested with DokuWiki-on-a-stick, | ||
+ | > | ||
+ | >EDIT: At least part of the above problem seems to be related to using non-existing cells which was discouraged here before. (Probably, because it gives tablecalc just too much mathwork it cannot handle.) I found the following useful for autosum of all of the cells above the current cell (assuming you have exactly one header row): | ||
+ | >< | ||
+ | >--- [[user> | ||
+ | |||
+ | ==== Feature requests ==== | ||
+ | |||
+ | > | ||
+ | > | ||
+ | > | ||
+ | >--- [[user> |
plugin/tablecalc.1562609461.txt.gz · Last modified: 2019-07-08 20:11 by shshsh