mirror of
https://github.com/jcf-402/datacharts.git
synced 2026-07-22 06:08:15 +00:00
Release 1.0.2
This commit is contained in:
parent
cd2c12174f
commit
ab696338f4
5 changed files with 33 additions and 15 deletions
19
README.md
19
README.md
|
|
@ -28,11 +28,12 @@ Manually place the plugin files in your vault's `.obsidian/plugins/datacharts` f
|
|||
- manifest.json
|
||||
|
||||
## Roadmap
|
||||
|
||||
- Improve stability from user feedback.
|
||||
- Query vault data through Bases / Datacore.
|
||||
- Add bar, scatter, pie, and other chart types.
|
||||
- Query vault data through Bases / Datacore / Custom syntax.
|
||||
- Polish existing chart support.
|
||||
- Expand equation parsing and custom math syntax.
|
||||
- Add functionality to save or export plot as images.
|
||||
- Add to export chart/note as PNG and SVG to file location.
|
||||
|
||||
|
||||
## Issues
|
||||
|
|
@ -42,16 +43,24 @@ Found a bug or have an idea? Open a GitHub Issue.
|
|||
|
||||
## Changelog
|
||||
|
||||
### 1.0.2
|
||||
|
||||
- Changed ```lineplot``` to ```datachart```.
|
||||
- Introduced `type :: chartType` for defining plot type.
|
||||
- Added bar and scatter chart support.
|
||||
- Added pie, doughnut, polarArea and radar chart support. (Work but need polish).
|
||||
- Changed syntax for `source::` read new documentation at https://datacharts-docs.vercel.app/.
|
||||
- Added option to save chart to vault as PNG by right clicking on the chart.
|
||||
- Added option to save chart to vaul as SVG (limited to line charts only right now)
|
||||
|
||||
## 1.0.1
|
||||
### 1.0.1
|
||||
|
||||
- Added a simple autocomplete feature for properties.
|
||||
|
||||
![Autocomplete][assets/autocomplete.gif]
|
||||
|
||||
|
||||
## 1.0.0
|
||||
### 1.0.0
|
||||
|
||||
- Initial release
|
||||
- Function plotting
|
||||
|
|
|
|||
|
|
@ -123,6 +123,12 @@ export const validBarDatasetProperties = [
|
|||
const propertyPattern = /^\s*(.+?)\.([a-zA-Z_]\w*)?\s*/;
|
||||
|
||||
const propertyDescriptions: Record<string,string> = {
|
||||
|
||||
// roots
|
||||
elements: "Controls style options for all datasets",
|
||||
interactions: "Controls options for mouse interactions with chart.",
|
||||
layout: "Controls the chart layout options.",
|
||||
// global
|
||||
xrange: "Controls the range for evaluating a main equation.",
|
||||
canvasWidth: "Controls the chart width in pixels.",
|
||||
canvasHeight: "Controls the chart height in pixels.",
|
||||
|
|
@ -151,6 +157,7 @@ const propertyDescriptions: Record<string,string> = {
|
|||
pointHoverRadius: "Controls point size while hovered.",
|
||||
pointHitRadius: "Controls clickable area around points.",
|
||||
pointStyle: "Controls point shape.",
|
||||
padding: "The padding to add inside the chart.",
|
||||
radius: "Controls radius of arcs, bubbles, or points.",
|
||||
hoverRadius: "Controls radius while hovered.",
|
||||
hoverOffset: "Moves pie or doughnut slices outward on hover.",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "datacharts",
|
||||
"name": "DataCharts",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"minAppVersion": "1.12.7",
|
||||
"description": "Create charts and visualize data directly inside notes.",
|
||||
"author": "DonutCar Fountains",
|
||||
|
|
|
|||
17
src/main.ts
17
src/main.ts
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import {handleMarkdown, handleGlobalOptions, evaluateExpressions, PlotData, parsedText, handleTableData, Equation, GlobalProperties,Data} from "../helpers/parser"
|
||||
import { createPlot, buildDatasets} from "../helpers/graphs";
|
||||
import {Menu, Notice, Plugin, TextAreaComponent} from "obsidian";
|
||||
import {Menu, Notice, Plugin, MarkdownView} from "obsidian";
|
||||
import { apply } from "mathjs";
|
||||
import { setApp } from "../helpers/appContext";
|
||||
import { PlotPluginSettings, DEFAULT_SETTINGS, PlotSettingTab } from "settings";
|
||||
|
|
@ -77,11 +77,10 @@ export default class PlotPlugin extends Plugin {
|
|||
this.registerEvent( // Register event
|
||||
this.app.vault.on("modify", async (file) => { // where the event is a modification of the file
|
||||
if (!sourcePaths.includes(file.path)) return; // Only goes through if the file that is modified belongs to the codeblocks sourcepaths
|
||||
|
||||
// So the file that was modified is part of the source for the current codeblocks data. We need to updated the table data.
|
||||
// It hands the new markdown text to handleTableData which parses it for all tables.
|
||||
|
||||
|
||||
await refreshTableData();
|
||||
await refreshTableData(); // It hands the new markdown text to handleTableData which parses it for all tables.
|
||||
await renderCurrentChart();
|
||||
|
||||
})
|
||||
|
|
@ -109,9 +108,12 @@ export default class PlotPlugin extends Plugin {
|
|||
await this.saveData(this.settings);
|
||||
}
|
||||
|
||||
refreshPlots() {
|
||||
this.app.workspace.updateOptions();
|
||||
}
|
||||
async refreshOpenCharts() {
|
||||
this.app.workspace.getLeavesOfType("markdown").forEach(async (leaf) => {
|
||||
const view = leaf.view as MarkdownView;
|
||||
view.previewMode?.rerender(true);
|
||||
});
|
||||
}
|
||||
|
||||
getChartTypes(markdown: string[]): ChartType {
|
||||
const lines = markdown;
|
||||
|
|
@ -178,7 +180,6 @@ export default class PlotPlugin extends Plugin {
|
|||
...parsedText.manualData,
|
||||
...parsedText.tableData
|
||||
]
|
||||
console.log(data);
|
||||
// Manage data to fit how pie and others accept it.
|
||||
return await this.createChartInstane(chartInstance, el, globalProperties, data, parsedText, chartType);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"1.0.0": "0.15.0",
|
||||
"1.0.1": "1.12.7"
|
||||
"1.0.1": "1.12.7",
|
||||
"1.0.2": "1.12.7"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue