@vitessce/vega 3.4.6 → 3.4.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"VegaPlot.d.ts","sourceRoot":"","sources":["../src/VegaPlot.js"],"names":[],"mappings":"AAsCA;;;;;;GAMG;AACH,gCALW,MAAM,sBA6EhB"}
1
+ {"version":3,"file":"VegaPlot.d.ts","sourceRoot":"","sources":["../src/VegaPlot.js"],"names":[],"mappings":"AA2CA;;;;;;GAMG;AACH,gCALW,MAAM,sBAiFhB"}
@@ -1,11 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { Suspense, useMemo } from 'react';
3
3
  import { Handler } from 'vega-tooltip';
4
+ import * as vegaImport from 'vega';
4
5
  import clsx from 'clsx';
5
6
  import { useTooltipStyles } from '@vitessce/tooltip';
7
+ import { getInterpolateFunction } from '@vitessce/legend';
6
8
  import ReactVega from './ReactVega.js';
7
9
  import { DATASET_NAME } from './utils.js';
8
10
  import { useStyles } from './styles.js';
11
+ // Register additional colormaps using vega.scheme().
12
+ // Reference: https://vega.github.io/vega/docs/schemes/
13
+ vegaImport.scheme('jet', getInterpolateFunction('jet'));
9
14
  // TODO: React.lazy is not working with Vitessce in the portal-ui.
10
15
  // For now, we can work around this by not using React.lazy,
11
16
  // but for performance benefits that come with lazy-loading
@@ -78,6 +83,6 @@ export function VegaPlot(props) {
78
83
  }), [partialSpec]);
79
84
  const vegaComponent = useMemo(() => (_jsx(ReactVega, { spec: spec, data: {
80
85
  [DATASET_NAME]: data,
81
- }, signalListeners: signalListeners, tooltip: tooltipHandler, renderer: "canvas", scaleFactor: 3 })), [spec, data, signalListeners, tooltipHandler]);
86
+ }, signalListeners: signalListeners, tooltip: tooltipHandler, renderer: "svg", scaleFactor: 3 }, JSON.stringify({ width: spec.width, height: spec.height }))), [spec, data, signalListeners, tooltipHandler]);
82
87
  return (spec && data && data.length > 0 ? (_jsx(Suspense, { fallback: _jsx("div", { children: "Loading..." }), children: vegaComponent })) : null);
83
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/vega",
3
- "version": "3.4.6",
3
+ "version": "3.4.8",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -22,7 +22,8 @@
22
22
  "vega": "^5.21.0",
23
23
  "vega-lite": "^5.1.1",
24
24
  "vega-tooltip": "^0.27.0",
25
- "@vitessce/tooltip": "3.4.6"
25
+ "@vitessce/tooltip": "3.4.8",
26
+ "@vitessce/legend": "3.4.8"
26
27
  },
27
28
  "devDependencies": {
28
29
  "react": "^18.0.0",
package/src/VegaPlot.js CHANGED
@@ -1,11 +1,16 @@
1
1
  import React, { Suspense, useMemo } from 'react';
2
2
  import { Handler } from 'vega-tooltip';
3
+ import * as vegaImport from 'vega';
3
4
  import clsx from 'clsx';
4
5
  import { useTooltipStyles } from '@vitessce/tooltip';
6
+ import { getInterpolateFunction } from '@vitessce/legend';
5
7
  import ReactVega from './ReactVega.js';
6
8
  import { DATASET_NAME } from './utils.js';
7
9
  import { useStyles } from './styles.js';
8
10
 
11
+ // Register additional colormaps using vega.scheme().
12
+ // Reference: https://vega.github.io/vega/docs/schemes/
13
+ vegaImport.scheme('jet', getInterpolateFunction('jet'));
9
14
 
10
15
  // TODO: React.lazy is not working with Vitessce in the portal-ui.
11
16
  // For now, we can work around this by not using React.lazy,
@@ -103,8 +108,12 @@ export function VegaPlot(props) {
103
108
  }}
104
109
  signalListeners={signalListeners}
105
110
  tooltip={tooltipHandler}
106
- renderer="canvas"
111
+ renderer="svg"
107
112
  scaleFactor={3}
113
+ // We need to force a re-render when the spec
114
+ // is the same except for changed width/height
115
+ // (to support responsive plots).
116
+ key={JSON.stringify({ width: spec.width, height: spec.height })}
108
117
  />
109
118
  ), [spec, data, signalListeners, tooltipHandler]);
110
119