Dynamically Generated Graphs / API?
I'm not entirely sure how feasible this is, but I decided that I should probably bring this up before trying to Frankenstein my own graphing function. I recently stumbled onto a case with DataviewJS where I made an array I wanted to create some visualizations for using Desmos graphs; this plugin seems to be the only actual graphing plugin out there, so far, and I'm familiar with Desmos. I tried to inject that array into the desmos graph through inline JS, but that predictably failed. I tried to use DVJS's plugin access to perhaps try to generate a graph dynamically, but found some major issues in attempting to implement that through the plugin itself (for example, the Graph class is inaccessible, so Graph.parse cannot be used). I suppose if I were to make my suggestion coherent, it would be the creation of some sort of API to allow this sort of idea, though obviously this is not a simple undertaking.
Hey just so you're aware there is a functionplot plugin which is somewhat similar to this plugin as well.
I've actually had to do something similar to you before and the way I got around it is to encase the Desmos graph you want as a text string and just render it using dv.span.
I.e.
```dataviewjs
const a = 3
const graph_str = `\`\`\`desmos-graph
y(x)=${a}*x
\`\`\``
```
This would allow you to kind of pull in dv variables. Obviously it works the same as an inline query too.
Does this solve your issue?
(Though I for one would also love an api!)
Thank you!! That worked like magic; I should've thought to try things the other way around. It was very simple, since I only really needed to plug in the array. Though this trick also allows me to dynamically alter the format of the data to keep things in view! Once again, thanks!