diff --git a/README.md b/README.md index 073d1e8..c8bfc31 100644 --- a/README.md +++ b/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 diff --git a/helpers/plotProperties.ts b/helpers/plotProperties.ts index 3ce39f7..88c504a 100644 --- a/helpers/plotProperties.ts +++ b/helpers/plotProperties.ts @@ -123,6 +123,12 @@ export const validBarDatasetProperties = [ const propertyPattern = /^\s*(.+?)\.([a-zA-Z_]\w*)?\s*/; const propertyDescriptions: Record = { + + // 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 = { 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.", diff --git a/manifest.json b/manifest.json index ba2fd58..e7e7eef 100644 --- a/manifest.json +++ b/manifest.json @@ -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", diff --git a/src/main.ts b/src/main.ts index 5badcab..70ee410 100644 --- a/src/main.ts +++ b/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); }; diff --git a/versions.json b/versions.json index ab2fe84..47e8623 100644 --- a/versions.json +++ b/versions.json @@ -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" }