Skip to content
Snippets Groups Projects
Commit f603191e authored by Steve Reis's avatar Steve Reis
Browse files

Merge branch '42-integration-roc-result' into 'develop'

Resolve "Integration ROC Result"

Closes #42

See merge request sibmip/gateway!20
parents 8a2dd958 68959101
No related branches found
No related tags found
No related merge requests found
...@@ -6,5 +6,5 @@ export class ChartAxis { ...@@ -6,5 +6,5 @@ export class ChartAxis {
label?: string; label?: string;
@Field(() => [String], { nullable: true, defaultValue: [] }) @Field(() => [String], { nullable: true, defaultValue: [] })
categories: string[]; categories?: string[];
} }
import { createUnionType } from '@nestjs/graphql'; import { createUnionType } from '@nestjs/graphql';
import { GroupsResult } from '../groups-result.model'; import { GroupsResult } from '../groups-result.model';
import { HeatMapResult } from '../heat-map-result.model';
import { LineChartResult } from '../line-chart-result.model';
import { RawResult } from '../raw-result.model'; import { RawResult } from '../raw-result.model';
import { TableResult } from '../table-result.model'; import { TableResult } from '../table-result.model';
export const ResultUnion = createUnionType({ export const ResultUnion = createUnionType({
name: 'ResultUnion', name: 'ResultUnion',
types: () => [TableResult, RawResult, GroupsResult], types: () => [
TableResult,
RawResult,
GroupsResult,
HeatMapResult,
LineChartResult,
],
resolveType(value) { resolveType(value) {
if (value.headers) { if (value.headers) {
return TableResult; return TableResult;
...@@ -19,6 +27,14 @@ export const ResultUnion = createUnionType({ ...@@ -19,6 +27,14 @@ export const ResultUnion = createUnionType({
return GroupsResult; return GroupsResult;
} }
if (value.matrix) {
return HeatMapResult;
}
if (value.x) {
return LineChartResult;
}
return null; return null;
}, },
}); });
...@@ -10,9 +10,9 @@ export class HeatMapResult extends Result { ...@@ -10,9 +10,9 @@ export class HeatMapResult extends Result {
@Field(() => [[Number]]) @Field(() => [[Number]])
matrix: number[][]; matrix: number[][];
@Field(() => [ChartAxis]) @Field(() => ChartAxis)
xAxis: ChartAxis; xAxis: ChartAxis;
@Field(() => [ChartAxis]) @Field(() => ChartAxis)
yAxis: ChartAxis; yAxis: ChartAxis;
} }
import { Field, ObjectType, registerEnumType } from '@nestjs/graphql';
import { ChartAxis } from './common/chart-axis.model';
import { Result } from './common/result.model';
export enum LineType {
NORMAL,
DASHED,
}
registerEnumType(LineType, {
name: 'LineType',
});
@ObjectType()
export class ExtraLineInfo {
@Field()
label: string;
@Field(() => [String])
values: string[];
}
@ObjectType()
export class LineResult {
@Field()
label: string;
@Field(() => [Number])
x: number[];
@Field(() => [Number])
y: number[];
@Field(() => [ExtraLineInfo], { nullable: true, defaultValue: [] })
extraLineInfos?: ExtraLineInfo[];
@Field(() => LineType, { nullable: true, defaultValue: LineType.NORMAL })
type?: LineType;
}
@ObjectType()
export class LineChartResult extends Result {
@Field()
name: string;
@Field(() => ChartAxis, { nullable: true })
xAxis?: ChartAxis;
@Field(() => ChartAxis, { nullable: true })
yAxis?: ChartAxis;
@Field(() => [LineResult])
lines: LineResult[];
}
...@@ -63,7 +63,7 @@ type GroupResult { ...@@ -63,7 +63,7 @@ type GroupResult {
results: [ResultUnion!]! results: [ResultUnion!]!
} }
union ResultUnion = TableResult | RawResult | GroupsResult union ResultUnion = TableResult | RawResult | GroupsResult | HeatMapResult | LineChartResult
type TableResult { type TableResult {
name: String! name: String!
...@@ -84,6 +84,43 @@ type GroupsResult { ...@@ -84,6 +84,43 @@ type GroupsResult {
groups: [GroupResult!]! groups: [GroupResult!]!
} }
type HeatMapResult {
name: String!
matrix: [[Float!]!]!
xAxis: ChartAxis!
yAxis: ChartAxis!
}
type LineChartResult {
name: String!
xAxis: ChartAxis
yAxis: ChartAxis
lines: [LineResult!]!
}
type ChartAxis {
label: String
categories: [String!]
}
type ExtraLineInfo {
label: String!
values: [String!]!
}
type LineResult {
label: String!
x: [Float!]!
y: [Float!]!
extraLineInfos: [ExtraLineInfo!]
type: LineType
}
enum LineType {
NORMAL
DASHED
}
type Header { type Header {
name: String! name: String!
type: String! type: String!
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment