@gisce/ooui 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { GraphAxis } from ".";
|
|
2
2
|
import { Graph, GraphType } from "./Graph";
|
|
3
3
|
export declare class GraphChart extends Graph {
|
|
4
|
-
_x: GraphAxis
|
|
5
|
-
get x(): GraphAxis
|
|
6
|
-
_y: GraphAxis[]
|
|
7
|
-
get y(): GraphAxis[]
|
|
4
|
+
_x: GraphAxis;
|
|
5
|
+
get x(): GraphAxis;
|
|
6
|
+
_y: GraphAxis[];
|
|
7
|
+
get y(): GraphAxis[];
|
|
8
8
|
constructor(type: GraphType, element: HTMLElement);
|
|
9
9
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GraphAxis } from ".";
|
|
2
2
|
export var parseXYAxis = function (nodes) {
|
|
3
|
-
var
|
|
3
|
+
var yAxisElements = [];
|
|
4
|
+
var xAxis;
|
|
4
5
|
Array.prototype.forEach.call(nodes, function (child) {
|
|
5
6
|
if (child.nodeType === child.ELEMENT_NODE && child.nodeName === "field") {
|
|
6
7
|
var axis = child.getAttribute("axis");
|
|
@@ -20,13 +21,22 @@ export var parseXYAxis = function (nodes) {
|
|
|
20
21
|
label: label || undefined,
|
|
21
22
|
});
|
|
22
23
|
if (axis === "x") {
|
|
23
|
-
|
|
24
|
+
xAxis = graphAxis;
|
|
24
25
|
}
|
|
25
26
|
else if (axis === "y") {
|
|
26
|
-
|
|
27
|
+
yAxisElements.push(graphAxis);
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
|
-
|
|
31
|
+
if (!xAxis) {
|
|
32
|
+
throw new Error("No x axis found");
|
|
33
|
+
}
|
|
34
|
+
if (!yAxisElements.length) {
|
|
35
|
+
throw new Error("No y axis found. At least we need one y axis");
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
x: xAxis,
|
|
39
|
+
y: yAxisElements,
|
|
40
|
+
};
|
|
31
41
|
};
|
|
32
42
|
//# sourceMappingURL=graphHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphHelper.js","sourceRoot":"","sources":["../../src/Graph/graphHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,SAAS,EAAY,MAAM,GAAG,CAAC;AAO9C,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,KAA4B;IACtD,IAAM,
|
|
1
|
+
{"version":3,"file":"graphHelper.js","sourceRoot":"","sources":["../../src/Graph/graphHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,SAAS,EAAY,MAAM,GAAG,CAAC;AAO9C,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,KAA4B;IACtD,IAAM,aAAa,GAAgB,EAAE,CAAC;IACtC,IAAI,KAAK,CAAC;IAEV,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,UAAC,KAAc;QACjD,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO,EAAE;YACvE,IAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YACxC,IAAM,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;YAChD,IAAM,MAAI,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YACxC,IAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YAE1C,IAAI,CAAC,IAAI,EAAE;gBACT,MAAM,IAAI,KAAK,CAAC,WAAS,MAAI,0BAAuB,CAAC,CAAC;aACvD;YAED,IAAI,CAAC,MAAI,EAAE;gBACT,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;aACrD;YAED,IAAM,SAAS,GAAG,IAAI,SAAS,CAAC;gBAC9B,IAAI,EAAE,IAAY;gBAClB,IAAI,QAAA;gBACJ,QAAQ,EAAE,QAAoB;gBAC9B,KAAK,EAAE,KAAK,IAAI,SAAS;aAC1B,CAAC,CAAC;YAEH,IAAI,IAAI,KAAK,GAAG,EAAE;gBAChB,KAAK,GAAG,SAAS,CAAC;aACnB;iBAAM,IAAI,IAAI,KAAK,GAAG,EAAE;gBACvB,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aAC/B;SACF;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;KACpC;IAED,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACjE;IAED,OAAO;QACL,CAAC,EAAE,KAAK;QACR,CAAC,EAAE,aAAa;KACjB,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/Graph/GraphChart.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { Graph, GraphType } from "./Graph";
|
|
|
3
3
|
import { parseXYAxis } from "./graphHelper";
|
|
4
4
|
|
|
5
5
|
export class GraphChart extends Graph {
|
|
6
|
-
_x: GraphAxis
|
|
7
|
-
get x(): GraphAxis
|
|
6
|
+
_x: GraphAxis;
|
|
7
|
+
get x(): GraphAxis {
|
|
8
8
|
return this._x;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
_y: GraphAxis[]
|
|
12
|
-
get y(): GraphAxis[]
|
|
11
|
+
_y: GraphAxis[];
|
|
12
|
+
get y(): GraphAxis[] {
|
|
13
13
|
return this._y;
|
|
14
14
|
}
|
|
15
15
|
constructor(type: GraphType, element: HTMLElement) {
|
package/src/Graph/graphHelper.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Axis, GraphAxis, Operator } from ".";
|
|
2
2
|
|
|
3
3
|
export type XYAxis = {
|
|
4
|
-
x: GraphAxis
|
|
4
|
+
x: GraphAxis;
|
|
5
5
|
y: GraphAxis[];
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export const parseXYAxis = (nodes: NodeListOf<ChildNode>): XYAxis => {
|
|
9
|
-
const
|
|
9
|
+
const yAxisElements: GraphAxis[] = [];
|
|
10
|
+
let xAxis;
|
|
10
11
|
|
|
11
12
|
Array.prototype.forEach.call(nodes, (child: Element) => {
|
|
12
13
|
if (child.nodeType === child.ELEMENT_NODE && child.nodeName === "field") {
|
|
@@ -31,12 +32,23 @@ export const parseXYAxis = (nodes: NodeListOf<ChildNode>): XYAxis => {
|
|
|
31
32
|
});
|
|
32
33
|
|
|
33
34
|
if (axis === "x") {
|
|
34
|
-
|
|
35
|
+
xAxis = graphAxis;
|
|
35
36
|
} else if (axis === "y") {
|
|
36
|
-
|
|
37
|
+
yAxisElements.push(graphAxis);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
if (!xAxis) {
|
|
43
|
+
throw new Error("No x axis found");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!yAxisElements.length) {
|
|
47
|
+
throw new Error("No y axis found. At least we need one y axis");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
x: xAxis,
|
|
52
|
+
y: yAxisElements,
|
|
53
|
+
};
|
|
42
54
|
};
|