phibr0 / obsidian-charts

Charts - Obsidian Plugin | Create editable, interactive and animated Charts in Obsidian via Chart.js
https://charts.phib.ro/
GNU Affero General Public License v3.0
592 stars 27 forks source link

Add line of best fit, update chart.js, fix issues #67

Closed Wemmy0 closed 1 year ago

Wemmy0 commented 1 year ago

Fixes #54 Adds enhancement #65

USAGE:

  1. Add bestFit: true (optional) to the chart code
  2. Add bestFitTitle: "Your Title" (Optional) to the chart code to change the generated line title
  3. Add bestFitNumber: (Optional) to the chart code to specify which line should be used to create the line of best fit

Other changes:

How it works:

Example:

type: line
labels: [0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]
series:
  - title: 
    data: [0.0137, 0.0189, 0.0217, 0.0239, 0.03, 0.033, 0.0371, 0.0446]
  - title: 
    data: [0, 0.001, 0.002]
width: 100%
beginAtZero: false
xTitle: "Length /cm"
yTitle: "1/f"
bestFit: true
bestFitTitle: "LOBF"
bestFitNumber: 1

Forms: image

If bestFitTitle or bestFitNumber aren't defined, they default to the values Line of Best Fit and 0 respectively With default values: image

The PDF exporting issue was fixed by passing through the setting animation duration 0 to chart.js to disable the animation.

netlify[bot] commented 1 year ago

Deploy Preview for obsidiancharts canceled.

Name Link
Latest commit 9edd19473c70bfb27c3fac7f891fbc4068ee505e
Latest deploy log https://app.netlify.com/sites/obsidiancharts/deploys/636f95344b113a0008afda28
phibr0 commented 1 year ago

Looks good, but it seems like you changed the codeblock type for the advanced-chart. This will break exisiting codeblocks by other users. can you change it back?

Wemmy0 commented 1 year ago

Yep sorry changing it back now

Wemmy0 commented 1 year ago

obsidian-charts.zip That's the one with the correct manifest.json file

phibr0 commented 1 year ago

Thanks a lot for your improvements!