Giter Club home page Giter Club logo

randomfractals / vscode-vega-viewer Goto Github PK

View Code? Open in Web Editor NEW
122.0 3.0 11.0 26.81 MB

VSCode extension for Interactive Preview of Vega and Vega-Lite maps πŸ—ΊοΈ and graphs πŸ“ˆ.

Home Page: https://marketplace.visualstudio.com/items?itemName=RandomFractalsInc.vscode-vega-viewer

License: Apache License 2.0

TypeScript 69.61% HTML 20.32% JavaScript 8.28% CSS 1.79%
vscode vega vega-lite viewer preview extension charts graphs maps

vscode-vega-viewer's Introduction

Vega Viewer

Version Installs Downloads https://ko-fi.com/dataPixy

Vega Viewer provides language support and Interactive Preview of Vega and Vega-Lite JSON specification graphs. Use Vega Viewer to find and prototype custom data visualizations using Vega maps πŸ—ΊοΈ and graphs πŸ“ˆ.

Advanced Vega Charts

Features

  • Create Vega or Vega-Lite JSON {} specification documents
  • Vega and Vega-Lite Graphs Preview πŸ“ˆ
  • Local and http(s) data files support
  • SVG and PNG Graph Export options
  • 724 searchable built-in Vega and Vega-Lite Examples
  • Vega Themes Preview
  • Load Vega specs from online Vega Editor or github gists
  • Preview Vega graphs πŸ“ˆ from starred gists, playgrounds, and data visualizations in GistPad πŸ“˜
  • View and Share Vega(-Lite) spec in the online Vega Editor
  • Referenced CSV and JSON data display via Data Preview 🈸

Vega Viewer Data Preview

Installation

Install Vega Viewer πŸ“ˆ from VSCode Extensions tab (Ctrl+Shift+X) by searching for Vega, or directly from Visual Studio Marketplace link in your browser.

Users of VSCodium, Azure Data Studio, and other VSCode-based IDEs can install Vega Viewer using .vsix extension package attached in Assets section from published releases of this extension on github. Follow install from .vsix instructions in your VSCode extensions compatible IDE or online container service to install it.

Note: VSCodium and other VSCode extension compatible IDE flavors are not officially supported as they require additional testing in those IDE variants.

Settings

Install Data Preview 🈸 or use built-in vscode.open command to preivew CSV and JSON data files referenced in your Vega graph πŸ“ˆ specifications.

Vega Viewer Data Preview Command Setting

Usage

  1. Use Vega: Create Vega Spec command from View -> Command Pallette... menu to Create and Save new Vega or Vega-Lite document with the corresponding Vega json $schema reference.

  2. Use Vega: Preview Vega Graph command on an open .vg.json or .vl.json Vega spec document to Preview Graph πŸ“ˆ.

  3. Save updated Vega spec json document to Preview updated Graph πŸ“ˆ.

  4. Use Vega: Preview Remote Vega Graph command to preview URL encoded Vega specs from online Vega Editor or github gists.

Built-in Examples

  1. Use Vega: Examples command to view the list of built-in Vega Examples.

  2. Use Vega: Lite Examples command to view all the Vega-Lite Maps πŸ—Ί and Graphs πŸ“ˆ created by the Vega dev community.

  3. Use Vega: Visual Vocabulary Examples command to View quick list of Visual Vocabulary Vega Examples.

...

Vega Viewer Plot Example

Vega Viewer VSCode Contributions

Vega Viewer Settings, Commands, Keyboard Shortcuts, Languages, and JSON Validation feature contributions:

Vega Viewer Contributions

Vega Viewer Commands

Vega Viewer provides the following Commands to view built-in Vega and Vega-Lite graph examples and create new visualization specification documents:

Vega Viewer Commands

Vega Viewer GistPad Integration

Vega Viewer integrates with GistPad extension for Vega and Vega-Lite graph Previews:

Vega Viewer Gistpad Integration

Recommended Extensions

Recommended extesnsions for working with data, gists, maps and SVG graphs πŸ“ˆ in VSCode:

Extension Description
Data Preivew 🈸 Data Preview 🈸 extension for importing πŸ“€ viewing πŸ”Ž slicing πŸ”ͺ dicing 🎲 charting πŸ“Š & exporting πŸ“₯ large JSON array/config, YAML, Apache Arrow, Avro & Excel data files.
GistPad πŸ“˜ VS Code extension for managing and sharing code snippets, notes and interactive samples using GitHub Gists.
SVG SVG language support extension.
Geo Data Viewer πŸ—ΊοΈ Geo Data Viewer for generating snazzy maps πŸ—ΊοΈ with keplerGL.

