@deephaven/embed-chart 0.55.1-beta.11 → 0.55.1-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -49
- package/build/assets/{App-26d2e872.js → App-5242446a.js} +2 -2
- package/build/assets/App-5242446a.js.map +1 -0
- package/build/assets/{App-ddc6b344.css → App-bad0fe82.css} +1 -1
- package/build/assets/{index-9b80445a.js → index-7981b625.js} +11 -11
- package/build/assets/index-7981b625.js.map +1 -0
- package/build/assets/{index-fff953c6.js → index-cf041b37.js} +2 -2
- package/build/assets/{index-fff953c6.js.map → index-cf041b37.js.map} +1 -1
- package/build/assets/{useConnection-74989f4c.js → useConnection-f339eec0.js} +2 -2
- package/build/assets/{useConnection-74989f4c.js.map → useConnection-f339eec0.js.map} +1 -1
- package/build/index.html +2 -6
- package/package.json +14 -14
- package/build/assets/App-26d2e872.js.map +0 -1
- package/build/assets/index-9b80445a.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# Embedded Deephaven Chart
|
|
2
2
|
|
|
3
|
-
This project
|
|
3
|
+
This project uses [Vite](https://vitejs.dev/guide/). It is to provide an example React application connecting to Deephaven and displaying a chart or plot.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Running
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
2. **Install dependencies**: Run `npm install` to install all dependencies required.
|
|
9
|
-
3. **Start the UI**: Run `npm start` to start up the UI. It should automatically open up at http://localhost:4020.
|
|
7
|
+
To start the Embed Chart server, run `npm install` and `npm start` in the root directory of this repository. See the [Getting Started](../../README.md#getting-started) section for more details.
|
|
10
8
|
|
|
11
9
|
## Query Parameters
|
|
12
10
|
|
|
@@ -22,47 +20,4 @@ Once Deephaven is running, you can open a chart with a specific name by adding t
|
|
|
22
20
|
|
|
23
21
|
### Configuring Server Address
|
|
24
22
|
|
|
25
|
-
By default, this project assumes you are hosting Deephaven with Python on the default port at http://localhost:10000. If Deephaven is running on a different port/server, update the `VITE_CORE_API_URL` environment variable to point to the correct server. See [.env](./.env) file for the default definition, and [
|
|
26
|
-
|
|
27
|
-
## Available Scripts
|
|
28
|
-
|
|
29
|
-
In the project directory, you can run:
|
|
30
|
-
|
|
31
|
-
### `npm start`
|
|
32
|
-
|
|
33
|
-
Runs the app in the development mode.\
|
|
34
|
-
Open [http://localhost:4020](http://localhost:4020) to view it in the browser.
|
|
35
|
-
|
|
36
|
-
The page will reload if you make edits.\
|
|
37
|
-
You will also see any lint errors in the console.
|
|
38
|
-
|
|
39
|
-
### `npm test`
|
|
40
|
-
|
|
41
|
-
Launches the test runner in the interactive watch mode.\
|
|
42
|
-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
43
|
-
|
|
44
|
-
### `npm run build`
|
|
45
|
-
|
|
46
|
-
Builds the app for production to the `build` folder.\
|
|
47
|
-
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
48
|
-
|
|
49
|
-
The build is minified and the filenames include the hashes.\
|
|
50
|
-
Your app is ready to be deployed!
|
|
51
|
-
|
|
52
|
-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
53
|
-
|
|
54
|
-
### `npm run eject`
|
|
55
|
-
|
|
56
|
-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
|
57
|
-
|
|
58
|
-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
59
|
-
|
|
60
|
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
|
61
|
-
|
|
62
|
-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
|
63
|
-
|
|
64
|
-
## Learn More
|
|
65
|
-
|
|
66
|
-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
67
|
-
|
|
68
|
-
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
23
|
+
By default, this project assumes you are hosting Deephaven with Python on the default port at http://localhost:10000. If Deephaven is running on a different port/server, update the `VITE_CORE_API_URL` environment variable to point to the correct server. See [.env](./.env) file for the default definition, and [vite docs](https://vitejs.dev/guide/env-and-mode.html#env-variables-and-modes) for other ways to set this environment variable.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as o,C as n}from"./vendor-d4b2c5a9.js";import{L as C,a as b}from"./index-
|
|
2
|
-
//# sourceMappingURL=App-
|
|
1
|
+
import{r as o,C as n}from"./vendor-d4b2c5a9.js";import{L as C,a as b}from"./index-cf041b37.js";import{u as w,a as y,b as L,C as A,c as E,d as M}from"./useConnection-f339eec0.js";import"./helpers-042e6b4d.js";import"./plotly-3a491416.js";const t=C.module("EmbedChart.App");async function j(a,r,s){t.info(`Fetching figure ${s}...`);const i={name:s,type:a.VariableType.FIGURE};return r.getObject(i)}function $(){const[a,r]=o.useState(),[s,i]=o.useState(),[m,g]=o.useState(!0),d=o.useMemo(()=>new URLSearchParams(window.location.search),[]),l=w(),c=y(),p=L();o.useEffect(function(){async function f(){try{const e=d.get("name");if(e==null)throw new Error("No name param provided");t.debug("Loading figure",e,"...");const h=await j(c,l,e);t.debug("Creating model...");const x=await M.makeModel(c,void 0,h,p);r(x),t.debug("Figure successfully loaded!")}catch(e){t.error("Unable to load figure",e),i(`${e}`)}g(!1)}f()},[c,l,d,p]);const u=a!=null;return n.jsxs("div",{className:"App",children:[u&&n.jsx(A,{model:a}),!u&&n.jsx(b,{isLoaded:u,isLoading:m,errorMessage:s??null}),n.jsx(E,{})]})}export{$ as default};
|
|
2
|
+
//# sourceMappingURL=App-5242446a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App-5242446a.js","sources":["../../src/App.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport {\n Chart,\n ChartModel,\n ChartModelFactory,\n useChartTheme,\n} from '@deephaven/chart'; // chart is used to display Deephaven charts\nimport { ContextMenuRoot, LoadingOverlay } from '@deephaven/components'; // Use the loading spinner from the Deephaven components package\nimport type {\n dh as DhType,\n Figure,\n IdeConnection,\n} from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport './App.scss'; // Styles for in this app\nimport { useApi } from '@deephaven/jsapi-bootstrap';\nimport { useConnection } from '@deephaven/jsapi-components';\n\nconst log = Log.module('EmbedChart.App');\n\n/**\n * Load an existing Deephaven figure with the connection provided\n * @param dh JSAPI instance\n * @param connection The Deephaven session object\n * @param name Name of the figure to load\n * @returns Deephaven figure\n */\nasync function loadFigure(\n dh: DhType,\n connection: IdeConnection,\n name: string\n): Promise<Figure> {\n log.info(`Fetching figure ${name}...`);\n\n const definition = { name, type: dh.VariableType.FIGURE };\n return connection.getObject(definition);\n}\n\n/**\n * A functional React component that displays a Deephaven figure using the @deephaven/chart package.\n * It will attempt to open and display the figure specified with the `name` parameter, expecting it to be present on the server.\n * E.g. http://localhost:3000/?name=myFigure will attempt to open a figure `myFigure`\n * If no query param is provided, it will display an error.\n * By default, tries to connect to the server defined in the VITE_CORE_API_URL variable, which is set to http://localhost:10000/jsapi\n * See Vite docs for how to update these env vars: https://vitejs.dev/guide/env-and-mode.html\n */\nfunction App(): JSX.Element {\n const [model, setModel] = useState<ChartModel>();\n const [error, setError] = useState<string>();\n const [isLoading, setIsLoading] = useState(true);\n const searchParams = useMemo(\n () => new URLSearchParams(window.location.search),\n []\n );\n const connection = useConnection();\n const dh = useApi();\n const chartTheme = useChartTheme();\n\n useEffect(\n function initializeApp() {\n async function initApp(): Promise<void> {\n try {\n // Get the table name from the query param `name`.\n const name = searchParams.get('name');\n\n if (name == null) {\n throw new Error('No name param provided');\n }\n\n log.debug('Loading figure', name, '...');\n\n // Load the figure up.\n const figure = await loadFigure(dh, connection, name);\n\n // Create the `ChartModel` for use with the `Chart` component\n log.debug(`Creating model...`);\n\n const newModel = await ChartModelFactory.makeModel(\n dh,\n undefined,\n figure,\n chartTheme\n );\n\n setModel(newModel);\n\n log.debug('Figure successfully loaded!');\n } catch (e: unknown) {\n log.error('Unable to load figure', e);\n setError(`${e}`);\n }\n setIsLoading(false);\n }\n initApp();\n },\n [dh, connection, searchParams, chartTheme]\n );\n\n const isLoaded = model != null;\n\n return (\n <div className=\"App\">\n {isLoaded && <Chart model={model} />}\n {!isLoaded && (\n <LoadingOverlay\n isLoaded={isLoaded}\n isLoading={isLoading}\n errorMessage={error ?? null}\n />\n )}\n <ContextMenuRoot />\n </div>\n );\n}\n\nexport default App;\n"],"names":["log","Log","loadFigure","dh","connection","name","definition","App","model","setModel","useState","error","setError","isLoading","setIsLoading","searchParams","useMemo","useConnection","useApi","chartTheme","useChartTheme","useEffect","initApp","figure","newModel","ChartModelFactory","isLoaded","jsxs","jsx","Chart","LoadingOverlay","ContextMenuRoot"],"mappings":"6OAkBA,MAAMA,EAAMC,EAAI,OAAO,gBAAgB,EASvC,eAAeC,EACbC,EACAC,EACAC,EACiB,CACbL,EAAA,KAAK,mBAAmBK,MAAS,EAErC,MAAMC,EAAa,CAAE,KAAAD,EAAM,KAAMF,EAAG,aAAa,QAC1C,OAAAC,EAAW,UAAUE,CAAU,CACxC,CAUA,SAASC,GAAmB,CAC1B,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAqB,SAAA,EACzC,CAACC,EAAOC,CAAQ,EAAIF,EAAiB,SAAA,EACrC,CAACG,EAAWC,CAAY,EAAIJ,WAAS,EAAI,EACzCK,EAAeC,EAAA,QACnB,IAAM,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAChD,CAAC,CAAA,EAEGZ,EAAaa,IACbd,EAAKe,IACLC,EAAaC,IAEnBC,EAAA,UACE,UAAyB,CACvB,eAAeC,GAAyB,CAClC,GAAA,CAEI,MAAAjB,EAAOU,EAAa,IAAI,MAAM,EAEpC,GAAIV,GAAQ,KACJ,MAAA,IAAI,MAAM,wBAAwB,EAGtCL,EAAA,MAAM,iBAAkBK,EAAM,KAAK,EAGvC,MAAMkB,EAAS,MAAMrB,EAAWC,EAAIC,EAAYC,CAAI,EAGpDL,EAAI,MAAM,mBAAmB,EAEvB,MAAAwB,EAAW,MAAMC,EAAkB,UACvCtB,EACA,OACAoB,EACAJ,CAAA,EAGFV,EAASe,CAAQ,EAEjBxB,EAAI,MAAM,6BAA6B,QAChC,GACHA,EAAA,MAAM,wBAAyB,CAAC,EACpCY,EAAS,GAAG,GAAG,CACjB,CACAE,EAAa,EAAK,CACpB,CACQQ,GACV,EACA,CAACnB,EAAIC,EAAYW,EAAcI,CAAU,CAAA,EAG3C,MAAMO,EAAWlB,GAAS,KAGxB,OAAAmB,EAAA,KAAC,MAAI,CAAA,UAAU,MACZ,SAAA,CAAYD,GAAAE,EAAA,IAACC,GAAM,MAAArB,CAAc,CAAA,EACjC,CAACkB,GACAE,EAAA,IAACE,EAAA,CACC,SAAAJ,EACA,UAAAb,EACA,aAAcF,GAAS,IAAA,CACzB,QAEDoB,EAAgB,EAAA,CACnB,CAAA,CAAA,CAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.App{position:absolute;top:0;left:0;right:0;bottom:0;height:100%;width:100
|
|
1
|
+
.App{position:absolute;top:0;left:0;right:0;bottom:0;height:100%;width:100%}
|