@graphysdk/geom-candlestick 0.1.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.
package/LICENSE.md ADDED
@@ -0,0 +1,17 @@
1
+ # License
2
+
3
+ This software is available under any of the following licenses, at your option,
4
+ depending on which one's conditions you meet:
5
+
6
+ - **PolyForm Noncommercial 1.0.0** — for noncommercial use (personal,
7
+ charitable, educational, research, government).
8
+ See [licenses/PolyForm-NonCommercial-1.0.0.md](licenses/PolyForm-NonCommercial-1.0.0.md)
9
+
10
+ - **PolyForm Small Business 1.0.0** — free commercial use for organizations
11
+ under the size thresholds defined in the license.
12
+ See [licenses/PolyForm-Small-Business-1.0.0.md](licenses/PolyForm-Small-Business-1.0.0.md)
13
+
14
+ - **PolyForm Free Trial 1.0.0** — a 32-day evaluation for anyone else.
15
+ See [licenses/PolyForm-Free-Trial-1.0.0.md](licenses/PolyForm-Free-Trial-1.0.0.md)
16
+
17
+ For commercial use beyond these terms, contact [hello@graphy.dev](mailto:hello@graphy.dev) or visit [https://graphy.dev](https://graphy.dev).
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @graphysdk/geom-candlestick
2
+
3
+ > **Beta.** This geom is on a `0.x` version line: a minor release may change its aesthetics, style parts or look. Use a caret range (`^0.1.0`) to take only patches.
4
+
5
+ A candlestick geom for the Graphy charting SDK. It draws each trading session's open, high, low and close as a body between the open and close and a wick from the low to the high, coloured by whether the session rose or fell.
6
+
7
+ Learn more at [graphy.dev](https://graphy.dev).
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @graphysdk/geom-candlestick @graphysdk/react
13
+ ```
14
+
15
+ Requires React 19. Its only peer is `@graphysdk/react`.
16
+
17
+ ## Usage
18
+
19
+ Data is one row per session. Map the session to `x`, and the four prices to `open`, `high`, `low` and `close`:
20
+
21
+ ```tsx
22
+ import { createGraphyKit, GraphRenderer } from '@graphysdk/react';
23
+ import { candlestick } from '@graphysdk/geom-candlestick';
24
+
25
+ const kit = createGraphyKit({ plugins: [candlestick] });
26
+
27
+ const spec = kit.pipe(
28
+ kit.createSpec({ x: 'date' }),
29
+ kit.geom.candlestick({ aes: { open: 'open', high: 'high', low: 'low', close: 'close' } }),
30
+ kit.scale.x.discrete(),
31
+ kit.scale.y.continuous()
32
+ );
33
+
34
+ export function Prices({ data }) {
35
+ return (
36
+ <kit.GraphProvider spec={spec} data={data}>
37
+ <GraphRenderer />
38
+ </kit.GraphProvider>
39
+ );
40
+ }
41
+ ```
42
+
43
+ Set `params: { width }` to change how much of its band each body spans, a fraction in `(0, 1]` defaulting to `0.6`, as on a bar.
44
+
45
+ The close is the candle's `y`, so a highlight or headline that reads `y` reads the close. A `y` in the root mapping is ignored on the candlestick layer, with a warning.
46
+
47
+ Colour the sessions with `kit.style.geom.candlestick.rising()` and `kit.style.geom.candlestick.falling()`, the wicks with `kit.style.geom.candlestick.wick()`, and the bodies' shared look with `kit.style.geom.candlestick()`.
48
+
49
+ `color` is opt-in. Map it to `candlestickDirection` to colour the directions through a colour scale with a legend, or to a data column to colour the candles by its groups. A mapped colour beats the direction parts' built-in look and `defaults` entries; an `overrides` entry beats it.
50
+
51
+ ## Docs
52
+
53
+ - [Candlestick](https://docs.graphy.dev/sdk-next/graph-types/candlestick)
54
+
55
+ ## Feedback
56
+
57
+ This geom is released early to hear what works. Tell us on [Discord](https://discord.gg/yGmYCjkSr).
58
+
59
+ ## Licence
60
+
61
+ This package is available under PolyForm Noncommercial, Small Business, or a 32-day Free Trial. Free Trial is local or internal evaluation only — it does not cover a public page. See [what you can do under the trial](https://docs.graphy.dev/licence/evaluation).
62
+
63
+ For a commercial licence, [talk to us](https://graphy.dev/license).
@@ -0,0 +1,114 @@
1
+ import { AnchorContext, AnchorPosition, GeomCompileResult, GeomCompilerInput, GeomMappingValidationInput, GeomObservationPart, GeomStylePart, GeomStyleTarget, Observation, UserInputIssue, Geom } from '@graphysdk/react';
2
+ /** Candlestick parameters. `width` is geometry: it sets how much of the band the compiler gives each body. */
3
+ interface CandlestickGeomParams {
4
+ /** Body width as a fraction of the band the discrete scale allocates to the session, in `(0, 1]`. */
5
+ width?: number;
6
+ }
7
+ /** The body's own paint, under the colour its direction gives it. */
8
+ declare const BODY_VOCABULARY: {
9
+ readonly alpha: "unitInterval";
10
+ readonly fillAlpha: "unitInterval";
11
+ readonly strokeWidth: "pixels";
12
+ };
13
+ declare const DIRECTION_VOCABULARY: {
14
+ readonly fill: "color";
15
+ readonly stroke: "color";
16
+ };
17
+ declare const WICK_VOCABULARY: {
18
+ readonly stroke: "color";
19
+ readonly alpha: "unitInterval";
20
+ readonly strokeWidth: "pixels";
21
+ readonly dashArray: "dashArray";
22
+ };
23
+ /** Named so the published types reach the observations and every part through `@graphysdk/react`, the package's one peer. */
24
+ interface CandlestickStyleTarget extends GeomStyleTarget {
25
+ observation: GeomObservationPart<typeof BODY_VOCABULARY> & {
26
+ sharedPaint: false;
27
+ };
28
+ parts: {
29
+ rising: GeomStylePart<typeof DIRECTION_VOCABULARY>;
30
+ falling: GeomStylePart<typeof DIRECTION_VOCABULARY>;
31
+ wick: GeomStylePart<typeof WICK_VOCABULARY>;
32
+ };
33
+ }
34
+ /**
35
+ * A candlestick: one candle per trading session, a body between its open and close and a wick from its low to
36
+ * its high, coloured by whether the session rose or fell.
37
+ *
38
+ * Data is one row per session: `x` is the session and `open`, `high`, `low` and `close` its prices. The wick is
39
+ * the y interval, so it drives the price axis; open and close are scaled on the same axis. The sessions sit one
40
+ * per band, so a gap in trading (a weekend) takes no room. A horizontal candlestick is `coord.flip()`.
41
+ */
42
+ export declare class CandlestickGeom extends Geom<CandlestickGeomParams> {
43
+ readonly type: "candlestick";
44
+ readonly defaultParams: CandlestickGeomParams;
45
+ readonly derivedVariables: "candlestickDirection"[];
46
+ /** Opt-in: unmapped, the direction parts give each candle its colour and no legend is drawn. */
47
+ readonly aesthetics: readonly [{
48
+ readonly kind: "visual";
49
+ readonly name: "color";
50
+ }];
51
+ readonly positionRoles: readonly [{
52
+ readonly axis: "x";
53
+ readonly role: "point";
54
+ readonly valueKind: "value";
55
+ }, {
56
+ readonly axis: "y";
57
+ readonly role: "min";
58
+ readonly valueKind: "value";
59
+ readonly aes: "low";
60
+ }, {
61
+ readonly axis: "y";
62
+ readonly role: "max";
63
+ readonly valueKind: "value";
64
+ readonly aes: "high";
65
+ }, {
66
+ readonly axis: "y";
67
+ readonly role: "scalar";
68
+ readonly valueKind: "value";
69
+ readonly aes: "open";
70
+ }, {
71
+ readonly axis: "y";
72
+ readonly role: "scalar";
73
+ readonly valueKind: "value";
74
+ readonly aes: "close";
75
+ }];
76
+ /** One candle per session, so there is nothing to dodge or stack. */
77
+ readonly supportedPositions: readonly ["identity"];
78
+ readonly supportedCoordTypes: readonly ["cartesian", "flip"];
79
+ /** The price axis fits the data: a candle encodes where prices sat, not a length from zero. */
80
+ readonly scaleConstraints: {
81
+ discreteMainAxis: boolean;
82
+ };
83
+ /**
84
+ * A hovered session is one unit. The wick runs from its low to its high inside the band, so the whole of it
85
+ * takes a press for the session, and no stroke runs on to the next one.
86
+ */
87
+ readonly spatialKind = "spanned-buckets";
88
+ readonly highlightStrategy: "observation-rerender";
89
+ /**
90
+ * The tooltip shows the session's four prices, as written in the data and formatted like the price axis, each
91
+ * labelled by its mapped column.
92
+ */
93
+ readonly tooltip: {
94
+ aes: "low" | "high" | "close" | "open";
95
+ }[];
96
+ readonly styleTarget: CandlestickStyleTarget;
97
+ /** A body spans `width` of its band, so an axis annotation aligned to an edge lands where the bodies end. */
98
+ readonly resolveBandFraction: Geom['resolveBandFraction'];
99
+ /**
100
+ * Substitutes an undrawable `width` and reports it, so the same spec can't diverge across renderers. Above `1`
101
+ * a body would overlap its neighbours, so it clamps to the full band; at or below `0` nothing is drawable, so
102
+ * the default takes over.
103
+ */
104
+ resolveParams(options: Parameters<Geom['resolveParams']>[0]): Record<string, unknown>;
105
+ /** Open and close are scalar positions, which no role requires, and a candle cannot be drawn without them. */
106
+ readonly validateMapping: ({ mapping }: GeomMappingValidationInput) => readonly UserInputIssue[];
107
+ /**
108
+ * Where the editor raises its annotation trigger and where an annotation on a candle lands: on the close, at
109
+ * the band centre, which is the price a session is read at.
110
+ */
111
+ readonly resolveAnchorPosition: (observation: Observation, { coordSystem }: AnchorContext) => AnchorPosition | null;
112
+ compile({ data, mapping, params }: GeomCompilerInput): GeomCompileResult;
113
+ }
114
+ export {};
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let i=require("@graphysdk/react"),v=require("react"),d=require("react/jsx-runtime");var x={direction:"candlestickDirection"},M=(t,e)=>{const o=e==="x"?(0,i.getX)(t):(0,i.getY)(t),r=e==="x"?(0,i.getXMin)(t):(0,i.getYMin)(t),s=e==="x"?(0,i.getXMax)(t):(0,i.getYMax)(t),n=e==="x"?(0,i.getYMin)(t):(0,i.getXMin)(t),l=e==="x"?(0,i.getYMax)(t):(0,i.getXMax)(t),c=(0,i.getScaledAesthetic)(t,"open"),a=(0,i.getScaledAesthetic)(t,"close");return o===null||r===null||s===null||n===null||l===null||c===null||a===null?null:{observation:t,band:o,bodyStart:r,bodyEnd:s,low:n,high:l,open:c,close:a,direction:t[x.direction]==="falling"?"falling":"rising"}},p=(t,e)=>{const o=[];for(const r of t){const s=M(r,e);s!==null&&o.push(s)}return o},A=1,B=1,_=.6,O=["open","high","low","close"],V={alpha:"unitInterval",fillAlpha:"unitInterval",strokeWidth:"pixels"},y={fill:"color",stroke:"color"},E={stroke:"color",alpha:"unitInterval",strokeWidth:"pixels",dashArray:"dashArray"},C=class extends i.Geom{constructor(...t){super(...t),this.type="candlestick",this.defaultParams={},this.derivedVariables=[x.direction],this.aesthetics=[{kind:"visual",name:"color"}],this.positionRoles=[{axis:"x",role:"point",valueKind:"value"},{axis:"y",role:"min",valueKind:"value",aes:"low"},{axis:"y",role:"max",valueKind:"value",aes:"high"},{axis:"y",role:"scalar",valueKind:"value",aes:"open"},{axis:"y",role:"scalar",valueKind:"value",aes:"close"}],this.supportedPositions=["identity"],this.supportedCoordTypes=["cartesian","flip"],this.scaleConstraints={discreteMainAxis:!0},this.spatialKind="spanned-buckets",this.highlightStrategy="observation-rerender",this.tooltip=O.map(e=>({aes:e})),this.styleTarget=(0,i.defineGeomStyleTarget)({observation:{vocabulary:V,sharedPaint:!1,aesthetics:{},rest:{alpha:1,fillAlpha:1,strokeWidth:A}},parts:{rising:{vocabulary:y,aesthetics:{fill:"color",stroke:"color"},rest:{fill:(0,i.token)("trendPositive"),stroke:(0,i.token)("trendPositive")}},falling:{vocabulary:y,aesthetics:{fill:"color",stroke:"color"},rest:{fill:(0,i.token)("trendNegative"),stroke:(0,i.token)("trendNegative")}},wick:{vocabulary:E,rest:{alpha:1,strokeWidth:B,dashArray:[]}}}}),this.resolveBandFraction=e=>f(e),this.validateMapping=({mapping:e})=>["open","close"].filter(o=>e[o]===void 0).map(o=>({code:"MISSING_AESTHETIC",message:`candlestick geom requires '${o}' to be mapped`})),this.resolveAnchorPosition=(e,{coordSystem:o})=>{const r=(0,i.readMainAxis)(o),s=M(e,r);return s===null?null:r==="x"?{x:s.band,y:s.close}:{x:s.close,y:s.band}}}resolveParams(t){const{width:e,...o}=super.resolveParams(t);if(e===void 0)return o;const r=typeof e=="number"&&Number.isFinite(e)?e:null;if(r!==null&&r>0&&r<=1)return{...o,width:r};const s=r!==null&&r>1?1:void 0;return t.diagnostics?.addWarning({code:"INVALID_GEOM_PARAM",message:`Candlestick width must be a fraction in (0, 1], got ${String(e)}; falling back to ${s??"the default band"}.`,context:{geom:this.type,param:"width",expected:"0 < width <= 1",actual:r??String(e)},suggestion:"Set params.width to a fraction of the session band in (0, 1]."}),{...o,...s!==void 0&&{width:s}}}compile({data:t,mapping:e,params:o}){const r=f(o)/2;return{data:T(t,b(e.open),b(e.close)).addConstantVariable(i.POSITION_VARIABLES.xMin,"numeric",-r).addConstantVariable(i.POSITION_VARIABLES.xMax,"numeric",r),mapping:{y:e.close}}}},f=({width:t})=>t??_,b=t=>t===void 0?null:typeof t=="string"?t:"variable"in t?t.variable:null,T=(t,e,o)=>{if(e===null||o===null||!t.hasVariable(e)||!t.hasVariable(o))return t;const r=t.getValues(e,{type:"numeric"}),s=t.getValues(o,{type:"numeric"}),n=r.map((l,c)=>{const a=s[c];return l===null||a===null||a===void 0?null:a>=l?"rising":"falling"});return t.addVariable(x.direction,"categorical",n)},D=5e-4,S=(t,e)=>{const o=(t.open+t.close)/2,r=Math.max(Math.abs(t.close-t.open),D)/2,s=(0,i.composePoint)(e,{main:t.bodyStart,cross:o-r}),n=(0,i.composePoint)(e,{main:t.bodyEnd,cross:o+r}),[l,c]=w((0,i.toViewBoxX)(s.x),(0,i.toViewBoxX)(n.x)),[a,h]=w((0,i.toViewBoxY)(s.y),(0,i.toViewBoxY)(n.y));return{x:l,y:a,width:c-l,height:h-a}},w=(t,e)=>t<=e?[t,e]:[e,t],W=({layer:t,coordSystem:e,panelRect:o,styleReaders:r})=>{const s=(0,i.readMainAxis)(e),n=p(t.data,s),l=r.part("wick"),c=l===void 0?[]:n.map(h=>{const u=P(h.band,h.low,s,o),g=P(h.band,h.high,s,o),I=l.get("strokeWidth",h.observation)??0;return{kind:"stroke",pathData:`M${u.x},${u.y}L${g.x},${g.y}`,width:I}}),a=n.map(h=>{const u=S(h,s),g=u.x*o.width;return{kind:"region",pathData:`M${g},${u.y*o.height}H${(u.x+u.width)*o.width}V${(u.y+u.height)*o.height}H${g}Z`}});return[...c,...a]},P=(t,e,o,r)=>{const s=(0,i.composePoint)(o,{main:t,cross:e});return(0,i.scalePointToPanel)((0,i.projectPointCartesian)(s.x,s.y),r)},k=t=>{const e=(0,i.createStableKeyGenerator)(t.data,t.mapping,t.id);return o=>e(o.observation)},m=({candles:t,mainAxis:e,styleReaders:o,getKey:r,isHovered:s=!1,shouldAnimateTransitions:n=!1})=>{const l=s?"hovered":void 0,c=o.part("wick");return(0,d.jsxs)(d.Fragment,{children:[c&&t.map(a=>(0,d.jsx)(j,{candle:a,mainAxis:e,readers:c,directionReaders:o.part(a.direction),state:l,shouldAnimateTransitions:n},r(a))),t.map(a=>(0,d.jsx)(Y,{candle:a,mainAxis:e,styleReaders:o,state:l,shouldAnimateTransitions:n},r(a)))]})},j=({candle:t,mainAxis:e,readers:o,directionReaders:r,state:s,shouldAnimateTransitions:n})=>{const l=(0,i.composePoint)(e,{main:t.band,cross:t.low}),c=(0,i.composePoint)(e,{main:t.band,cross:t.high}),a=o.get("strokeWidth",t.observation,s)??0,h=o.get("stroke",t.observation,s)??r?.get("stroke",t.observation,s);return(0,d.jsx)(i.GeomLine,{"data-testid":"candlestick-wick",x1:(0,i.toPercent)((0,i.toViewBoxX)(l.x)),y1:(0,i.toPercent)((0,i.toViewBoxY)(l.y)),x2:(0,i.toPercent)((0,i.toViewBoxX)(c.x)),y2:(0,i.toPercent)((0,i.toViewBoxY)(c.y)),stroke:h===void 0?void 0:(0,i.toPaintColor)(h),strokeOpacity:o.get("alpha",t.observation,s),strokeWidth:a,strokeDasharray:(0,i.toStrokeDasharray)(o.get("dashArray",t.observation,s),a),shouldAnimateTransitions:n})},Y=({candle:t,mainAxis:e,styleReaders:o,state:r,shouldAnimateTransitions:s})=>{const n=S(t,e),l=o.part(t.direction),c=l?.get("fill",t.observation,r),a=l?.get("stroke",t.observation,r);return(0,d.jsx)(i.GeomRect,{"data-testid":"candlestick-body",x:(0,i.toPercent)(n.x),y:(0,i.toPercent)(n.y),width:(0,i.toPercent)(n.width),height:(0,i.toPercent)(n.height),fill:c===void 0?void 0:(0,i.toPaintColor)(c),opacity:o.get("alpha",t.observation,r),fillOpacity:o.get("fillAlpha",t.observation,r),stroke:a===void 0?void 0:(0,i.toPaintColor)(a),strokeWidth:o.get("strokeWidth",t.observation,r),shouldAnimateTransitions:s})},K=({layer:t,sourceLayer:e,mainAxis:o,styleReaders:r})=>(0,d.jsx)(m,{candles:(0,v.useMemo)(()=>p(t.data,o),[t.data,o]),mainAxis:o,styleReaders:r,getKey:(0,v.useMemo)(()=>k(e),[e])}),H=({layer:t,primary:e,siblings:o,mainAxis:r,styleReaders:s})=>(0,d.jsx)("g",{"data-testid":"hovered-candles",children:(0,d.jsx)(m,{candles:p([e,...o].map(n=>n.observation),r),mainAxis:r,styleReaders:s,getKey:(0,v.useMemo)(()=>k(t),[t]),isHovered:!0})}),N=({layer:t,mainAxis:e,styleReaders:o,shouldAnimateTransitions:r,intro:s})=>{const n=(0,d.jsx)(m,{candles:(0,v.useMemo)(()=>p(t.data,e),[t.data,e]),mainAxis:e,styleReaders:o,getKey:(0,v.useMemo)(()=>k(t),[t]),shouldAnimateTransitions:r});return s?.type==="fade"?(0,d.jsx)(i.IntroFade,{intro:s,children:n}):n},X=(0,i.defineGeomRenderer)(new C,{coord:"cartesian",swatchShape:"square",guideMode:"band",render:({layer:t,coordSystem:e,styleReaders:o,shouldAnimateTransitions:r,intro:s})=>(0,d.jsx)(N,{layer:t,mainAxis:(0,i.readMainAxis)(e),styleReaders:o,shouldAnimateTransitions:r,intro:s}),renderHighlight:({layer:t,sourceLayer:e,coordSystem:o,styleReaders:r})=>(0,d.jsx)(K,{layer:t,sourceLayer:e,mainAxis:(0,i.readMainAxis)(o),styleReaders:r}),renderHover:({layer:t,primary:e,group:o,related:r,coordSystem:s,styleReaders:n})=>(0,d.jsx)(H,{layer:t,primary:e,siblings:[...o,...r],mainAxis:(0,i.readMainAxis)(s),styleReaders:n}),renderHoverCompanions:()=>null,getEditOutlineShapes:W});exports.CandlestickGeom=C;exports.candlestick=X;
@@ -0,0 +1,2 @@
1
+ export { CandlestickGeom } from './engine/candlestick.geom';
2
+ export { candlestick } from './renderer/candlestick';
package/dist/index.mjs ADDED
@@ -0,0 +1,317 @@
1
+ import { Geom as $, GeomLine as N, GeomRect as Y, IntroFade as L, POSITION_VARIABLES as P, composePoint as p, createStableKeyGenerator as G, defineGeomRenderer as X, defineGeomStyleTarget as R, getScaledAesthetic as S, getX as F, getXMax as M, getXMin as A, getY as U, getYMax as D, getYMin as E, projectPointCartesian as j, readMainAxis as v, scalePointToPanel as q, toPaintColor as b, toPercent as u, toStrokeDasharray as Z, toViewBoxX as y, toViewBoxY as m, token as f } from "@graphysdk/react";
2
+ import { useMemo as k } from "react";
3
+ import { Fragment as z, jsx as c, jsxs as J } from "react/jsx-runtime";
4
+ var w = { direction: "candlestickDirection" }, K = (t, e) => {
5
+ const r = e === "x" ? F(t) : U(t), i = e === "x" ? A(t) : E(t), o = e === "x" ? M(t) : D(t), a = e === "x" ? E(t) : A(t), s = e === "x" ? D(t) : M(t), l = S(t, "open"), n = S(t, "close");
6
+ return r === null || i === null || o === null || a === null || s === null || l === null || n === null ? null : {
7
+ observation: t,
8
+ band: r,
9
+ bodyStart: i,
10
+ bodyEnd: o,
11
+ low: a,
12
+ high: s,
13
+ open: l,
14
+ close: n,
15
+ direction: t[w.direction] === "falling" ? "falling" : "rising"
16
+ };
17
+ }, x = (t, e) => {
18
+ const r = [];
19
+ for (const i of t) {
20
+ const o = K(i, e);
21
+ o !== null && r.push(o);
22
+ }
23
+ return r;
24
+ }, Q = 1, tt = 1, et = 0.6, rt = [
25
+ "open",
26
+ "high",
27
+ "low",
28
+ "close"
29
+ ], it = {
30
+ alpha: "unitInterval",
31
+ fillAlpha: "unitInterval",
32
+ strokeWidth: "pixels"
33
+ }, _ = {
34
+ fill: "color",
35
+ stroke: "color"
36
+ }, ot = {
37
+ stroke: "color",
38
+ alpha: "unitInterval",
39
+ strokeWidth: "pixels",
40
+ dashArray: "dashArray"
41
+ }, at = class extends $ {
42
+ constructor(...t) {
43
+ super(...t), this.type = "candlestick", this.defaultParams = {}, this.derivedVariables = [w.direction], this.aesthetics = [{
44
+ kind: "visual",
45
+ name: "color"
46
+ }], this.positionRoles = [
47
+ {
48
+ axis: "x",
49
+ role: "point",
50
+ valueKind: "value"
51
+ },
52
+ {
53
+ axis: "y",
54
+ role: "min",
55
+ valueKind: "value",
56
+ aes: "low"
57
+ },
58
+ {
59
+ axis: "y",
60
+ role: "max",
61
+ valueKind: "value",
62
+ aes: "high"
63
+ },
64
+ {
65
+ axis: "y",
66
+ role: "scalar",
67
+ valueKind: "value",
68
+ aes: "open"
69
+ },
70
+ {
71
+ axis: "y",
72
+ role: "scalar",
73
+ valueKind: "value",
74
+ aes: "close"
75
+ }
76
+ ], this.supportedPositions = ["identity"], this.supportedCoordTypes = ["cartesian", "flip"], this.scaleConstraints = { discreteMainAxis: !0 }, this.spatialKind = "spanned-buckets", this.highlightStrategy = "observation-rerender", this.tooltip = rt.map((e) => ({ aes: e })), this.styleTarget = R({
77
+ observation: {
78
+ vocabulary: it,
79
+ sharedPaint: !1,
80
+ aesthetics: {},
81
+ rest: {
82
+ alpha: 1,
83
+ fillAlpha: 1,
84
+ strokeWidth: Q
85
+ }
86
+ },
87
+ parts: {
88
+ rising: {
89
+ vocabulary: _,
90
+ aesthetics: {
91
+ fill: "color",
92
+ stroke: "color"
93
+ },
94
+ rest: {
95
+ fill: f("trendPositive"),
96
+ stroke: f("trendPositive")
97
+ }
98
+ },
99
+ falling: {
100
+ vocabulary: _,
101
+ aesthetics: {
102
+ fill: "color",
103
+ stroke: "color"
104
+ },
105
+ rest: {
106
+ fill: f("trendNegative"),
107
+ stroke: f("trendNegative")
108
+ }
109
+ },
110
+ wick: {
111
+ vocabulary: ot,
112
+ rest: {
113
+ alpha: 1,
114
+ strokeWidth: tt,
115
+ dashArray: []
116
+ }
117
+ }
118
+ }
119
+ }), this.resolveBandFraction = (e) => B(e), this.validateMapping = ({ mapping: e }) => ["open", "close"].filter((r) => e[r] === void 0).map((r) => ({
120
+ code: "MISSING_AESTHETIC",
121
+ message: `candlestick geom requires '${r}' to be mapped`
122
+ })), this.resolveAnchorPosition = (e, { coordSystem: r }) => {
123
+ const i = v(r), o = K(e, i);
124
+ return o === null ? null : i === "x" ? {
125
+ x: o.band,
126
+ y: o.close
127
+ } : {
128
+ x: o.close,
129
+ y: o.band
130
+ };
131
+ };
132
+ }
133
+ resolveParams(t) {
134
+ const { width: e, ...r } = super.resolveParams(t);
135
+ if (e === void 0) return r;
136
+ const i = typeof e == "number" && Number.isFinite(e) ? e : null;
137
+ if (i !== null && i > 0 && i <= 1) return {
138
+ ...r,
139
+ width: i
140
+ };
141
+ const o = i !== null && i > 1 ? 1 : void 0;
142
+ return t.diagnostics?.addWarning({
143
+ code: "INVALID_GEOM_PARAM",
144
+ message: `Candlestick width must be a fraction in (0, 1], got ${String(e)}; falling back to ${o ?? "the default band"}.`,
145
+ context: {
146
+ geom: this.type,
147
+ param: "width",
148
+ expected: "0 < width <= 1",
149
+ actual: i ?? String(e)
150
+ },
151
+ suggestion: "Set params.width to a fraction of the session band in (0, 1]."
152
+ }), {
153
+ ...r,
154
+ ...o !== void 0 && { width: o }
155
+ };
156
+ }
157
+ compile({ data: t, mapping: e, params: r }) {
158
+ const i = B(r) / 2;
159
+ return {
160
+ data: nt(t, O(e.open), O(e.close)).addConstantVariable(P.xMin, "numeric", -i).addConstantVariable(P.xMax, "numeric", i),
161
+ mapping: { y: e.close }
162
+ };
163
+ }
164
+ }, B = ({ width: t }) => t ?? et, O = (t) => t === void 0 ? null : typeof t == "string" ? t : "variable" in t ? t.variable : null, nt = (t, e, r) => {
165
+ if (e === null || r === null || !t.hasVariable(e) || !t.hasVariable(r)) return t;
166
+ const i = t.getValues(e, { type: "numeric" }), o = t.getValues(r, { type: "numeric" }), a = i.map((s, l) => {
167
+ const n = o[l];
168
+ return s === null || n === null || n === void 0 ? null : n >= s ? "rising" : "falling";
169
+ });
170
+ return t.addVariable(w.direction, "categorical", a);
171
+ }, st = 5e-4, H = (t, e) => {
172
+ const r = (t.open + t.close) / 2, i = Math.max(Math.abs(t.close - t.open), st) / 2, o = p(e, {
173
+ main: t.bodyStart,
174
+ cross: r - i
175
+ }), a = p(e, {
176
+ main: t.bodyEnd,
177
+ cross: r + i
178
+ }), [s, l] = T(y(o.x), y(a.x)), [n, d] = T(m(o.y), m(a.y));
179
+ return {
180
+ x: s,
181
+ y: n,
182
+ width: l - s,
183
+ height: d - n
184
+ };
185
+ }, T = (t, e) => t <= e ? [t, e] : [e, t], lt = ({ layer: t, coordSystem: e, panelRect: r, styleReaders: i }) => {
186
+ const o = v(e), a = x(t.data, o), s = i.part("wick"), l = s === void 0 ? [] : a.map((d) => {
187
+ const h = W(d.band, d.low, o, r), g = W(d.band, d.high, o, r), V = s.get("strokeWidth", d.observation) ?? 0;
188
+ return {
189
+ kind: "stroke",
190
+ pathData: `M${h.x},${h.y}L${g.x},${g.y}`,
191
+ width: V
192
+ };
193
+ }), n = a.map((d) => {
194
+ const h = H(d, o), g = h.x * r.width;
195
+ return {
196
+ kind: "region",
197
+ pathData: `M${g},${h.y * r.height}H${(h.x + h.width) * r.width}V${(h.y + h.height) * r.height}H${g}Z`
198
+ };
199
+ });
200
+ return [...l, ...n];
201
+ }, W = (t, e, r, i) => {
202
+ const o = p(r, {
203
+ main: t,
204
+ cross: e
205
+ });
206
+ return q(j(o.x, o.y), i);
207
+ }, C = (t) => {
208
+ const e = G(t.data, t.mapping, t.id);
209
+ return (r) => e(r.observation);
210
+ }, I = ({ candles: t, mainAxis: e, styleReaders: r, getKey: i, isHovered: o = !1, shouldAnimateTransitions: a = !1 }) => {
211
+ const s = o ? "hovered" : void 0, l = r.part("wick");
212
+ return /* @__PURE__ */ J(z, { children: [l && t.map((n) => /* @__PURE__ */ c(dt, {
213
+ candle: n,
214
+ mainAxis: e,
215
+ readers: l,
216
+ directionReaders: r.part(n.direction),
217
+ state: s,
218
+ shouldAnimateTransitions: a
219
+ }, i(n))), t.map((n) => /* @__PURE__ */ c(ct, {
220
+ candle: n,
221
+ mainAxis: e,
222
+ styleReaders: r,
223
+ state: s,
224
+ shouldAnimateTransitions: a
225
+ }, i(n)))] });
226
+ }, dt = ({ candle: t, mainAxis: e, readers: r, directionReaders: i, state: o, shouldAnimateTransitions: a }) => {
227
+ const s = p(e, {
228
+ main: t.band,
229
+ cross: t.low
230
+ }), l = p(e, {
231
+ main: t.band,
232
+ cross: t.high
233
+ }), n = r.get("strokeWidth", t.observation, o) ?? 0, d = r.get("stroke", t.observation, o) ?? i?.get("stroke", t.observation, o);
234
+ return /* @__PURE__ */ c(N, {
235
+ "data-testid": "candlestick-wick",
236
+ x1: u(y(s.x)),
237
+ y1: u(m(s.y)),
238
+ x2: u(y(l.x)),
239
+ y2: u(m(l.y)),
240
+ stroke: d === void 0 ? void 0 : b(d),
241
+ strokeOpacity: r.get("alpha", t.observation, o),
242
+ strokeWidth: n,
243
+ strokeDasharray: Z(r.get("dashArray", t.observation, o), n),
244
+ shouldAnimateTransitions: a
245
+ });
246
+ }, ct = ({ candle: t, mainAxis: e, styleReaders: r, state: i, shouldAnimateTransitions: o }) => {
247
+ const a = H(t, e), s = r.part(t.direction), l = s?.get("fill", t.observation, i), n = s?.get("stroke", t.observation, i);
248
+ return /* @__PURE__ */ c(Y, {
249
+ "data-testid": "candlestick-body",
250
+ x: u(a.x),
251
+ y: u(a.y),
252
+ width: u(a.width),
253
+ height: u(a.height),
254
+ fill: l === void 0 ? void 0 : b(l),
255
+ opacity: r.get("alpha", t.observation, i),
256
+ fillOpacity: r.get("fillAlpha", t.observation, i),
257
+ stroke: n === void 0 ? void 0 : b(n),
258
+ strokeWidth: r.get("strokeWidth", t.observation, i),
259
+ shouldAnimateTransitions: o
260
+ });
261
+ }, ht = ({ layer: t, sourceLayer: e, mainAxis: r, styleReaders: i }) => /* @__PURE__ */ c(I, {
262
+ candles: k(() => x(t.data, r), [t.data, r]),
263
+ mainAxis: r,
264
+ styleReaders: i,
265
+ getKey: k(() => C(e), [e])
266
+ }), ut = ({ layer: t, primary: e, siblings: r, mainAxis: i, styleReaders: o }) => /* @__PURE__ */ c("g", {
267
+ "data-testid": "hovered-candles",
268
+ children: /* @__PURE__ */ c(I, {
269
+ candles: x([e, ...r].map((a) => a.observation), i),
270
+ mainAxis: i,
271
+ styleReaders: o,
272
+ getKey: k(() => C(t), [t]),
273
+ isHovered: !0
274
+ })
275
+ }), gt = ({ layer: t, mainAxis: e, styleReaders: r, shouldAnimateTransitions: i, intro: o }) => {
276
+ const a = /* @__PURE__ */ c(I, {
277
+ candles: k(() => x(t.data, e), [t.data, e]),
278
+ mainAxis: e,
279
+ styleReaders: r,
280
+ getKey: k(() => C(t), [t]),
281
+ shouldAnimateTransitions: i
282
+ });
283
+ return o?.type === "fade" ? /* @__PURE__ */ c(L, {
284
+ intro: o,
285
+ children: a
286
+ }) : a;
287
+ }, ft = X(new at(), {
288
+ coord: "cartesian",
289
+ swatchShape: "square",
290
+ guideMode: "band",
291
+ render: ({ layer: t, coordSystem: e, styleReaders: r, shouldAnimateTransitions: i, intro: o }) => /* @__PURE__ */ c(gt, {
292
+ layer: t,
293
+ mainAxis: v(e),
294
+ styleReaders: r,
295
+ shouldAnimateTransitions: i,
296
+ intro: o
297
+ }),
298
+ renderHighlight: ({ layer: t, sourceLayer: e, coordSystem: r, styleReaders: i }) => /* @__PURE__ */ c(ht, {
299
+ layer: t,
300
+ sourceLayer: e,
301
+ mainAxis: v(r),
302
+ styleReaders: i
303
+ }),
304
+ renderHover: ({ layer: t, primary: e, group: r, related: i, coordSystem: o, styleReaders: a }) => /* @__PURE__ */ c(ut, {
305
+ layer: t,
306
+ primary: e,
307
+ siblings: [...r, ...i],
308
+ mainAxis: v(o),
309
+ styleReaders: a
310
+ }),
311
+ renderHoverCompanions: () => null,
312
+ getEditOutlineShapes: lt
313
+ });
314
+ export {
315
+ at as CandlestickGeom,
316
+ ft as candlestick
317
+ };
@@ -0,0 +1,3 @@
1
+ import { EditOutlineShape, GeomEditOutlineShapesRendererInput } from '@graphysdk/react';
2
+ /** What point and edit outlines round the candles they take: each wick as the stroke it is painted, and each body as its box. */
3
+ export declare const getCandlestickEditOutlineShapes: ({ layer, coordSystem, panelRect, styleReaders, }: GeomEditOutlineShapesRendererInput) => EditOutlineShape[];
@@ -0,0 +1,11 @@
1
+ import { GeomStyleReaders, MainAxis, SceneLayer } from '@graphysdk/react';
2
+ interface HighlightedCandlesProps {
3
+ layer: SceneLayer;
4
+ /** The whole layer the matched observations were taken from. */
5
+ sourceLayer: SceneLayer;
6
+ mainAxis: MainAxis;
7
+ styleReaders: GeomStyleReaders;
8
+ }
9
+ /** Repaints the matched candles above the dimmed layer, each wick and body together. */
10
+ export declare const HighlightedCandles: ({ layer, sourceLayer, mainAxis, styleReaders }: HighlightedCandlesProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,12 @@
1
+ import { GeomStyleReaders, HoverHit, MainAxis, SceneLayer } from '@graphysdk/react';
2
+ interface HoveredCandlesProps {
3
+ layer: SceneLayer;
4
+ primary: HoverHit;
5
+ /** Any other candle of the hovered session, from duplicate rows. */
6
+ siblings: readonly HoverHit[];
7
+ mainAxis: MainAxis;
8
+ styleReaders: GeomStyleReaders;
9
+ }
10
+ /** The hovered session's candle, repainted above the dimmed layer. */
11
+ export declare const HoveredCandles: ({ layer, primary, siblings, mainAxis, styleReaders }: HoveredCandlesProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,15 @@
1
+ import { GeomStyleReaders, LayerIntroPlan, MainAxis, SceneLayer } from '@graphysdk/react';
2
+ interface CandlestickLayerProps {
3
+ layer: SceneLayer;
4
+ mainAxis: MainAxis;
5
+ styleReaders: GeomStyleReaders;
6
+ shouldAnimateTransitions: boolean;
7
+ intro: LayerIntroPlan | null | undefined;
8
+ }
9
+ /**
10
+ * The layer's own paint. The engine plans a plugin geom's entrance as a fade, so the whole layer comes up on
11
+ * one clock. The fade is independent of `shouldAnimateTransitions`: it rides the group rather than moving the
12
+ * candles, so it plays even when data changes snap.
13
+ */
14
+ export declare const CandlestickLayer: ({ layer, mainAxis, styleReaders, shouldAnimateTransitions, intro, }: CandlestickLayerProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,18 @@
1
+ import { GeomStyleReaders, MainAxis } from '@graphysdk/react';
2
+ import { Candle } from '../utils/read-candle';
3
+ /** What one pass paints: every wick below, every body above them. */
4
+ export interface CandlestickPaintProps {
5
+ candles: readonly Candle[];
6
+ mainAxis: MainAxis;
7
+ styleReaders: GeomStyleReaders;
8
+ /** What identifies each candle across a data change, so a spring moves a candle rather than swapping it. */
9
+ getKey: (candle: Candle) => string;
10
+ /** Paints in the `hovered` state. */
11
+ isHovered?: boolean;
12
+ /**
13
+ * Whether wicks and bodies spring to their new positions when the data changes. The hover and highlight
14
+ * repaints mount and unmount with the interaction, so only the layer's own paint animates.
15
+ */
16
+ shouldAnimateTransitions?: boolean;
17
+ }
18
+ export declare const CandlestickPaint: ({ candles, mainAxis, styleReaders, getKey, isHovered, shouldAnimateTransitions, }: CandlestickPaintProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { BoundGeomRendererDefinition } from '@graphysdk/react';
2
+ import { CandlestickGeom } from '../engine/candlestick.geom';
3
+ /**
4
+ * The candlestick plugin: pass it to `createGraphyKit({ plugins: [candlestick] })` for `kit.geom.candlestick()`.
5
+ *
6
+ * @example
7
+ * const kit = createGraphyKit({ plugins: [candlestick] });
8
+ * const spec = kit.pipe(
9
+ * kit.createSpec({ x: 'date' }),
10
+ * kit.geom.candlestick({ aes: { open: 'open', high: 'high', low: 'low', close: 'close' } }),
11
+ * kit.scale.x.discrete(),
12
+ * kit.scale.y.continuous()
13
+ * );
14
+ */
15
+ export declare const candlestick: BoundGeomRendererDefinition<CandlestickGeom>;
@@ -0,0 +1,11 @@
1
+ import { MainAxis } from '@graphysdk/react';
2
+ import { Candle } from '../../utils/read-candle';
3
+ /** A box in the `[0, 1]` view box, from its top left, y growing downward. */
4
+ export interface ViewBoxRect {
5
+ x: number;
6
+ y: number;
7
+ width: number;
8
+ height: number;
9
+ }
10
+ /** The body between the open and the close, across its share of the band. */
11
+ export declare const readBodyBox: (candle: Candle, mainAxis: MainAxis) => ViewBoxRect;
@@ -0,0 +1,7 @@
1
+ import { SceneLayer } from '@graphysdk/react';
2
+ import { Candle } from '../../utils/read-candle';
3
+ /**
4
+ * A candle keys on its session, read from the raw value rather than the band: the band moves with the domain,
5
+ * the very change a candle should spring through, not remount on.
6
+ */
7
+ export declare const createCandlestickKeys: (layer: SceneLayer) => ((candle: Candle) => string);
@@ -0,0 +1,11 @@
1
+ /** The column `compile()` writes and the renderer reads, beside the position columns. */
2
+ export declare const CANDLESTICK_COLUMNS: {
3
+ /**
4
+ * Whether the session closed at or above its open (`'rising'`) or below it (`'falling'`). Compared in prices
5
+ * rather than scaled positions, so a reversed price axis still paints a rise as a rise. Authors name it in a
6
+ * `highlight` or an entry's `where`, so it is part of the geom's API. A data column of the same name is
7
+ * replaced.
8
+ */
9
+ readonly direction: "candlestickDirection";
10
+ };
11
+ export type CandlestickDirection = 'rising' | 'falling';
@@ -0,0 +1,24 @@
1
+ import { MainAxis, Observation } from '@graphysdk/react';
2
+ import { CandlestickDirection } from './candlestick-columns';
3
+ /** A candle placed by its band on the main axis and its four prices on the other, each a `[0, 1]` fraction. */
4
+ export interface Candle {
5
+ observation: Observation;
6
+ /** Where the wick stands on the main axis: the session's band centre. */
7
+ band: number;
8
+ /** The body's two edges on the main axis. */
9
+ bodyStart: number;
10
+ bodyEnd: number;
11
+ low: number;
12
+ high: number;
13
+ open: number;
14
+ close: number;
15
+ direction: CandlestickDirection;
16
+ }
17
+ /**
18
+ * Reads where a candle sits. The flip is already baked into the position columns, so under `coord.flip()` the
19
+ * band is `y`/`yMin`/`yMax` and the wick runs `xMin` to `xMax`; the open and close are scaled on the price axis
20
+ * whatever the flip.
21
+ */
22
+ export declare const readCandle: (observation: Observation, mainAxis: MainAxis) => Candle | null;
23
+ /** Reads every candle of a layer, skipping a session missing a price. */
24
+ export declare const readCandles: (observations: Iterable<Observation>, mainAxis: MainAxis) => Candle[];
@@ -0,0 +1,93 @@
1
+ # PolyForm Free Trial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/free-trial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the software
14
+ to do everything you might do with the software that would
15
+ otherwise infringe the licensor's copyright in it for any
16
+ permitted purpose. However, you may only make changes or
17
+ new works based on the software according to [Changes and New
18
+ Works License](#changes-and-new-works-license), and you may
19
+ not distribute copies of the software.
20
+
21
+ ## Changes and New Works License
22
+
23
+ The licensor grants you an additional copyright license to
24
+ make changes and new works based on the software for any
25
+ permitted purpose.
26
+
27
+ ## Patent License
28
+
29
+ The licensor grants you a patent license for the software that
30
+ covers patent claims the licensor can license, or becomes able
31
+ to license, that you would infringe by using the software.
32
+
33
+ ## Fair Use
34
+
35
+ You may have "fair use" rights for the software under the
36
+ law. These terms do not limit them.
37
+
38
+ ## Free Trial
39
+
40
+ Use to evaluate whether the software suits a particular
41
+ application for less than 32 consecutive calendar days, on
42
+ behalf of you or your company, is use for a permitted purpose.
43
+
44
+ ## No Other Rights
45
+
46
+ These terms do not allow you to sublicense or transfer any of
47
+ your licenses to anyone else, or prevent the licensor from
48
+ granting licenses to anyone else. These terms do not imply
49
+ any other licenses.
50
+
51
+ ## Patent Defense
52
+
53
+ If you make any written claim that the software infringes or
54
+ contributes to infringement of any patent, your patent license
55
+ for the software granted under these terms ends immediately. If
56
+ your company makes such a claim, your patent license ends
57
+ immediately for work on behalf of your company.
58
+
59
+ ## Violations
60
+
61
+ If you violate any of these terms, or do anything with the
62
+ software not covered by your licenses, all your licenses
63
+ end immediately.
64
+
65
+ ## No Liability
66
+
67
+ _**As far as the law allows, the software comes as is, without
68
+ any warranty or condition, and the licensor will not be liable
69
+ to you for any damages arising out of these terms or the use
70
+ or nature of the software, under any kind of legal claim.**_
71
+
72
+ ## Definitions
73
+
74
+ The **licensor** is the individual or entity offering these
75
+ terms, and the **software** is the software the licensor makes
76
+ available under these terms.
77
+
78
+ **You** refers to the individual or entity agreeing to these
79
+ terms.
80
+
81
+ **Your company** is any legal entity, sole proprietorship,
82
+ or other kind of organization that you work for, plus all
83
+ organizations that have control over, are under the control of,
84
+ or are under common control with that organization. **Control**
85
+ means ownership of substantially all the assets of an entity,
86
+ or the power to direct its management and policies by vote,
87
+ contract, or otherwise. Control can be direct or indirect.
88
+
89
+ **Your licenses** are all the licenses granted to you for the
90
+ software under these terms.
91
+
92
+ **Use** means anything you do with the software requiring one
93
+ of your licenses.
@@ -0,0 +1,131 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Graphy Technologies Ltd. (https://graphy.dev)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Noncommercial Purposes
53
+
54
+ Any noncommercial purpose is a permitted purpose.
55
+
56
+ ## Personal Uses
57
+
58
+ Personal use for research, experiment, and testing for
59
+ the benefit of public knowledge, personal study, private
60
+ entertainment, hobby projects, amateur pursuits, or religious
61
+ observance, without any anticipated commercial application,
62
+ is use for a permitted purpose.
63
+
64
+ ## Noncommercial Organizations
65
+
66
+ Use by any charitable organization, educational institution,
67
+ public research organization, public safety or health
68
+ organization, environmental protection organization,
69
+ or government institution is use for a permitted purpose
70
+ regardless of the source of funding or obligations resulting
71
+ from the funding.
72
+
73
+ ## Fair Use
74
+
75
+ You may have "fair use" rights for the software under the
76
+ law. These terms do not limit them.
77
+
78
+ ## No Other Rights
79
+
80
+ These terms do not allow you to sublicense or transfer any of
81
+ your licenses to anyone else, or prevent the licensor from
82
+ granting licenses to anyone else. These terms do not imply
83
+ any other licenses.
84
+
85
+ ## Patent Defense
86
+
87
+ If you make any written claim that the software infringes or
88
+ contributes to infringement of any patent, your patent license
89
+ for the software granted under these terms ends immediately. If
90
+ your company makes such a claim, your patent license ends
91
+ immediately for work on behalf of your company.
92
+
93
+ ## Violations
94
+
95
+ The first time you are notified in writing that you have
96
+ violated any of these terms, or done anything with the software
97
+ not covered by your licenses, your licenses can nonetheless
98
+ continue if you come into full compliance with these terms,
99
+ and take practical steps to correct past violations, within
100
+ 32 days of receiving notice. Otherwise, all your licenses
101
+ end immediately.
102
+
103
+ ## No Liability
104
+
105
+ _**As far as the law allows, the software comes as is, without
106
+ any warranty or condition, and the licensor will not be liable
107
+ to you for any damages arising out of these terms or the use
108
+ or nature of the software, under any kind of legal claim.**_
109
+
110
+ ## Definitions
111
+
112
+ The **licensor** is the individual or entity offering these
113
+ terms, and the **software** is the software the licensor makes
114
+ available under these terms.
115
+
116
+ **You** refers to the individual or entity agreeing to these
117
+ terms.
118
+
119
+ **Your company** is any legal entity, sole proprietorship,
120
+ or other kind of organization that you work for, plus all
121
+ organizations that have control over, are under the control of,
122
+ or are under common control with that organization. **Control**
123
+ means ownership of substantially all the assets of an entity,
124
+ or the power to direct its management and policies by vote,
125
+ contract, or otherwise. Control can be direct or indirect.
126
+
127
+ **Your licenses** are all the licenses granted to you for the
128
+ software under these terms.
129
+
130
+ **Use** means anything you do with the software requiring one
131
+ of your licenses.
@@ -0,0 +1,121 @@
1
+ # PolyForm Small Business License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/small-business/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Graphy Technologies Ltd. (https://graphy.dev)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Fair Use
53
+
54
+ You may have "fair use" rights for the software under the
55
+ law. These terms do not limit them.
56
+
57
+ ## Small Business
58
+
59
+ Use of the software for the benefit of your company is use for
60
+ a permitted purpose if your company has fewer than 100 total
61
+ individuals working as employees and independent contractors,
62
+ and less than 1,000,000 USD (2019) total revenue in the prior
63
+ tax year. Adjust this revenue threshold for inflation according
64
+ to the United States Bureau of Labor Statistics' consumer price
65
+ index for all urban consumers, U.S. city average, for all items,
66
+ not seasonally adjusted, with 1982–1984=100 reference base.
67
+
68
+ ## No Other Rights
69
+
70
+ These terms do not allow you to sublicense or transfer any of
71
+ your licenses to anyone else, or prevent the licensor from
72
+ granting licenses to anyone else. These terms do not imply
73
+ any other licenses.
74
+
75
+ ## Patent Defense
76
+
77
+ If you make any written claim that the software infringes or
78
+ contributes to infringement of any patent, your patent license
79
+ for the software granted under these terms ends immediately. If
80
+ your company makes such a claim, your patent license ends
81
+ immediately for work on behalf of your company.
82
+
83
+ ## Violations
84
+
85
+ The first time you are notified in writing that you have
86
+ violated any of these terms, or done anything with the software
87
+ not covered by your licenses, your licenses can nonetheless
88
+ continue if you come into full compliance with these terms,
89
+ and take practical steps to correct past violations, within
90
+ 32 days of receiving notice. Otherwise, all your licenses
91
+ end immediately.
92
+
93
+ ## No Liability
94
+
95
+ _**As far as the law allows, the software comes as is, without
96
+ any warranty or condition, and the licensor will not be liable
97
+ to you for any damages arising out of these terms or the use
98
+ or nature of the software, under any kind of legal claim.**_
99
+
100
+ ## Definitions
101
+
102
+ The **licensor** is the individual or entity offering these
103
+ terms, and the **software** is the software the licensor makes
104
+ available under these terms.
105
+
106
+ **You** refers to the individual or entity agreeing to these
107
+ terms.
108
+
109
+ **Your company** is any legal entity, sole proprietorship,
110
+ or other kind of organization that you work for, plus all
111
+ organizations that have control over, are under the control of,
112
+ or are under common control with that organization. **Control**
113
+ means ownership of substantially all the assets of an entity,
114
+ or the power to direct its management and policies by vote,
115
+ contract, or otherwise. Control can be direct or indirect.
116
+
117
+ **Your licenses** are all the licenses granted to you for the
118
+ software under these terms.
119
+
120
+ **Use** means anything you do with the software requiring one
121
+ of your licenses.
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@graphysdk/geom-candlestick",
3
+ "author": "Graphy",
4
+ "description": "Candlestick geom for the Graphy charting SDK (beta)",
5
+ "homepage": "https://docs.graphy.dev/sdk-next/graph-types/candlestick",
6
+ "license": "SEE LICENSE IN LICENSE.md",
7
+ "keywords": [
8
+ "graphy",
9
+ "chart",
10
+ "react",
11
+ "visualization",
12
+ "grammar-of-graphics",
13
+ "candlestick"
14
+ ],
15
+ "version": "0.1.0",
16
+ "type": "module",
17
+ "sideEffects": false,
18
+ "types": "./dist/index.d.ts",
19
+ "files": [
20
+ "dist",
21
+ "LICENSE.md",
22
+ "licenses",
23
+ "README.md"
24
+ ],
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.mjs",
29
+ "require": "./dist/index.cjs"
30
+ }
31
+ },
32
+ "peerDependencies": {
33
+ "react": "^19.0.0",
34
+ "@graphysdk/react": "^1.9.0-beta.1790720825915"
35
+ },
36
+ "devDependencies": {
37
+ "@testing-library/react": "^16.3.1",
38
+ "@types/react": "^19.2.14",
39
+ "@types/react-dom": "^19.2.3",
40
+ "react": "^19.2.4",
41
+ "react-dom": "^19.2.4",
42
+ "rollup-plugin-node-externals": "^8.1.1",
43
+ "vite": "^8.1.5",
44
+ "vite-plugin-dts": "^4.5.4",
45
+ "vitest": "^4.1.11",
46
+ "@graphysdk/react": "1.9.0-beta.1790720825915",
47
+ "@graphytools/typescript-config": "0.0.1",
48
+ "@graphysdk/viz-engine": "1.8.0",
49
+ "@graphytools/vitest-config": "1.0.0",
50
+ "@graphytools/eslint-config": "0.0.1"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "lint-staged": {
56
+ "*.{ts,tsx,js,jsx,json,css,md}": [
57
+ "prettier --write"
58
+ ],
59
+ "*.{ts,tsx}": [
60
+ "eslint --max-warnings=0 --fix"
61
+ ]
62
+ },
63
+ "scripts": {
64
+ "build": "vite build",
65
+ "test": "vitest run",
66
+ "test:watch": "TZ=utc vitest",
67
+ "lint": "eslint . --max-warnings 0",
68
+ "lint:fix": "eslint . --fix",
69
+ "format": "prettier --write .",
70
+ "format:check": "prettier --check .",
71
+ "typecheck": "tsc --noEmit"
72
+ }
73
+ }