@tradingaction/coordinates 2.0.11 → 2.0.13

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,53 +1,53 @@
1
- import * as React from "react";
2
- import { strokeDashTypes } from "@tradingaction/core";
3
- interface PriceCoordinateProps {
4
- readonly arrowWidth?: number;
5
- readonly at?: "bottom" | "top" | "left" | "right";
6
- readonly displayFormat: (n: number) => string;
7
- readonly dx?: number;
8
- readonly fontFamily?: string;
9
- readonly fontSize?: number;
10
- readonly fill?: string | ((price: number) => string);
11
- readonly lineOpacity?: number;
12
- readonly lineStroke?: string;
13
- readonly opacity?: number;
14
- readonly orient?: "bottom" | "top" | "left" | "right";
15
- readonly price: number;
16
- readonly rectWidth?: number;
17
- readonly rectHeight?: number;
18
- readonly strokeDasharray?: strokeDashTypes;
19
- readonly stroke?: string;
20
- readonly strokeOpacity?: number;
21
- readonly strokeWidth?: number;
22
- readonly textFill?: string | ((price: number) => string);
23
- readonly yAxisPad?: number;
24
- }
25
- export declare class PriceCoordinate extends React.Component<PriceCoordinateProps> {
26
- static defaultProps: {
27
- displayFormat: (n: number | {
28
- valueOf(): number;
29
- }) => string;
30
- yAxisPad: number;
31
- rectWidth: number;
32
- rectHeight: number;
33
- orient: string;
34
- at: string;
35
- price: number;
36
- dx: number;
37
- arrowWidth: number;
38
- fill: string;
39
- opacity: number;
40
- lineOpacity: number;
41
- lineStroke: string;
42
- fontFamily: string;
43
- fontSize: number;
44
- textFill: string;
45
- strokeOpacity: number;
46
- strokeWidth: number;
47
- strokeDasharray: string;
48
- };
49
- render(): JSX.Element;
50
- private readonly drawOnCanvas;
51
- private readonly helper;
52
- }
53
- export {};
1
+ import * as React from "react";
2
+ import { strokeDashTypes } from "@tradingaction/core";
3
+ interface PriceCoordinateProps {
4
+ readonly arrowWidth?: number;
5
+ readonly at?: "bottom" | "top" | "left" | "right";
6
+ readonly displayFormat: (n: number) => string;
7
+ readonly dx?: number;
8
+ readonly fontFamily?: string;
9
+ readonly fontSize?: number;
10
+ readonly fill?: string | ((price: number) => string);
11
+ readonly lineOpacity?: number;
12
+ readonly lineStroke?: string;
13
+ readonly opacity?: number;
14
+ readonly orient?: "bottom" | "top" | "left" | "right";
15
+ readonly price: number;
16
+ readonly rectWidth?: number;
17
+ readonly rectHeight?: number;
18
+ readonly strokeDasharray?: strokeDashTypes;
19
+ readonly stroke?: string;
20
+ readonly strokeOpacity?: number;
21
+ readonly strokeWidth?: number;
22
+ readonly textFill?: string | ((price: number) => string);
23
+ readonly yAxisPad?: number;
24
+ }
25
+ export declare class PriceCoordinate extends React.Component<PriceCoordinateProps> {
26
+ static defaultProps: {
27
+ displayFormat: (n: number | {
28
+ valueOf(): number;
29
+ }) => string;
30
+ yAxisPad: number;
31
+ rectWidth: number;
32
+ rectHeight: number;
33
+ orient: string;
34
+ at: string;
35
+ price: number;
36
+ dx: number;
37
+ arrowWidth: number;
38
+ fill: string;
39
+ opacity: number;
40
+ lineOpacity: number;
41
+ lineStroke: string;
42
+ fontFamily: string;
43
+ fontSize: number;
44
+ textFill: string;
45
+ strokeOpacity: number;
46
+ strokeWidth: number;
47
+ strokeDasharray: string;
48
+ };
49
+ render(): JSX.Element;
50
+ private readonly drawOnCanvas;
51
+ private readonly helper;
52
+ }
53
+ export {};
@@ -1,81 +1,81 @@
1
- import { format } from "d3-format";
2
- import * as React from "react";
3
- import { getAxisCanvas, GenericChartComponent, functor } from "@tradingaction/core";
4
- import { drawOnCanvas } from "./EdgeCoordinateV3";
5
- export class PriceCoordinate extends React.Component {
6
- constructor() {
7
- super(...arguments);
8
- this.drawOnCanvas = (ctx, moreProps) => {
9
- const props = this.helper(this.props, moreProps);
10
- drawOnCanvas(ctx, props);
11
- };
12
- this.helper = (props, moreProps) => {
13
- const { chartConfig: { yScale }, width, } = moreProps;
14
- const [lowerYValue, upperYValue] = yScale.domain();
15
- const { price, stroke, strokeDasharray, strokeOpacity, strokeWidth } = props;
16
- const { orient, at, rectWidth, rectHeight, displayFormat, dx } = props;
17
- const { fill, opacity, fontFamily, fontSize, textFill, arrowWidth, lineOpacity, lineStroke } = props;
18
- const x1 = 0;
19
- const x2 = width;
20
- const edgeAt = at === "right" ? width : 0;
21
- const type = "horizontal";
22
- const y = yScale(price);
23
- const show = price <= upperYValue && price >= lowerYValue;
24
- const coordinate = displayFormat(yScale.invert(y));
25
- const hideLine = false;
26
- const coordinateProps = {
27
- coordinate,
28
- show,
29
- type,
30
- orient,
31
- edgeAt,
32
- hideLine,
33
- lineOpacity,
34
- lineStroke,
35
- lineStrokeDasharray: strokeDasharray,
36
- stroke,
37
- strokeOpacity,
38
- strokeWidth,
39
- fill: functor(fill)(price),
40
- textFill: functor(textFill)(price),
41
- opacity,
42
- fontFamily,
43
- fontSize,
44
- rectWidth,
45
- rectHeight,
46
- arrowWidth,
47
- dx,
48
- x1,
49
- x2,
50
- y1: y,
51
- y2: y,
52
- };
53
- return coordinateProps;
54
- };
55
- }
56
- render() {
57
- return (React.createElement(GenericChartComponent, { clip: false, canvasDraw: this.drawOnCanvas, canvasToDraw: getAxisCanvas, drawOn: ["pan"] }));
58
- }
59
- }
60
- PriceCoordinate.defaultProps = {
61
- displayFormat: format(".2f"),
62
- yAxisPad: 0,
63
- rectWidth: 50,
64
- rectHeight: 20,
65
- orient: "left",
66
- at: "left",
67
- price: 0,
68
- dx: 0,
69
- arrowWidth: 0,
70
- fill: "#BAB8b8",
71
- opacity: 1,
72
- lineOpacity: 0.2,
73
- lineStroke: "#000000",
74
- fontFamily: "-apple-system, system-ui, Roboto, 'Helvetica Neue', Ubuntu, sans-serif",
75
- fontSize: 13,
76
- textFill: "#FFFFFF",
77
- strokeOpacity: 1,
78
- strokeWidth: 1,
79
- strokeDasharray: "Solid",
80
- };
1
+ import { format } from "d3-format";
2
+ import * as React from "react";
3
+ import { getAxisCanvas, GenericChartComponent, functor } from "@tradingaction/core";
4
+ import { drawOnCanvas } from "./EdgeCoordinateV3";
5
+ export class PriceCoordinate extends React.Component {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.drawOnCanvas = (ctx, moreProps) => {
9
+ const props = this.helper(this.props, moreProps);
10
+ drawOnCanvas(ctx, props);
11
+ };
12
+ this.helper = (props, moreProps) => {
13
+ const { chartConfig: { yScale }, width, } = moreProps;
14
+ const [lowerYValue, upperYValue] = yScale.domain();
15
+ const { price, stroke, strokeDasharray, strokeOpacity, strokeWidth } = props;
16
+ const { orient, at, rectWidth, rectHeight, displayFormat, dx } = props;
17
+ const { fill, opacity, fontFamily, fontSize, textFill, arrowWidth, lineOpacity, lineStroke } = props;
18
+ const x1 = 0;
19
+ const x2 = width;
20
+ const edgeAt = at === "right" ? width : 0;
21
+ const type = "horizontal";
22
+ const y = yScale(price);
23
+ const show = price <= upperYValue && price >= lowerYValue;
24
+ const coordinate = displayFormat(yScale.invert(y));
25
+ const hideLine = false;
26
+ const coordinateProps = {
27
+ coordinate,
28
+ show,
29
+ type,
30
+ orient,
31
+ edgeAt,
32
+ hideLine,
33
+ lineOpacity,
34
+ lineStroke,
35
+ lineStrokeDasharray: strokeDasharray,
36
+ stroke,
37
+ strokeOpacity,
38
+ strokeWidth,
39
+ fill: functor(fill)(price),
40
+ textFill: functor(textFill)(price),
41
+ opacity,
42
+ fontFamily,
43
+ fontSize,
44
+ rectWidth,
45
+ rectHeight,
46
+ arrowWidth,
47
+ dx,
48
+ x1,
49
+ x2,
50
+ y1: y,
51
+ y2: y,
52
+ };
53
+ return coordinateProps;
54
+ };
55
+ }
56
+ render() {
57
+ return (React.createElement(GenericChartComponent, { clip: false, canvasDraw: this.drawOnCanvas, canvasToDraw: getAxisCanvas, drawOn: ["pan"] }));
58
+ }
59
+ }
60
+ PriceCoordinate.defaultProps = {
61
+ displayFormat: format(".2f"),
62
+ yAxisPad: 0,
63
+ rectWidth: 50,
64
+ rectHeight: 20,
65
+ orient: "left",
66
+ at: "left",
67
+ price: 0,
68
+ dx: 0,
69
+ arrowWidth: 0,
70
+ fill: "#BAB8b8",
71
+ opacity: 1,
72
+ lineOpacity: 0.2,
73
+ lineStroke: "#000000",
74
+ fontFamily: "-apple-system, system-ui, Roboto, 'Helvetica Neue', Ubuntu, sans-serif",
75
+ fontSize: 13,
76
+ textFill: "#FFFFFF",
77
+ strokeOpacity: 1,
78
+ strokeWidth: 1,
79
+ strokeDasharray: "Solid",
80
+ };
81
81
  //# sourceMappingURL=PriceCoordinate.js.map
