aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-12-27 16:03:47 -0500
committerbobzel <zzzman@gmail.com>2023-12-27 16:03:47 -0500
commitce7a55a8a29bcff8f6384e5df0e202d47d9cb9cb (patch)
tree2e3585fc7017e6d96638d9e19c8f0571aabdacb7 /src
parentcf333a2119629f4172efef3dee08b40776cc660b (diff)
error fixes.
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/DataVizBox/DataVizBox.tsx64
1 files changed, 30 insertions, 34 deletions
diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
index e8e46edbc..3c9105996 100644
--- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx
+++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
@@ -133,13 +133,13 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
const anchor = !pinProps
? this.Document
: this._vizRenderer?.getAnchor(pinProps) ??
- visibleAnchor ??
+ visibleAnchor ??
Docs.Create.ConfigDocument({
- title: 'ImgAnchor:' + this.Document.title,
- config_panX: NumCast(this.layoutDoc._freeform_panX),
- config_panY: NumCast(this.layoutDoc._freeform_panY),
- config_viewScale: Cast(this.layoutDoc._freeform_scale, 'number', null),
- annotationOn: this.Document,
+ title: 'ImgAnchor:' + this.Document.title,
+ config_panX: NumCast(this.layoutDoc._freeform_panX),
+ config_panY: NumCast(this.layoutDoc._freeform_panY),
+ config_viewScale: Cast(this.layoutDoc._freeform_scale, 'number', null),
+ annotationOn: this.Document,
// when we clear selection -> we should have it so chartBox getAnchor returns undefined
// this is for when we want the whole doc (so when the chartBox getAnchor returns without a marker)
/*put in some options*/
@@ -155,7 +155,7 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
anchor[key] = this.layoutDoc[key];
}
});
-
+
this.addDocument(anchor);
//addAsAnnotation && this.addDocument(anchor);
return anchor;
@@ -269,15 +269,15 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
layoutDoc: this.layoutDoc,
records: this.records,
axes: this.axes,
- //width: this.SidebarShown? this._props.PanelWidth()*.9/1.2: this._props.PanelWidth() * 0.9,
+ //width: this.SidebarShown? this._props.PanelWidth()*.9/1.2: this._props.PanelWidth() * 0.9,
height: (this._props.PanelHeight() / scale - 32) /* height of 'change view' button */ * 0.9,
width: (this._props.PanelWidth() / scale) * 0.9,
margin: { top: 10, right: 25, bottom: 75, left: 45 },
};
if (!this.records.length) return 'no data/visualization';
switch (this.dataVizView) {
- case DataVizView.TABLE: return <TableBox {...sharedProps} docView={this.DocumentView} selectAxes={this.selectAxes} />;
- case DataVizView.LINECHART: return <LineChart {...sharedProps} dataDoc={this.dataDoc} fieldKey={this.fieldKey} ref={r => (this._vizRenderer = r ?? undefined)} />;
+ 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)} vizBox={this} />;
case DataVizView.HISTOGRAM: return <Histogram {...sharedProps} dataDoc={this.dataDoc} fieldKey={this.fieldKey} ref={r => (this._vizRenderer = r ?? undefined)} />;
case DataVizView.PIECHART: return <PieChart {...sharedProps} dataDoc={this.dataDoc} fieldKey={this.fieldKey} ref={r => (this._vizRenderer = r ?? undefined)}
margin={{ top: 10, right: 15, bottom: 15, left: 15 }} />;
@@ -326,28 +326,28 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
@action
updateSchemaViz = () => {
- const getFrom = DocCast(this.layoutDoc.dataViz_asSchema)
- const keys = Cast(getFrom.schema_columnKeys, listSpec('string'))?.filter(key => key!="text");
+ const getFrom = DocCast(this.layoutDoc.dataViz_asSchema);
+ const keys = Cast(getFrom.schema_columnKeys, listSpec('string'))?.filter(key => key != 'text');
if (!keys) return;
const children = DocListCast(getFrom[Doc.LayoutFieldKey(getFrom)]);
- var current: {[key: string]: string}[] = []
- for (let i=0; i<children.length; i++){
- var row: {[key:string]: string} = {};
- if (children[i]){
- for (let j=0; j<keys.length; j++){
+ var current: { [key: string]: string }[] = [];
+ for (let i = 0; i < children.length; i++) {
+ var row: { [key: string]: string } = {};
+ if (children[i]) {
+ for (let j = 0; j < keys.length; j++) {
var cell = children[i][keys[j]];
- if (cell && cell as string) cell = cell.toString().replace(/\,/g, '');
- row[keys[j]] = StrCast(cell)
+ if (cell && (cell as string)) cell = cell.toString().replace(/\,/g, '');
+ row[keys[j]] = StrCast(cell);
}
}
- current.push(row)
+ current.push(row);
}
- DataVizBox.dataset.set(CsvCast(this.Document[this.fieldKey]).url.href, current )
- }
-
+ DataVizBox.dataset.set(CsvCast(this.Document[this.fieldKey]).url.href, current);
+ };
+
render() {
- if (this.layoutDoc && this.layoutDoc.dataViz_asSchema){
- this.schemaDataVizChildren = DocListCast(DocCast(this.layoutDoc.dataViz_asSchema)[Doc.LayoutFieldKey(DocCast(this.layoutDoc.dataViz_asSchema))]).length
+ if (this.layoutDoc && this.layoutDoc.dataViz_asSchema) {
+ this.schemaDataVizChildren = DocListCast(DocCast(this.layoutDoc.dataViz_asSchema)[Doc.LayoutFieldKey(DocCast(this.layoutDoc.dataViz_asSchema))]).length;
this.updateSchemaViz();
}
@@ -367,8 +367,7 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
position: 'absolute',
}}
onWheel={e => e.stopPropagation()}
- ref={this._mainCont}
- >
+ ref={this._mainCont}>
<div className={'datatype-button'}>
<Toggle text={' TABLE '} toggleType={ToggleType.BUTTON} type={Type.SEC} color={'black'} onClick={e => (this.layoutDoc._dataViz = DataVizView.TABLE)} toggleStatus={this.layoutDoc._dataViz === DataVizView.TABLE} />
<Toggle text={'LINECHART'} toggleType={ToggleType.BUTTON} type={Type.SEC} color={'black'} onClick={e => (this.layoutDoc._dataViz = DataVizView.LINECHART)} toggleStatus={this.layoutDoc._dataViz === DataVizView.LINECHART} />
@@ -397,15 +396,12 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
</CollectionFreeFormView> */}
{this.renderVizView}
- <div className="dataviz-sidebar"
- style={{ width: `${this.sidebarWidthPercent}`,
- backgroundColor: `${this.sidebarColor}` }}
- onPointerDown={this.onPointerDown}>
+ <div className="dataviz-sidebar" style={{ width: `${this.sidebarWidthPercent}`, backgroundColor: `${this.sidebarColor}` }} onPointerDown={this.onPointerDown}>
<SidebarAnnos
ref={this._sidebarRef}
{...this._props}
fieldKey={this.fieldKey}
- rootDoc={this.Document}
+ Document={this.Document}
layoutDoc={this.layoutDoc}
dataDoc={this.dataDoc}
usePanelWidth={true}
@@ -422,13 +418,13 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
{this.annotationLayer}
{!this._marqueeing || !this._mainCont.current || !this._annotationLayer.current ? null : (
<MarqueeAnnotator
- rootDoc={this.Document}
+ Document={this.Document}
getPageFromScroll={undefined}
anchorMenuClick={this.anchorMenuClick}
scrollTop={0}
annotationLayerScrollTop={NumCast(this.Document._layout_scrollTop)}
addDocument={this.sidebarAddDocument}
- docView={this.DocumentView!}
+ docView={this._props.DocumentView!}
finishMarquee={this.finishMarquee}
savedAnnotations={this.savedAnnotations}
selectionText={returnEmptyString}