Dev Log

See #VegaViewer πŸ“ˆ tag on Twitter for the latest updates on this vscode extension development.

Dev Build

$ git clone https://github.com/RandomFractals/vscode-vega-viewer
$ cd vscode-vega-viewer
$ npm install
$ code .

F5 to launch Vega Viewer extension VSCode debug session:

Alt text

Contributions

Any and all test, code and feedback contributions are welcome.

Open an issue or create a pull request to make Vega Viewer πŸ“ˆ work better for all.

Support

Become a Fan and sponsor our dev efforts on this and other Random Fractals, Inc. code and data viz extensions if you find them useful, educational, or enhancing your daily dataViz/dev code workflows:

β˜•οΈ https://ko-fi.com/dataPixy πŸ’– https://github.com/sponsors/RandomFractals

vscode-vega-viewer's People

Contributors

domoritz avatar randomfractals avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vscode-vega-viewer's Issues

add vega.help command using browser preview setup to show supporting docs πŸ€”

this extension already provides jsonSchema validation and intelli-sense code hints for vega json files.

Adding online help docs loading in another preview panel could be next good step to make it even more appealing for devs using vega viz libs or altair for charting and data viz prototyping.

i.e. something as simple as just loading vega examples site in another vscode preview panel to alleviate the need to load vega docs in chrome or other browser window:

https://vega.github.io/vega/examples/contour-plot/

cc @domoritz @kanitw & @jheer: your thoughts on this?

add local/relative data load support

Vega Viewer alpha v. requires absolute urls via https for data refs in spec.

In order to preview Vega examples, you need to change all example data references

  "data": [
    {
      "name": "source",
      "url": "data/cars.json",
      ...
    }
  ]

to published Vega data sets

  "data": [
    {
      "name": "source",
      "url": "https://vega.github.io/vega-datasets/data/cars.json",
      ...
    }
  ]

Same applies to custom Vega/Lite specs you create.

Solution:

Scan Vega spec for relative data url refs, read them from fs and pass that data along with spec json to the webview and vega embed to load and render with custom vega loader that grabs local data injections from vega viewer webview post message for preview refresh

add support for the latest Vega v5.x releases

currently this extension provides vg.json and vl.json Previews using embedded Vega v4 and Vega-Lite v3 libraries.

Vega dev team, @jheer and @domoritz have been busy with new Vega v5 updates recently.

I'd like to support latest Vega library updates to Preview vega json files created with new features and changes in v5.x. See Vega repo for more info:

https://github.com/vega/vega/releases

Ultimately and ideally as part of this viewer update, load correct vega, vega-lite or vega-embed version for Preview based on the Vega $schema reference provided in vg.json || vl.json spec for backward compatibility and previews of older vega specs.

"data" outside top-level specification

If I load local data on the top-level of a spec it works fine, but if "data" appears somewhere else it doesn't work.
For example this works

{
  "$schema": "https://vega.github.io/schema/vega-lite/v3.json",
  "data": {
    "url": "myfile.csv"
    },
    "Rest of specification"
}

While this doesn't

{
  "$schema": "https://vega.github.io/schema/vega-lite/v3.json",
  "layer": [
    {
      "data": {
      "url": "myfile.csv"
      },
      "Rest of specification"
}

add live vega spec preview?

this is already set up in extension.ts workspace.onDidChangeTextDocument event handler, but I disabled it for alpha.

If updating preview on json spec save is not sufficient I can enable this feature in the next viewer release by adding some 1 min or so timer (configurable to your liking) for that whole json parser and render process not to fire on every char change (why I disabled it for now)

restrict vega.preview command display in menus to vega json documents only

Currently, vega Preview option is displayed in explorer and editor menus for all .json files.

Desired:

Restrict this to .vega, .vg.json, .vl.json, .vg, and .vl files only to avoid polluting vscode menus for other json files with invalid vega Preview command menu option.

Solution:

Use the following when clause for those menu items:

resourceFilename =~ /.*\\.(vega|vg.json|vl.json|vg|vl)/

or

resourceExtname =~ /.(vega|vg.json|vl.json|vg|vl)/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.