Comments (12)
Ah, no I forgot this Issue has to do with the dataview api..
SORRY I NEVER SAW THIS REPLY My github notifs were flooded with a project I accidentally subscribed to
YES it works!!!!!!!!!!! I have no idea what changed but its totally working!! thank you!
from obsidian-charts.
It would definetly be helpful if you post the full code you are using
from obsidian-charts.
Sorry about that! You're right, not sure why I didn't supply it in the first place.
Here it is together with the encompassing admonition block
````ad-note
title: Blood Pressure Graph Sept-Oct
icon: tint
color: 220, 20, 60
collapse: closed
```dataviewjs
var dateStart = "2021-09-01";
var dateEnd = "2021-10-31";
var dnotes = dv.pages("#daily-log").where(p =>
dv.date(p.file.name) >=
dv.date(dateStart) &&
dv.date(p.file.name) <=
dv.date(dateEnd));
var tdata = [];
var bdata = [];
var allLabels = [];
for (let i = 0; i < dnotes.length; i++) {
if (dnotes[i].avgbp){
allLabels.push(dnotes[i].file.name)
var strNum = dnotes[i].avgbp.split("/")[0]
var num = parseInt(strNum)
tdata.push(num);
var strrNum = dnotes[i].avgbp.split("/")[1]
var numm = parseInt(strrNum)
bdata.push(numm);
//console.log(parseInt(dnotes[i].avgbp.trimLeft("/"));
//console.log(parseInt(dnotes[i].avgbp.trimRight("/"))
}
}
allLabels.reverse()
tdata.reverse()
bdata.reverse()
const chartData = {
type: 'bar',
data: {
labels: allLabels,
width: "10%",
datasets: [{
label: 'Top',
data: tdata ,
backgroundColor: ['rgba(217, 121, 137)'
],
},
{
label: 'Bottom',
data: bdata,
backgroundColor: 'rgba(121, 156, 212)'}]
}
}
//console.log(allLabels)
const average = (array) => array.reduce((a, b) => a + b) / array.length;
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
}
var avgBP = 'Average Blood Pressure: {0}/{1}'.format(
Math.round(
(average(tdata) + Number.EPSILON) * 100) / 100,
Math.round(
(average(bdata) + Number.EPSILON) * 100) / 100);
window.renderChart(chartData, this.container);
dv.header(2, avgBP)
```
````
Here is the full error stack, I can't make heads or tails of it sadly
Evaluation Error: SyntaxError: missing ) after argument list
at DataviewInlineApi.eval (eval at <anonymous> (app://obsidian.md/app.js:1:1215379), <anonymous>:12641:21)
at evalInContext (eval at <anonymous> (app://obsidian.md/app.js:1:1215379), <anonymous>:12642:7)
at eval (eval at <anonymous> (app://obsidian.md/app.js:1:1215379), <anonymous>:12653:36)
at Generator.next (<anonymous>)
at eval (eval at <anonymous> (app://obsidian.md/app.js:1:1215379), <anonymous>:26:71)
at new Promise (<anonymous>)
at __awaiter (eval at <anonymous> (app://obsidian.md/app.js:1:1215379), <anonymous>:22:12)
at asyncEvalInContext (eval at <anonymous> (app://obsidian.md/app.js:1:1215379), <anonymous>:12648:12)
at DataviewJSRenderer.eval (eval at <anonymous> (app://obsidian.md/app.js:1:1215379), <anonymous>:13175:23)
at Generator.next (<anonymous>)
from obsidian-charts.
Okay, do other dataview blocks work fine inside admonitions?
from obsidian-charts.
I cannot find any error in your code, it might actually be an issue with admonitions
from obsidian-charts.
Okay, do other dataview blocks work fine inside admonitions?
Yes they do actually! I just ran a quick test with wrapping dv.header(2, "test")
in an admonition block.
I cannot find any error in your code, it might actually be an issue with admonitions
Interesting! I'll open an issue on its page then and update if I make any more progress. Thank you!
from obsidian-charts.
Does it work now?
from obsidian-charts.
Does it work now?
Sorry today has been a lot and i only just saw this! No, it's still not working (I just made sure to update and made sure admonition works with other dataviewjs blocks, and it does)
from obsidian-charts.
Please check with the new Update
from obsidian-charts.
Just ran the 'check for updates' command in obsidian, installed all updates and checked, and no it's still causing the same error. Again the code still works outside of the admonition block just not at all inside.
If there's anything else you'd like me to test let me know!
from obsidian-charts.
It is now working for me. Does the error still occur on your End?
from obsidian-charts.
Ah, no I forgot this Issue has to do with the dataview api..
from obsidian-charts.
Related Issues (20)
- TickDisplay modifier to work with other chart types
- [Bug]: Charts not exported to PDF when using Dataview integration
- [Bug]: Time on Y axis
- [Bug]: No theme colors when using window.renderChart HOT 4
- Can't Access Documentation HOT 4
- [Bug]: No color after 6 points HOT 2
- chart.js plugin
- Chandle stick chart
- Add datalabels plugin HOT 1
- New plugin name requirements HOT 2
- Can the function of drawing scatter plots be added? HOT 1
- I've been trying to solve this for 2 days and I can't. The graph is displayed , but no data is shown. I don't know what to do. =( #help HOT 1
- [Bug]: annotations don't work with chart-from-table
- Support sankey diagram generation
- More Font Controls HOT 6
- [Bug]: DataView Integration - width modifier doesn't work HOT 4
- [FR] Generate Charts for Non-Numeric Tables
- [Bug]: Invalid id and/or file
- [Question/Help] Resizing a pie chart
- [Bug]: Fail to create chart from table HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from obsidian-charts.