aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/DataVizBox.tsx
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2023-10-16 15:40:09 -0400
committersrichman333 <sarah_n_richman@brown.edu>2023-10-16 15:40:09 -0400
commit8acaa16a276600d8c5a201f49099e551aeb55416 (patch)
tree3d2a8b47034e6d10b525719dbfaeb0c092156a3f /src/client/views/nodes/DataVizBox/DataVizBox.tsx
parent20ddaa48fae25dbb8c09107955b91630e9a311f9 (diff)
from last
Diffstat (limited to 'src/client/views/nodes/DataVizBox/DataVizBox.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/DataVizBox.tsx50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
index 9330e3b7f..b154a3607 100644
--- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx
+++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
@@ -155,7 +155,6 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
* @param e
*/
sidebarBtnDown = (e: React.PointerEvent) => {
- console.log('down')
setupMoveUpEvents(
this,
e,
@@ -190,29 +189,32 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
}
sidebarWidth = () => (Number(this.sidebarWidthPercent.substring(0, this.sidebarWidthPercent.length - 1)) / 100) * this.props.PanelWidth();
sidebarAddDocument = (doc: Doc | Doc[], sidebarKey?: string) => {
- if (!this.layoutDoc._layout_showSidebar) this.toggleSidebar();
- const docs = doc instanceof Doc ? [doc] : doc;
- docs.forEach(doc => {
- let existingPin = Docs.Create.TextDocument("test");
- //let existingPin = this.allPushpins.find(pin => pin.latitude === doc.latitude && pin.longitude === doc.longitude) ?? this.selectedPin;
- // if (doc.latitude !== undefined && doc.longitude !== undefined && !existingPin) {
- // existingPin = this.createPushpin(NumCast(doc.latitude), NumCast(doc.longitude), StrCast(doc.map));
- // }
- if (existingPin) {
- setTimeout(() => {
- // we use a timeout in case this is called from the sidebar which may have just added a link that hasn't made its way into th elink manager yet
- if (!LinkManager.Instance.getAllRelatedLinks(doc).some(link => DocCast(link.link_anchor_1)?.mapPin === existingPin || DocCast(link.link_anchor_2)?.mapPin === existingPin)) {
- // const anchor = this.getAnchor(true, undefined, existingPin);
- const anchor = this.getAnchor(true, undefined);
- anchor && DocUtils.MakeLink(anchor, doc, { link_relationship: 'link to datapoint' });
- // doc.latitude = existingPin?.latitude;
- // doc.longitude = existingPin?.longitude;
- }
- });
- }
- }); //add to annotation list
+ console.log('sideBarAddDoc')
+ if (!this.SidebarShown) this.toggleSidebar();
+ return this.addDocument(doc, sidebarKey);
+ // if (!this.layoutDoc._layout_showSidebar) this.toggleSidebar();
+ // const docs = doc instanceof Doc ? [doc] : doc;
+ // docs.forEach(doc => {
+ // let existingPin = Docs.Create.TextDocument("test");
+ // //let existingPin = this.allPushpins.find(pin => pin.latitude === doc.latitude && pin.longitude === doc.longitude) ?? this.selectedPin;
+ // // if (doc.latitude !== undefined && doc.longitude !== undefined && !existingPin) {
+ // // existingPin = this.createPushpin(NumCast(doc.latitude), NumCast(doc.longitude), StrCast(doc.map));
+ // // }
+ // if (existingPin) {
+ // setTimeout(() => {
+ // // we use a timeout in case this is called from the sidebar which may have just added a link that hasn't made its way into th elink manager yet
+ // if (!LinkManager.Instance.getAllRelatedLinks(doc).some(link => DocCast(link.link_anchor_1)?.mapPin === existingPin || DocCast(link.link_anchor_2)?.mapPin === existingPin)) {
+ // // const anchor = this.getAnchor(true, undefined, existingPin);
+ // const anchor = this.getAnchor(true, undefined);
+ // anchor && DocUtils.MakeLink(anchor, doc, { link_relationship: 'link to datapoint' });
+ // // doc.latitude = existingPin?.latitude;
+ // // doc.longitude = existingPin?.longitude;
+ // }
+ // });
+ // }
+ // }); //add to annotation list
- return this.addDocument(doc, sidebarKey); // add to sidebar list
+ // return this.addDocument(doc, sidebarKey); // add to sidebar list
};
sidebarRemoveDocument = (doc: Doc | Doc[], sidebarKey?: string) => this.removeDocument(doc, sidebarKey);
@@ -243,7 +245,7 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
case DataVizView.TABLE:
return <TableBox {...sharedProps} docView={this.props.DocumentView} selectAxes={this.selectAxes} />;
case DataVizView.LINECHART:
- return <LineChart {...sharedProps} dataDoc={this.dataDoc} fieldKey={this.fieldKey} ref={r => (this._vizRenderer = r ?? undefined)} />;
+ return <LineChart vizBox={this} {...sharedProps} dataDoc={this.dataDoc} fieldKey={this.fieldKey} ref={r => (this._vizRenderer = r ?? undefined)} />;
case DataVizView.HISTOGRAM:
return <Histogram {...sharedProps} dataDoc={this.dataDoc} fieldKey={this.fieldKey} ref={r => (this._vizRenderer = r ?? undefined)} />;
case DataVizView.PIECHART: