Skip to content

Commit

Permalink
the #18 big 3.0 update :)
Browse files Browse the repository at this point in the history
with 370 vega-lite examples in now. Enjoy!
  • Loading branch information
RandomFractals committed Feb 18, 2019
1 parent 6e3ffec commit b05cee1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,24 @@ in [VSCode](https://github.com/Microsoft/vscode)
- Vega and Vega-Lite charts Preview
- Local data files support
- SVG and PNG export
- Built-in Vega Examples
- 66 built-in Vega & 370 Vega-Lite Examples

# Usage

1. Run `Vega: Create Vega 📊` command from `View -> Command Pallette...` menu
to create and save new Vega or Vega-Lite document with the corresponding Vega JSON schema reference.
to create and save new Vega or Vega-Lite document with the corresponding Vega JSON schema reference

2. Run `Vega: Preview 📊` on open `.vega`, `.vg.json` or `.vl.json` Vega spec document to Preview it.
2. Run `Vega: Preview 📊` on open `.vega`, `.vg.json` or `.vl.json` Vega spec document to Preview it

3. Save updated Vega spec JSON document to Preview updated Vega viz.
3. Save updated Vega spec JSON document to Preview updated Vega viz

OR

Run `Vega: Examples 📊` command to view the list of built-in Vega specification examples.
Run `Vega: Examples 📊` command to view the list of built-in Vega specification examples

OR

Run `Vega: Vega-Lite Examples 📊` command to view all the 370 Vega Lite #maps 🗺️ and #charts 📊 updates 🤗
...

the best part of Vega Viewer is you can use it disconnected unlike other online #dataViz #devTools to prototype your #maps 🌍 and #graphs 📈 on a go, on a ✈️, on a 🚄, on a 🚤, in a 📦 with a 🐐, and no #d3 #py || #rstats required!
Expand Down
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-vega-viewer",
"displayName": "Vega Viewer",
"description": "Vega Viewer",
"version": "2.3.1",
"version": "3.0.0",
"publisher": "RandomFractalsInc",
"author": "Taras Novak",
"contributors": [
Expand All @@ -21,7 +21,8 @@
"vega-lite",
"viewer",
"preview",
"charts"
"charts",
"maps"
],
"engines": {
"vscode": "^1.30.0"
Expand All @@ -33,6 +34,7 @@
"onCommand:vega.create",
"onCommand:vega.preview",
"onCommand:vega.examples",
"onCommand:vega.examples.lite",
"onWebviewPanel:vega.preview",
"onLanguage:json"
],
Expand All @@ -53,6 +55,11 @@
"command": "vega.examples",
"title": "Examples 📊",
"category": "Vega"
},
{
"command": "vega.examples.lite",
"title": "Vega-Lite Examples 📊",
"category": "Vega"
}
],
"keybindings": [
Expand All @@ -67,6 +74,10 @@
{
"command": "vega.examples",
"key": "ctrl+alt+x"
},
{
"command": "vega.examples.lite",
"key": "ctrl+alt+l"
}
],
"languages": [
Expand Down
12 changes: 9 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ export function activate(context: ExtensionContext) {

// Vega: Examples command
const vegaExamplesCommand: Disposable = commands.registerCommand('vega.examples', () =>
showVegaExamples(context.asAbsolutePath('examples'))
showVegaExamples(context.asAbsolutePath('examples'), 'vg.json')
);
context.subscriptions.push(vegaExamplesCommand);

// Vega: Examples command
const vegaExamplesLiteCommand: Disposable = commands.registerCommand('vega.examples.lite', () =>
showVegaExamples(context.asAbsolutePath('examples'), 'vl.json')
);
context.subscriptions.push(vegaExamplesCommand);

Expand Down Expand Up @@ -139,8 +145,8 @@ async function createVegaDocument(vegaTemplate: string, vegaLiteTemplate: string
}
}

async function showVegaExamples(examplesPath: string): Promise<void> {
const fileNames: string[] = fs.readdirSync(examplesPath).filter(f => f.endsWith('vg.json'));
async function showVegaExamples(examplesPath: string, examplesExtension: string): Promise<void> {
const fileNames: string[] = fs.readdirSync(examplesPath).filter(f => f.endsWith(examplesExtension));
const fileItems: Array<QuickPickItem> = [];
fileNames.forEach(fileName => fileItems.push(
{label: `$(graph) ${fileName}`}
Expand Down

0 comments on commit b05cee1

Please sign in to comment.