package/lib/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export * from "./EdgeIndicator";
2
- export * from "./CrossHairCursor";
3
- export * from "./CurrentCoordinate";
4
- export * from "./Cursor";
5
- export * from "./MouseCoordinateX";
6
- export { MouseCoordinateXV2 } from "./MouseCoordinateXV2";
7
- export { MouseCoordinateY } from "./MouseCoordinateY";
8
- export * from "./PriceCoordinate";
1
+ export * from "./EdgeIndicator";
2
+ export * from "./CrossHairCursor";
3
+ export * from "./CurrentCoordinate";
4
+ export * from "./Cursor";
5
+ export * from "./MouseCoordinateX";
6
+ export { MouseCoordinateXV2 } from "./MouseCoordinateXV2";
7
+ export { MouseCoordinateY } from "./MouseCoordinateY";
8
+ export * from "./PriceCoordinate";
package/lib/index.js CHANGED
@@ -1,9 +1,9 @@
1
- export * from "./EdgeIndicator";
2
- export * from "./CrossHairCursor";
3
- export * from "./CurrentCoordinate";
4
- export * from "./Cursor";
5
- export * from "./MouseCoordinateX";
6
- export { MouseCoordinateXV2 } from "./MouseCoordinateXV2";
7
- export { MouseCoordinateY } from "./MouseCoordinateY";
8
- export * from "./PriceCoordinate";
1
+ export * from "./EdgeIndicator";
2
+ export * from "./CrossHairCursor";
3
+ export * from "./CurrentCoordinate";
4
+ export * from "./Cursor";
5
+ export * from "./MouseCoordinateX";
6
+ export { MouseCoordinateXV2 } from "./MouseCoordinateXV2";
7
+ export { MouseCoordinateY } from "./MouseCoordinateY";
8
+ export * from "./PriceCoordinate";
9
9
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradingaction/coordinates",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "Coordinates for react-financial-charts",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -38,12 +38,12 @@
38
38
  "watch": "tsc -p tsconfig.json --watch --preserveWatchOutput"
39
39
  },
40
40
  "dependencies": {
41
- "@tradingaction/core": "^2.0.11",
41
+ "@tradingaction/core": "^2.0.13",
42
42
  "d3-format": "^2.0.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": "^16.0.0 || ^17.0.0 || ^18.0.0",
46
46
  "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
47
47
  },
48
- "gitHead": "39459f6d0646b29204bf8b12282608c2c50dea75"
48
+ "gitHead": "9c9bc635a2291c8da0e1dd5befa4000e96d83119"
49
49
  }
@@ -1,14 +1,6 @@
1
1
  import { format } from "d3-format";
2
2
  import * as React from "react";
3
- import {
4
- first,
5
- functor,
6
- getAxisCanvas,
7
- GenericChartComponent,
8
- last,
9
- noop,
10
- strokeDashTypes,
11
- } from "@tradingaction/core";
3
+ import { first, functor, getAxisCanvas, GenericChartComponent, last, noop, strokeDashTypes } from "@tradingaction/core";
12
4
  import { drawOnCanvas } from "./EdgeCoordinateV3";
13
5
 
14
6
  export interface EdgeIndicatorProps {