@gisce/ooui 0.4.0 → 0.4.1

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.
@@ -3,7 +3,7 @@ import { Graph, GraphType } from "./Graph";
3
3
  export declare class GraphChart extends Graph {
4
4
  _x: GraphAxis | undefined;
5
5
  get x(): GraphAxis | undefined;
6
- _y: GraphAxis | undefined;
7
- get y(): GraphAxis | undefined;
6
+ _y: GraphAxis[] | undefined;
7
+ get y(): GraphAxis[] | undefined;
8
8
  constructor(type: GraphType, element: HTMLElement);
9
9
  }
@@ -1,6 +1,6 @@
1
1
  import { GraphAxis } from ".";
2
2
  export declare type XYAxis = {
3
- x: GraphAxis;
4
- y: GraphAxis;
3
+ x: GraphAxis | undefined;
4
+ y: GraphAxis[];
5
5
  };
6
6
  export declare const parseXYAxis: (nodes: NodeListOf<ChildNode>) => XYAxis;
@@ -1,6 +1,6 @@
1
1
  import { GraphAxis } from ".";
2
2
  export var parseXYAxis = function (nodes) {
3
- var xyAxis = {};
3
+ var xyAxis = { x: undefined, y: [] };
4
4
  Array.prototype.forEach.call(nodes, function (child) {
5
5
  if (child.nodeType === child.ELEMENT_NODE) {
6
6
  if (child.nodeName === "field") {
@@ -25,7 +25,7 @@ export var parseXYAxis = function (nodes) {
25
25
  xyAxis.x = graphAxis;
26
26
  }
27
27
  else if (axis === "y") {
28
- xyAxis.y = graphAxis;
28
+ xyAxis.y.push(graphAxis);
29
29
  }
30
30
  }
31
31
  });
@@ -1 +1 @@
1
- {"version":3,"file":"graphHelper.js","sourceRoot":"","sources":["../../src/Graph/graphHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,SAAS,EAAY,MAAM,GAAG,CAAC;AAQ9C,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,KAA4B;IACtD,IAAM,MAAM,GAAQ,EAAE,CAAC;IAEvB,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,UAAC,K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dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,8 +8,8 @@ export class GraphChart extends Graph {
8
8
  return this._x;
9
9
  }
10
10
 
11
- _y: GraphAxis | undefined;
12
- get y(): GraphAxis | undefined {
11
+ _y: GraphAxis[] | undefined;
12
+ get y(): GraphAxis[] | undefined {
13
13
  return this._y;
14
14
  }
15
15
  constructor(type: GraphType, element: HTMLElement) {
@@ -1,13 +1,12 @@
1
1
  import { Axis, GraphAxis, Operator } from ".";
2
- import { Label } from "..";
3
2
 
4
3
  export type XYAxis = {
5
- x: GraphAxis;
6
- y: GraphAxis;
4
+ x: GraphAxis | undefined;
5
+ y: GraphAxis[];
7
6
  };
8
7
 
9
8
  export const parseXYAxis = (nodes: NodeListOf<ChildNode>): XYAxis => {
10
- const xyAxis: any = {};
9
+ const xyAxis: XYAxis = { x: undefined, y: [] };
11
10
 
12
11
  Array.prototype.forEach.call(nodes, (child: Element) => {
13
12
  if (child.nodeType === child.ELEMENT_NODE) {
@@ -36,7 +35,7 @@ export const parseXYAxis = (nodes: NodeListOf<ChildNode>): XYAxis => {
36
35
  if (axis === "x") {
37
36
  xyAxis.x = graphAxis;
38
37
  } else if (axis === "y") {
39
- xyAxis.y = graphAxis;
38
+ xyAxis.y.push(graphAxis);
40
39
  }
41
40
  }
42
41
  });
@@ -1,4 +1,4 @@
1
- import { GraphIndicator, GraphChart, parseGraph } from "..";
1
+ import { GraphIndicator, GraphChart, parseGraph, GraphAxis } from "..";
2
2
 
3
3
  describe("A Graph", () => {
4
4
  it("should parse a basic XML title and type indicator", () => {
@@ -22,14 +22,16 @@ describe("A Graph", () => {
22
22
  `;
23
23
 
24
24
  const graph = parseGraph(xml) as GraphChart;
25
+ const y: GraphAxis = graph.y![0];
26
+
25
27
  expect(graph.type).toBe("line");
26
28
  expect(graph.x).toBeDefined();
27
29
  expect(graph.y).toBeDefined();
28
30
  expect(graph.x?.name).toBe("data_alta");
29
- expect(graph.y?.name).toBe("data_alta");
31
+ expect(y.name).toBe("data_alta");
30
32
  expect(graph.x?.axis).toBe("x");
31
- expect(graph.y?.axis).toBe("y");
33
+ expect(y.axis).toBe("y");
32
34
  expect(graph.x?.operator).toBeNull();
33
- expect(graph.y?.operator).toBe("+");
35
+ expect(y.operator).toBe("+");
34
36
  });
35
37
  });