Skip to content

Commit 1457645

Browse files
author
Štěpán Faragula
committed
Updated README
1 parent 1c5dec4 commit 1457645

1 file changed

Lines changed: 44 additions & 31 deletions

File tree

README.md

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,46 @@
44

55
**GUI 4 Vega** is a React component library that provides a user-friendly interface for creating and customizing [Vega](https://vega.github.io/vega/) visualizations.
66

7-
Refer to this README or [GUI 4 Vega Documentation](https://relisa.github.io/Vega-GUI/).
7+
Refer either to this README or [GUI 4 Vega Documentation](https://relisa.github.io/Vega-GUI/).
88

99
## Features
10-
1110
- **React Component**: Easy integration into any React project via `@relisa/gui4vega` package hosted on GitHub Packages registry.
1211
- **UI Frameworks Integration**: Examples provided for [Ant Design](https://ant.design/) (`demo_antd`) and [Bootstrap](https://react-bootstrap.netlify.app/) (`demo_bootstrap`).
1312
- **Embedded Text Editor**: Interactive JSON editor powered by [CodeMirror](https://codemirror.net/).
1413
- **Wizard Tab**: Step-by-step interface to easily generate sample visualizations and configure simple graphs.
15-
- **Data and Signals Editors**: Interactive UI panels to visually manage, inspect, and tweak Vega data sources and signals without writing JSON manually.
16-
- **Spec Import and Export**: Easily load existing Vega JSON specifications or export your creations for use in other projects.
17-
- **Data Import**: Built-in support for CSV and JSON data importing.
18-
- **Live Preview**: Real-time updates to the Vega visualization as you edit the specification.
19-
- **Customizable Layout**: Layout with resizable panels for the editor and visualization, supporting light and dark themes.
14+
- **Data and Signals Editors**: Panels to visually manage, inspect, and tweak Vega data sources and signals without writing JSON manually.
15+
- **Spec Import and Export**: Load existing Vega JSON specifications or export your creations for use in other projects.
16+
- **Data Import**: Built-in support for CSV and JSON data import via [Papa Parse](https://www.papaparse.com/).
17+
- **Customizable Layout**: Layout with resizable panels for the editor and visualization, supporting light and dark themes via Ant Design GlobalToken.
2018

2119
![GUI 4 Vega](img/intro.gif)
2220

23-
## Contents
24-
2521
## Requirements
26-
2722
- Node.js >= 18.x
2823
- React >= 18.2.0, 19.0.0
2924
- React DOM >= 18.2.0, 19.0.0
3025

26+
## Run demo applications
27+
Since the demo applications are linked locally to the library, you need to build the library first before running the demos:
28+
29+
```bash
30+
# from root of the repository
31+
cd gui4vega
32+
npm install
33+
npm run build
34+
```
35+
36+
After building the library, you can run either of the demo applications (you dont need to link the library to the demo applications, since they are already linked locally in the repository):
37+
38+
```bash
39+
# from root of the repository
40+
cd demo_antd # or demo_bootstrap
41+
npm install
42+
npm run dev
43+
```
44+
45+
The applications will be available at `http://localhost:5173` or `http://localhost:5174` respectively.
46+
3147
## Installation
3248
These steps will guide you through the installation of the GUI 4 Vega package in order to include it in your React project.
3349

@@ -70,7 +86,7 @@ To install the package, you need access to the GitHub Packages registry.
7086
- The `.npmrc` file is also present in the repository.
7187
- You can also refer to the [GitHub documentation](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry) for more details about GitHub Packages.
7288

73-
```ini
89+
```
7490
@relisa:registry=https://npm.pkg.github.com/
7591
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN_WITH_PACKAGE_READ_PERMISSION
7692
```
@@ -81,30 +97,27 @@ To install the package, you need access to the GitHub Packages registry.
8197
npm install @relisa/gui4vega
8298
```
8399

84-
## User Guide
100+
## Importing the Component
101+
To use GUI 4 Vega in your application, simply import the component `VegaEditor` from the package. To access its code via `getCode()` method, you should provide it with a React reference (`ref`).
85102

86-
### Run demo applications
87-
Since the demo applications are linked locally to the library, you need to build the library first before running the demos:
103+
```typescript
104+
import React, { useRef } from 'react';
105+
import { VegaEditor } from '@relisa/gui4vega';
106+
import type { VegaEditorRef } from '@relisa/gui4vega';
88107

89-
```bash
90-
# from root of the repository
91-
cd gui4vega
92-
npm install
93-
npm run build
94-
```
108+
const App = () => {
109+
// Create a ref to interact with the VegaEditor instance
110+
// You can access the getCode() method through this ref
111+
const editorRef = useRef<VegaEditorRef>(null);
95112

96-
After building the library, you can run either of the demo applications (you dont need to link the library to the demo applications, since they are already linked locally in the repository):
113+
return (
114+
<VegaEditor ref={editorRef} height='700px' />
115+
);
116+
};
97117

98-
```bash
99-
# from root of the repository
100-
cd demo_antd # or demo_bootstrap
101-
npm install
102-
npm run dev
118+
export default App;
103119
```
104120

105-
The applications will be available at `http://localhost:5173` or `http://localhost:5174` respectively.
106-
107-
### Editor
108-
The GUI provides an integrated code editor for updating the Vega visualization specification JSON. Changes to the code automatically reflect on the rendered chart.
121+
---
109122

110-
## Known Issues and Limitations
123+
If you would like to access exported data from the editor in your code, consider using the `ExternalSelectionExporter` component. For its usage, refer to the [GUI 4 Vega Documentation](https://relisa.github.io/Vega-GUI/) or [implementation of demo_antd](https://relisa.github.io/Vega-GUI/), which includes an example of how to use it.

0 commit comments

Comments
 (0)