{"id":13870217,"url":"https://github.com/Dmytro-Shulha/obsidian-plotly","last_synced_at":"2025-07-15T20:31:51.844Z","repository":{"id":44616354,"uuid":"396015160","full_name":"Dmytro-Shulha/obsidian-plotly","owner":"Dmytro-Shulha","description":"Obsidian plugin to embed Plotly charts into markdown notes.","archived":false,"fork":false,"pushed_at":"2023-07-28T21:15:25.000Z","size":883,"stargazers_count":72,"open_issues_count":12,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-18T08:22:53.003Z","etag":null,"topics":["obsidian-md","obsidian-plugin","plotlyjs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dmytro-Shulha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-08-14T13:19:25.000Z","updated_at":"2024-09-21T23:33:12.000Z","dependencies_parsed_at":"2024-01-16T08:10:45.085Z","dependency_job_id":"6c586020-fd67-4704-8206-6b8203731153","html_url":"https://github.com/Dmytro-Shulha/obsidian-plotly","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dmytro-Shulha%2Fobsidian-plotly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dmytro-Shulha%2Fobsidian-plotly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dmytro-Shulha%2Fobsidian-plotly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dmytro-Shulha%2Fobsidian-plotly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dmytro-Shulha","download_url":"https://codeload.github.com/Dmytro-Shulha/obsidian-plotly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226068305,"owners_count":17568734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["obsidian-md","obsidian-plugin","plotlyjs"],"created_at":"2024-08-05T20:01:34.550Z","updated_at":"2024-11-23T16:31:21.072Z","avatar_url":"https://github.com/Dmytro-Shulha.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# obsidian-plotly\nObsidian plugin, which allow user to embed Plotly charts into markdown notes.\n\n# Usage\n## Basic (using plotly block)\nUse Command Palette (`Ctrl-P`) to add basic plotly template: \n![Command example](./media/plotly-command-demo.gif)\n\nThis approach allows you to create JSON or YAML inside `plotly` block \nwith payload for data, layout and config objects. \nIt does NOT support JavaScript examples from plotly.com site - it only support static payload forvarding to `Plotly.newPlot` function.\nFor JavaScript support use Advanced approach with DataViewJS.\n\nBasic example (those YAML and JSON result in identical plots):\n```yaml\n    ```plotly\n    data:\n    \t- x: [0,1,2]\n    \t  y: [0,1,0]\n    ```\n```\n\n```json\n    ```plotly\n    {\n        \"data\": [{\n            \"x\":[0, 1, 2],\n            \"y\":[0, 1, 0]\n        }]\n    }\n    ```\n```\n\n## Advanced (using dataviewjs block)\nUse Command Palette (`Ctrl-P`) to add plotly template: \n![Command example](./media/plotly-dataviewjs-command-demo.gif)\n\nThis approach DOES support any example from plotly.com. \n(I haven't checked them all, feel free to create issue if some aren't working).\nHowever, this approach require DataView plugin to process JavaScript.\nAs a benefit, you can create plots based on data from you notes which you retrieve via DataView API!\n(By the way, this sounds similar to what [obsidian-tracker](https://github.com/pyrochlore/obsidian-tracker) plugin does).\n\nTo use it, just add DataviewJS block with Plotly command, copy desired example and paste it.\nNOTE: All examples use `Plotly.newPlot(component, data, layout, config)` to draw, and it takes some extra code to work in Obsidian.\nThere is a wrapper function available as `window.renderPlotly(this.component, data, layout, config)`, which will draw plot inside DataViewJS block.\n(Wrapper parameters should be same as in example).\n\nA lot of examples are on [Plotly](https://plotly.com/javascript/) official site.\n\n![How to copy examples from plotly.com](./media/plotly-copy-from-examples-demo.gif)\n\nNOTE: Some examples also require d3 library. This is large library and rarely needed. That's why I do not want to have it in plugin.\nIf you need this library, there is a workaround: you can download d3 library from official [site](https://d3js.org/d3.v7.min.js) (Open link-\u003eRight click-\u003eSave as...), place it in your vault and import using `require`; \n\n```js\n    ```dataviewjs\n        //Some plotly examples require d3 library to work.\n        //Since it's large and used by few examples,\n        //I propose a workaround to import d3;\n        //You need to download dependency from https://d3js.org/d3.v7.min.js\n        //and place it in your vault.\n        let path = app.vault.adapter.basePath;//absolute path to your vault\n        var d3 = require(path+\"\\\\utils\\\\d3.v7.min.js\");\n\n        //Replace this block with any example from plotly.com\n        //NOTE: `Plotly.newPlot` won't work here, use `window.renderPlotly` instead\n        var data = [\n            {x:[0,1,2,3,4,5,6,7,8,9],y:[4,4,2,2,3,3,2,2,4,4]},\n            {x:[0,1,2,3,4,5,6,7,8,9],y:[3,3,1,1,2,2,1,1,3,3]}\n        ];\n        var layout = {title:\"Example in DataViewJS\"};\n        var config = {displaylogo:false};\n\n        window.renderPlotly(this.container, data, layout, config)\n    ```\n```\n\n# Examples\nSome more obsidian examples of this plugin [here](examples.md)\n\nMore examples on [Plotly](https://plotly.com/javascript/) official site.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDmytro-Shulha%2Fobsidian-plotly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDmytro-Shulha%2Fobsidian-plotly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDmytro-Shulha%2Fobsidian-plotly/lists"}