aboutsummaryrefslogtreecommitdiff
path: root/src/client/northstar/dash-nodes
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-03-29 16:18:55 -0400
committerbob <bcz@cs.brown.edu>2019-03-29 16:18:55 -0400
commita10bbd686a825ee38caceb7ecfc388715c14a817 (patch)
tree9eea3acb2c10c8b9e633aeceea2fc4408eb53f51 /src/client/northstar/dash-nodes
parentda7a12f9b49b43534658524b1da846948fbf3947 (diff)
added basic brushing placeholder
Diffstat (limited to 'src/client/northstar/dash-nodes')
-rw-r--r--src/client/northstar/dash-nodes/HistogramBox.tsx19
-rw-r--r--src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx5
2 files changed, 16 insertions, 8 deletions
diff --git a/src/client/northstar/dash-nodes/HistogramBox.tsx b/src/client/northstar/dash-nodes/HistogramBox.tsx
index dba4ce900..b464e125c 100644
--- a/src/client/northstar/dash-nodes/HistogramBox.tsx
+++ b/src/client/northstar/dash-nodes/HistogramBox.tsx
@@ -2,26 +2,25 @@ import React = require("react")
import { action, computed, observable, reaction, runInAction } from "mobx";
import { observer } from "mobx-react";
import Measure from "react-measure";
-import { Dictionary } from "typescript-collections";
import { FieldWaiting, Opt } from "../../../fields/Field";
+import { Document } from "../../../fields/Document";
import { KeyStore } from "../../../fields/KeyStore";
import { CurrentUserUtils } from "../../../server/authentication/models/current_user_utils";
-import { FilterModel } from '../../northstar/core/filter/FilterModel';
import { ChartType, VisualBinRange } from '../../northstar/model/binRanges/VisualBinRange';
import { VisualBinRangeHelper } from "../../northstar/model/binRanges/VisualBinRangeHelper";
-import { AggregateBinRange, BinRange, DoubleValueAggregateResult, HistogramResult, Catalog, AggregateFunction } from "../../northstar/model/idea/idea";
+import { AggregateBinRange, AggregateFunction, BinRange, Catalog, DoubleValueAggregateResult, HistogramResult } from "../../northstar/model/idea/idea";
import { ModelHelpers } from "../../northstar/model/ModelHelpers";
import { HistogramOperation } from "../../northstar/operations/HistogramOperation";
-import { PIXIRectangle } from "../../northstar/utils/MathUtil";
import { SizeConverter } from "../../northstar/utils/SizeConverter";
import { DragManager } from "../../util/DragManager";
import { FieldView, FieldViewProps } from "../../views/nodes/FieldView";
+import { AttributeTransformationModel } from "../core/attribute/AttributeTransformationModel";
import { HistogramField } from "../dash-fields/HistogramField";
-import "../utils/Extensions"
+import "../utils/Extensions";
import "./HistogramBox.scss";
import { HistogramBoxPrimitives } from './HistogramBoxPrimitives';
import { HistogramLabelPrimitives } from "./HistogramLabelPrimitives";
-import { AttributeTransformationModel } from "../core/attribute/AttributeTransformationModel";
+import { StyleConstants } from "../utils/StyleContants";
export interface HistogramPrimitivesProps {
HistoBox: HistogramBox;
@@ -124,7 +123,13 @@ export class HistogramBox extends React.Component<FieldViewProps> {
this.props.doc.GetTAsync(this.props.fieldKey, HistogramField).then((histoOp: Opt<HistogramField>) => runInAction(() => {
this.HistoOp = histoOp ? histoOp.Data : HistogramOperation.Empty;
if (this.HistoOp != HistogramOperation.Empty) {
- reaction(() => this.props.doc.GetList(KeyStore.LinkedFromDocs, []), docs => this.HistoOp.Links.splice(0, this.HistoOp.Links.length, ...docs), { fireImmediately: true });
+ reaction(() => this.props.doc.GetList(KeyStore.LinkedFromDocs, []),
+ (docs: Document[]) => {
+ var availableColors = StyleConstants.BRUSH_COLORS.map(c => c);
+ docs.map((brush, i) => brush.SetNumber(KeyStore.BackgroundColor, availableColors[i % availableColors.length]));
+ this.HistoOp.BrushLinks.splice(0, this.HistoOp.BrushLinks.length, ...docs);
+ //this.HistoOp.Links.splice(0, this.HistoOp.Links.length, ...docs)
+ }, { fireImmediately: true });
reaction(() => this.createOperationParamsCache, () => this.HistoOp.Update(), { fireImmediately: true });
}
}));
diff --git a/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx b/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx
index 5e403eb9c..b8020c28c 100644
--- a/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx
+++ b/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx
@@ -168,7 +168,7 @@ export class HistogramBinPrimitiveCollection {
var filteredBinPrims = this.BinPrimitives.filter(b => b.BrushIndex != allBrushIndex && b.DataValue != 0.0);
filteredBinPrims.reduce((sum, fbp) => {
if (histoBox.ChartType == ChartType.VerticalBar) {
- if (this.histoOp.X.AggregateFunction == AggregateFunction.Count) {
+ if (this.histoOp.Y.AggregateFunction == AggregateFunction.Count) {
fbp.Rect = new PIXIRectangle(fbp.Rect.x, fbp.Rect.y - sum, fbp.Rect.width, fbp.Rect.height);
fbp.MarginRect = new PIXIRectangle(fbp.MarginRect.x, fbp.MarginRect.y - sum, fbp.MarginRect.width, fbp.MarginRect.height);
return sum + fbp.Rect.height;
@@ -269,6 +269,9 @@ export class HistogramBinPrimitiveCollection {
private createVerticalBarChartBinPrimitives(bin: Bin, brush: Brush, binBrushMaxAxis: number, normalization: number): number {
let dataValue = this.histoOp.getValue(1, bin, this.histoResult, brush.brushIndex!);
if (dataValue != undefined) {
+ if (bin.binIndex!.indices![0] == 0 && bin.binIndex!.indices![1] == 0) {
+ console.log("DV = " + dataValue)
+ }
let [yFrom, yValue, yTo] = this.sizeConverter.DataToScreenNormalizedRange(dataValue, normalization, 1, binBrushMaxAxis);
let [xFrom, xTo] = this.sizeConverter.DataToScreenXAxisRange(this._histoBox.VisualBinRanges, 0, bin);