geneviewer-js 0.3.1 → 0.3.2
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 +7 -6
- package/dist/SHA256SUMS +7 -7
- package/dist/geneviewer.core.js +3 -2
- package/dist/geneviewer.min.js +2 -2
- package/dist/geneviewer.min.js.map +3 -3
- package/dist/geneviewer.mjs +3 -2
- package/dist/geneviewer.standalone.mjs +2 -2
- package/dist/geneviewer.standalone.mjs.map +3 -3
- package/dist/geneviewerwidget.js +13 -9
- package/package.json +1 -1
package/dist/geneviewerwidget.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The htmlwidgets binding of the R package: draws each chart with
|
|
1
|
+
// The htmlwidgets binding of the R package: draws each chart's spec with
|
|
2
2
|
// geneviewer.newChart() (geneviewer.js) and, in Shiny, sends its events to
|
|
3
3
|
// Shiny inputs. The R package may load this file before geneviewer.js, so
|
|
4
4
|
// geneviewer is only used once a chart is drawn.
|
|
@@ -18,12 +18,6 @@ var addZoomHandler = function () {
|
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
// Until the R package moves to the spec (M6): tests in the R package and the
|
|
22
|
-
// app export a chart with the globals chartToSVG(el) and chartToPNG(el),
|
|
23
|
-
// which geneviewer.js defined before it was bundled
|
|
24
|
-
window.chartToSVG = function (el, exclude) { return geneviewer.chartToSVG(el, exclude); };
|
|
25
|
-
window.chartToPNG = function (el, exclude) { return geneviewer.chartToPNG(el, exclude); };
|
|
26
|
-
|
|
27
21
|
HTMLWidgets.widget({
|
|
28
22
|
name: 'geneviewer',
|
|
29
23
|
type: 'output',
|
|
@@ -50,16 +44,26 @@ HTMLWidgets.widget({
|
|
|
50
44
|
if (HTMLWidgets.shinyMode) addZoomHandler();
|
|
51
45
|
|
|
52
46
|
return {
|
|
47
|
+
// x is { spec } from the R package 0.3.0 on; before, a render model.
|
|
48
|
+
// A redraw from Shiny gives the whole chart again, so a spec replaces
|
|
49
|
+
// the chart's spec (setSpec), which update() would merge into.
|
|
53
50
|
renderValue: function (x) {
|
|
51
|
+
var spec = x && x.spec;
|
|
54
52
|
if (chart) {
|
|
55
|
-
chart.
|
|
53
|
+
if (spec) chart.setSpec(spec);
|
|
54
|
+
else chart.update(x);
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
58
|
-
chart = geneviewer.newChart(el, x, options);
|
|
57
|
+
chart = geneviewer.newChart(el, spec || x, options);
|
|
59
58
|
charts[el.id] = chart;
|
|
60
59
|
},
|
|
61
60
|
resize: function () {
|
|
62
61
|
if (chart) chart.resize();
|
|
62
|
+
},
|
|
63
|
+
// The chart (geneviewer.newChart()), e.g. for chart.toSVG():
|
|
64
|
+
// HTMLWidgets.find("#" + id).getChart(); null before the first draw
|
|
65
|
+
getChart: function () {
|
|
66
|
+
return chart;
|
|
63
67
|
}
|
|
64
68
|
};
|
|
65
69
|
}
|