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

Any chance this could be made to work together with formulas used by Advanced Tables?

Open n00bmind opened this issue 1 year ago • 4 comments

Describe the feature

Hi. I'm currently using the Advanced Tables plugin to add a simple "totals" column to my tables, which is super useful. However, as described in https://github.com/tgrosinger/advanced-tables-obsidian/blob/main/docs/help.md, the way this works is by adding one (or more) html comment line of the form <!-- TBLFM: [formula] --> directly after the table, which is currently incompatible with the "chart from table" feature, as I cannot have both the formula and the required the block id marker as the next line after the table.

i.e. I'd need to be able to do something like this:

|       | Test1 | Test2 | Test3 |
| ----- | ----- | ----- | ----- |
| Data1 | 1     | 2     | 3.33  |
| Data2 | 3     | 2     | 1     |
| Data3 | 6.7   | 4     | 2     |
| TOTAL |       |       |       |
<!-- TBLFM: @>$2=sum(@I..@-1) -->
^table

but if I try something like this I get the error "Couldn't render Chart: There is no table at that id and/or file"

Does this fix a problem? If so, specify.

It does. This would make Charts work with computed formulas, which adds a lot of power to a user's workflow!

Did you consider other alternatives?

I don't know any other alternatives at the moment..

Screenshots and recordings

No response

n00bmind avatar Mar 10 '24 12:03 n00bmind

Going through the same drama as well 🤣

thiduzz avatar Mar 12 '24 11:03 thiduzz

@n00bmind @thiduzz I came here to +1 this, but I've actually just found a workaround :-)

The block id marker doesn't have to be following the table, it can be within it, so try changing your example table to:

| ^table | Test1 | Test2 | Test3 |
| ----- | ----- | ----- | ----- |
| Data1 | 1     | 2     | 3.33  |
| Data2 | 3     | 2     | 1     |
| Data3 | 6.7   | 4     | 2     |
| TOTAL |       |       |       |
<!-- TBLFM: @>$2=sum(@I..@-1) -->

If there was text in the first cell it could also be e.g.:

| Data ^table | Test1 | Test2 | Test3 |
| ----- | ----- | ----- | ----- |
| Data1 | 1     | 2     | 3.33  |
| Data2 | 3     | 2     | 1     |
| Data3 | 6.7   | 4     | 2     |
| TOTAL |       |       |       |
<!-- TBLFM: @>$2=sum(@I..@-1) -->

or put the block id in any other empty cell.

Seems to work in a similar example for me (desktop obsidian v1.6.5)

Kolossi avatar Jul 01 '24 11:07 Kolossi

Amazing stuff. That seems to work for me just fine too..

n00bmind avatar Jul 01 '24 16:07 n00bmind

Good stuff @Kolossi ! Works for me as well!

thiduzz avatar Jul 01 '24 17:07 thiduzz