Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
229 changes: 229 additions & 0 deletions tsp-typescript-client/fixtures/tsp-client/fetch-generic-xy-0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
{
"model": {
"title": "Function Density View",
"series": [
{
"seriesId": 3,
"seriesName": "15652",
"xValues": [
[
0,
604229397
],
[
604229398,
1208458795
],
[
1208458796,
1812688193
],
[
1812688194,
2416917590
],
[
2416917591,
3021146988
]
],
"yValues": [
3.0,
0.0,
0.0,
0.0,
1.0
],
"style": {
"parentKey": null,
"values": {
"series-type": "bar"
}
},
"xValuesDescription": {
"dataType": "DURATION",
"unit": "ns",
"axisDomain": {
"type": "range",
"start": 0,
"end": 3021146988
},
"label": "Execution Time"
},
"yValuesDescription": {
"dataType": "NUMBER",
"unit": "",
"axisDomain": null,
"label": "Number of Executions"
}
},
{
"seriesId": 4,
"seriesName": "15653",
"xValues": [
[
0,
604229397
],
[
604229398,
1208458795
],
[
1208458796,
1812688193
],
[
1812688194,
2416917590
],
[
2416917591,
3021146988
]
],
"yValues": [
3.0,
0.0,
0.0,
0.0,
1.0
],
"style": {
"parentKey": null,
"values": {
"series-type": "bar"
}
},
"xValuesDescription": {
"dataType": "DURATION",
"unit": "ns",
"axisDomain": {
"type": "range",
"start": 0,
"end": 3021146988
},
"label": "Execution Time"
},
"yValuesDescription": {
"dataType": "NUMBER",
"unit": "",
"axisDomain": null,
"label": "Number of Executions"
}
},
{
"seriesId": 2,
"seriesName": "15646",
"xValues": [
[
0,
604229397
],
[
604229398,
1208458795
],
[
1208458796,
1812688193
],
[
1812688194,
2416917590
],
[
2416917591,
3021146988
]
],
"yValues": [
3.0,
0.0,
0.0,
0.0,
1.0
],
"style": {
"parentKey": null,
"values": {
"series-type": "bar"
}
},
"xValuesDescription": {
"dataType": "DURATION",
"unit": "ns",
"axisDomain": {
"type": "range",
"start": 0,
"end": 3021146988
},
"label": "Execution Time"
},
"yValuesDescription": {
"dataType": "NUMBER",
"unit": "",
"axisDomain": null,
"label": "Number of Executions"
}
},
{
"seriesId": 1,
"seriesName": "15647",
"xValues": [
[
0,
604229397
],
[
604229398,
1208458795
],
[
1208458796,
1812688193
],
[
1812688194,
2416917590
],
[
2416917591,
3021146988
]
],
"yValues": [
3.0,
0.0,
0.0,
0.0,
1.0
],
"style": {
"parentKey": null,
"values": {
"series-type": "bar"
}
},
"xValuesDescription": {
"dataType": "DURATION",
"unit": "ns",
"axisDomain": {
"type": "range",
"start": 0,
"end": 3021146988
},
"label": "Execution Time"
},
"yValuesDescription": {
"dataType": "NUMBER",
"unit": "",
"axisDomain": null,
"label": "Number of Executions"
}
}
]
},
"statusMessage": "Completed",
"status": "COMPLETED"
}
54 changes: 54 additions & 0 deletions tsp-typescript-client/fixtures/tsp-client/fetch-generic-xy-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"model": {
"title": "Function Density View",
"series": [
{
"seriesId": 3,
"seriesName": "15652",
"xValues": [
"red",
"blue",
"green",
"yellow",
"black"
],
"yValues": [
3.0,
0.0,
0.0,
0.0,
1.0
],
"style": {
"parentKey": null,
"values": {
"series-type": "bar"
}
},
"xValuesDescription": {
"dataType": "STRING",
"unit": "",
"axisDomain": {
"type": "categorical",
"categories": [
"red",
"blue",
"green",
"yellow",
"black"
]
},
"label": "Execution Time"
},
"yValuesDescription": {
"dataType": "NUMBER",
"unit": "",
"axisDomain": null,
"label": "Number of Executions"
}
}
]
},
"statusMessage": "Completed",
"status": "COMPLETED"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"model": {
"autoExpandLevel": -1,
"entries": [
{
"id": 0,
"parentId": -1,
"style": null,
"labels": [
"ls_ust"
],
"hasData": true
},
{
"id": 1,
"parentId": 0,
"style": null,
"labels": [
"15647"
],
"hasData": true
},
{
"id": 2,
"parentId": 0,
"style": null,
"labels": [
"15646"
],
"hasData": true
},
{
"id": 3,
"parentId": 0,
"style": null,
"labels": [
"15652"
],
"hasData": true
},
{
"id": 4,
"parentId": 0,
"style": null,
"labels": [
"15653"
],
"hasData": true
}
],
"headers": []
},
"statusMessage": "Completed",
"status": "COMPLETED"
}
50 changes: 50 additions & 0 deletions tsp-typescript-client/src/models/axis-domain.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { createNormalizer, toBigInt } from '../protocol/serialization';

/**
* Represent a categorical axis domain.
*
* Example categories: ["blue", "green", "yellow"]
*/
export interface AxisDomainCategorical {
type: 'categorical'; categories: string[];
}

/**
* Represent a ranged axis domain.
*/
export interface AxisDomainRange {
type: 'range'; start: bigint; end: bigint;
}

/**
* Represent an axis domain, which can be either ranged or categorical.
*/
export type AxisDomain = AxisDomainCategorical | AxisDomainRange;

export function isAxisDomainRange(ad: AxisDomain | undefined | null): ad is AxisDomainRange {
return !!ad && ad.type === 'range';
}

export function isAxisDomainCategorical(ad: AxisDomain | undefined | null): ad is AxisDomainCategorical {
return !!ad && ad.type === 'categorical';
}

export const AxisDomainRange = createNormalizer<AxisDomainRange>({
start: toBigInt,
end: toBigInt,
});

export const AxisDomainCategorical = (v: unknown): AxisDomainCategorical => {
const x = v as any;
return { type: 'categorical', categories: Array.isArray(x?.categories) ? x.categories as string[] : [] };
};

export const AxisDomain = (v: unknown): AxisDomain => {
const x = v as any;
if (!x || typeof x !== 'object') throw new Error('AxisDomain: invalid value');
return x.type === 'range'
? AxisDomainRange(x)
: x.type === 'categorical'
? AxisDomainCategorical(x)
: (x as AxisDomain);
};
Loading