aboutsummaryrefslogtreecommitdiff
path: root/src/client/northstar/operations
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-03-29 13:18:35 -0400
committerbob <bcz@cs.brown.edu>2019-03-29 13:18:35 -0400
commit1bd678851632bbbb302363574eb5e3e19dc343e9 (patch)
tree8526a6c84303f1dc5a5e284ec03c97cf3b3a6bac /src/client/northstar/operations
parentc3eea60fa586e8ff9cf59497c041044fd0143bb1 (diff)
reorganized and mostly working northstar histograms.
Diffstat (limited to 'src/client/northstar/operations')
-rw-r--r--src/client/northstar/operations/BaseOperation.ts4
-rw-r--r--src/client/northstar/operations/HistogramOperation.ts13
2 files changed, 10 insertions, 7 deletions
diff --git a/src/client/northstar/operations/BaseOperation.ts b/src/client/northstar/operations/BaseOperation.ts
index 7db6fcb91..94e0849af 100644
--- a/src/client/northstar/operations/BaseOperation.ts
+++ b/src/client/northstar/operations/BaseOperation.ts
@@ -10,9 +10,9 @@ export abstract class BaseOperation {
@observable public Error: string = "";
@observable public OverridingFilters: FilterModel[] = [];
- @observable public Result: Result | undefined;
+ @observable public Result?: Result = undefined;
@observable public ComputationStarted: boolean = false;
- public OperationReference: OperationReference | undefined = undefined;
+ public OperationReference?: OperationReference = undefined;
private static _nextId = 0;
public RequestSalt: string = "";
diff --git a/src/client/northstar/operations/HistogramOperation.ts b/src/client/northstar/operations/HistogramOperation.ts
index 6c7288d42..8a0f648f6 100644
--- a/src/client/northstar/operations/HistogramOperation.ts
+++ b/src/client/northstar/operations/HistogramOperation.ts
@@ -27,6 +27,8 @@ export class HistogramOperation extends BaseOperation implements IBaseFilterCons
@observable public V: AttributeTransformationModel;
@observable public BrusherModels: BrushLinkModel<HistogramOperation>[] = [];
@observable public BrushableModels: BrushLinkModel<HistogramOperation>[] = [];
+ @observable public SchemaName: string;
+ @computed public get Schema() { return CurrentUserUtils.GetNorthstarSchema(this.SchemaName); }
@action
public AddFilterModels(filterModels: FilterModel[]): void {
@@ -38,23 +40,24 @@ export class HistogramOperation extends BaseOperation implements IBaseFilterCons
}
public getValue(axis: number, bin: Bin, result: HistogramResult, brushIndex: number) {
- var aggregateKey = ModelHelpers.CreateAggregateKey(axis == 0 ? this.X : axis == 1 ? this.Y : this.V, result, brushIndex);
+ var aggregateKey = ModelHelpers.CreateAggregateKey(this.Schema!.distinctAttributeParameters, axis == 0 ? this.X : axis == 1 ? this.Y : this.V, result, brushIndex);
let dataValue = ModelHelpers.GetAggregateResult(bin, aggregateKey) as DoubleValueAggregateResult;
return dataValue != null && dataValue.hasResult ? dataValue.result : undefined;
}
- public static Empty = new HistogramOperation(new AttributeTransformationModel(new ColumnAttributeModel(new Attribute())), new AttributeTransformationModel(new ColumnAttributeModel(new Attribute())), new AttributeTransformationModel(new ColumnAttributeModel(new Attribute())));
+ public static Empty = new HistogramOperation("-empty schema-", new AttributeTransformationModel(new ColumnAttributeModel(new Attribute())), new AttributeTransformationModel(new ColumnAttributeModel(new Attribute())), new AttributeTransformationModel(new ColumnAttributeModel(new Attribute())));
Equals(other: Object): boolean {
throw new Error("Method not implemented.");
}
- constructor(x: AttributeTransformationModel, y: AttributeTransformationModel, v: AttributeTransformationModel, normalized?: number) {
+ constructor(schemaName: string, x: AttributeTransformationModel, y: AttributeTransformationModel, v: AttributeTransformationModel, normalized?: number) {
super();
this.X = x;
this.Y = y;
this.V = v;
this.Normalization = normalized ? normalized : -1;
+ this.SchemaName = schemaName;
}
@computed
@@ -93,7 +96,7 @@ export class HistogramOperation extends BaseOperation implements IBaseFilterCons
allAttributes = ArrayUtil.Distinct(allAttributes.filter(a => a.AggregateFunction !== AggregateFunction.None));
let numericDataTypes = [DataType.Int, DataType.Double, DataType.Float];
- let perBinAggregateParameters: AggregateParameters[] = ModelHelpers.GetAggregateParametersWithMargins(allAttributes);
+ let perBinAggregateParameters: AggregateParameters[] = ModelHelpers.GetAggregateParametersWithMargins(this.Schema!.distinctAttributeParameters, allAttributes);
let globalAggregateParameters: AggregateParameters[] = [];
[histoX, histoY]
.filter(a => a.AggregateFunction === AggregateFunction.None && ArrayUtil.Contains(numericDataTypes, a.AttributeModel.DataType))
@@ -112,7 +115,7 @@ export class HistogramOperation extends BaseOperation implements IBaseFilterCons
let [perBinAggregateParameters, globalAggregateParameters] = this.GetAggregateParameters(this.X, this.Y, this.V);
return new HistogramOperationParameters({
enableBrushComputation: true,
- adapterName: CurrentUserUtils.ActiveSchema!.displayName,
+ adapterName: this.SchemaName,
filter: this.FilterString,
brushes: this.BrushString,
binningParameters: [ModelHelpers.GetBinningParameters(this.X, SETTINGS_X_BINS, this.QRange ? this.QRange.minValue : undefined, this.QRange ? this.QRange.maxValue : undefined),