@milaboratories/miplots4 1.0.134 → 1.0.136
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/dist/{discrete/components → common}/BandAxis.d.ts +2 -2
- package/dist/common/BandAxis.d.ts.map +1 -0
- package/dist/{discrete/components → common}/BandAxis.js +3 -3
- package/dist/common/BandAxis.js.map +1 -0
- package/dist/common/ContinuousGrid.d.ts +3 -3
- package/dist/common/ContinuousGrid.d.ts.map +1 -1
- package/dist/common/ContinuousGrid.js.map +1 -1
- package/dist/discrete/ChartRenderer.d.ts.map +1 -1
- package/dist/discrete/ChartRenderer.js +192 -265
- package/dist/discrete/ChartRenderer.js.map +1 -1
- package/dist/discrete/components/Chart.js +1 -1
- package/dist/discrete/components/Chart.js.map +1 -1
- package/dist/discrete/components/Grid.d.ts +3 -3
- package/dist/discrete/components/Grid.d.ts.map +1 -1
- package/dist/discrete/components/Grid.js.map +1 -1
- package/dist/discrete/components/types.d.ts +5 -3
- package/dist/discrete/components/types.d.ts.map +1 -1
- package/dist/discrete/utils/index.d.ts +1 -1
- package/dist/discrete/utils/index.d.ts.map +1 -1
- package/dist/heatmap/getCells.js +48 -48
- package/dist/heatmap/getCells.js.map +1 -1
- package/dist/heatmap/utils/calculateCaptionTails.js +28 -28
- package/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
- package/dist/histogram/ChartRenderer.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/node_modules/d3-scale/src/band.js +45 -35
- package/dist/node_modules/d3-scale/src/band.js.map +1 -1
- package/dist/scatterplot/ChartRenderer.d.ts +10 -5
- package/dist/scatterplot/ChartRenderer.d.ts.map +1 -1
- package/dist/scatterplot/ChartRenderer.js +276 -197
- package/dist/scatterplot/ChartRenderer.js.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts +5 -3
- package/dist/scatterplot/ScatterplotSettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot/ScatterplotSettingsImpl.js +53 -53
- package/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
- package/dist/scatterplot/components/Chart.d.ts +3 -1
- package/dist/scatterplot/components/Chart.d.ts.map +1 -1
- package/dist/scatterplot/components/Chart.js +23 -19
- package/dist/scatterplot/components/Chart.js.map +1 -1
- package/dist/scatterplot/components/ChartAxis.d.ts +3 -1
- package/dist/scatterplot/components/ChartAxis.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartAxis.js +31 -27
- package/dist/scatterplot/components/ChartAxis.js.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartLayersData.js.map +1 -1
- package/dist/scatterplot/components/ChartTooltip.js.map +1 -1
- package/dist/scatterplot/components/ChartTrendsData.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartTrendsData.js +20 -17
- package/dist/scatterplot/components/ChartTrendsData.js.map +1 -1
- package/dist/scatterplot/components/ChartsGroup.d.ts +5 -1
- package/dist/scatterplot/components/ChartsGroup.d.ts.map +1 -1
- package/dist/scatterplot/components/ChartsGroup.js +49 -46
- package/dist/scatterplot/components/ChartsGroup.js.map +1 -1
- package/dist/scatterplot/components/Grid.d.ts +3 -3
- package/dist/scatterplot/components/Grid.d.ts.map +1 -1
- package/dist/scatterplot/components/Grid.js +31 -27
- package/dist/scatterplot/components/Grid.js.map +1 -1
- package/dist/scatterplot/components/types.d.ts +15 -5
- package/dist/scatterplot/components/types.d.ts.map +1 -1
- package/dist/scatterplot/dots.d.ts +2 -2
- package/dist/scatterplot/dots.d.ts.map +1 -1
- package/dist/scatterplot/dots.js.map +1 -1
- package/dist/scatterplot/getLayersData.d.ts +3 -2
- package/dist/scatterplot/getLayersData.d.ts.map +1 -1
- package/dist/scatterplot/getLayersData.js +29 -18
- package/dist/scatterplot/getLayersData.js.map +1 -1
- package/dist/scatterplot/index.d.ts +3 -0
- package/dist/scatterplot/index.d.ts.map +1 -1
- package/dist/scatterplot/index.js +73 -59
- package/dist/scatterplot/index.js.map +1 -1
- package/dist/scatterplot/linearRegression.d.ts +4 -6
- package/dist/scatterplot/linearRegression.d.ts.map +1 -1
- package/dist/scatterplot/linearRegression.js.map +1 -1
- package/dist/scatterplot/utils/isNumericScale.d.ts +6 -0
- package/dist/scatterplot/utils/isNumericScale.d.ts.map +1 -0
- package/dist/scatterplot/utils/isNumericScale.js +11 -0
- package/dist/scatterplot/utils/isNumericScale.js.map +1 -0
- package/dist/scatterplot-umap/ChartRenderer.js +1 -1
- package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.d.ts +7 -4
- package/dist/scatterplot-umap/SettingsImpl.d.ts.map +1 -1
- package/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
- package/dist/scatterplot-umap/components/LowerSVG.js +7 -7
- package/dist/scatterplot-umap/components/LowerSVG.js.map +1 -1
- package/dist/types/bubble.d.ts +12 -12
- package/dist/types/common.d.ts +186 -21
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +36 -26
- package/dist/types/common.js.map +1 -1
- package/dist/types/dendro.d.ts +22 -22
- package/dist/types/discrete.d.ts +23 -53
- package/dist/types/discrete.d.ts.map +1 -1
- package/dist/types/discrete.js +35 -35
- package/dist/types/discrete.js.map +1 -1
- package/dist/types/heatmap.d.ts +12 -12
- package/dist/types/histogram.d.ts +4 -4
- package/dist/types/scatterplot-umap.d.ts +4 -34
- package/dist/types/scatterplot-umap.d.ts.map +1 -1
- package/dist/types/scatterplot-umap.js +1 -1
- package/dist/types/scatterplot-umap.js.map +1 -1
- package/dist/types/scatterplot.d.ts +186 -32
- package/dist/types/scatterplot.d.ts.map +1 -1
- package/dist/utils/createMultilineDiscreteLabels.d.ts +4 -0
- package/dist/utils/createMultilineDiscreteLabels.d.ts.map +1 -0
- package/dist/utils/createMultilineDiscreteLabels.js +32 -0
- package/dist/utils/createMultilineDiscreteLabels.js.map +1 -0
- package/dist/utils/getFacetRowsColumns.d.ts +3 -0
- package/dist/utils/getFacetRowsColumns.d.ts.map +1 -0
- package/dist/utils/getFacetRowsColumns.js +18 -0
- package/dist/utils/getFacetRowsColumns.js.map +1 -0
- package/dist/utils/measureMultilineDiscreteLabels.d.ts +9 -0
- package/dist/utils/measureMultilineDiscreteLabels.d.ts.map +1 -0
- package/dist/utils/measureMultilineDiscreteLabels.js +63 -0
- package/dist/utils/measureMultilineDiscreteLabels.js.map +1 -0
- package/dist/utils/splitTextByWidth.d.ts.map +1 -0
- package/dist/{discrete/utils → utils}/splitTextByWidth.js +1 -1
- package/dist/utils/splitTextByWidth.js.map +1 -0
- package/package.json +1 -1
- package/dist/discrete/components/BandAxis.d.ts.map +0 -1
- package/dist/discrete/components/BandAxis.js.map +0 -1
- package/dist/discrete/utils/splitTextByWidth.d.ts.map +0 -1
- package/dist/discrete/utils/splitTextByWidth.js.map +0 -1
- package/dist/scatterplot/components/Axis.d.ts +0 -13
- package/dist/scatterplot/components/Axis.d.ts.map +0 -1
- package/dist/scatterplot/components/Axis.js +0 -59
- package/dist/scatterplot/components/Axis.js.map +0 -1
- /package/dist/{discrete/utils → utils}/splitTextByWidth.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BandAxis.d.ts","sourceRoot":"","sources":["../../../src/discrete/components/BandAxis.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AAExC,KAAK,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAC/B,KAAK,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AA0ChC,eAAO,MAAM,QAAQ,GAAI,2EAQtB;IACC,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;CACjD,4CA0DA,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BandAxis.js","sources":["../../../src/discrete/components/BandAxis.tsx"],"sourcesContent":["import {BLACK} from '../../constants';\nimport {TICK_OFFSET} from '../constants';\nimport React from 'react';\nimport type {ScaleBand} from 'd3-scale';\n\ntype Scale = ScaleBand<string>;\ntype Orient = 'left' | 'bottom';\n\nfunction translateX(x: number) {\n return `translate(${x},0)`;\n}\n\nfunction translateY(y: number) {\n return `translate(0,${y})`;\n}\n\ntype LabelsPosition = 'center' | '45deg' | '90deg';\n\nconst FONT_HEIGHT = 21;\nfunction getRotationTransform(labelsPosition: LabelsPosition, orient: 'left' | 'bottom') {\n if (labelsPosition === '45deg') {\n const x = orient === 'left' ? -FONT_HEIGHT / 2 : 0;\n const y = orient === 'bottom' ? FONT_HEIGHT / 2 : -FONT_HEIGHT / 2;\n return `translate(${x},${y}) rotate(-45)`;\n }\n if (labelsPosition === '90deg' && orient === 'bottom') {\n return `translate(${-FONT_HEIGHT / 2},${TICK_OFFSET + FONT_HEIGHT / 2}) rotate(-90)`;\n }\n return orient === 'bottom' ? `translate(0,${TICK_OFFSET})` : `translate(${-TICK_OFFSET},0)`;\n}\n\nfunction getDominantBaseline(labelsPosition: LabelsPosition, orient: 'left' | 'bottom') {\n if (orient === 'left' || (orient === 'bottom' && labelsPosition === '90deg')) {\n return 'central';\n }\n if (labelsPosition === 'center') {\n return 'hanging';\n }\n return 'auto';\n}\n\nfunction getTextAnchor(labelsPosition: LabelsPosition, orient: 'left' | 'bottom') {\n if (orient === 'left' || (orient === 'bottom' && labelsPosition !== 'center')) {\n return 'end';\n }\n return 'middle';\n}\n\nexport const BandAxis = ({\n scale,\n tickSize = 6,\n tickPadding = TICK_OFFSET,\n orient = 'bottom',\n labelsPosition = 'center',\n labels = {},\n offset = typeof window !== 'undefined' && window.devicePixelRatio > 1 ? 0 : 0.5,\n}: {\n scale: Scale;\n tickSize?: number;\n tickPadding?: number;\n offset?: number;\n orient?: Orient;\n labels?: Record<string, string[]>;\n labelsPosition?: 'center' | '45deg' | '90deg';\n}) => {\n function center(scale: Scale, offset: number) {\n if (scale.bandwidth) {\n offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;\n }\n if (scale?.round()) {\n offset = Math.round(offset);\n }\n return (d: string) => {\n const value = scale(d);\n return value === undefined ? 0 : value + offset;\n };\n }\n\n const values = scale.domain();\n const getLabel = (tick: string) => labels[tick] ?? [];\n const spacing = Math.max(tickSize, 0) + tickPadding;\n const position = center(scale.copy(), offset);\n\n const transform = orient === 'bottom' ? translateX : translateY;\n const k = orient === 'left' ? -1 : 1;\n\n const lineProps = {\n [(orient === 'left' ? 'x' : 'y') + '2']: k * tickSize,\n };\n\n const textProps = {\n [orient === 'left' ? 'x' : 'y']: k * spacing,\n };\n\n return (\n <g>\n {values.map((tick: string, i: number) => (\n <g className=\"tick\" key={i} transform={transform(position(tick) + offset)}>\n <line stroke={BLACK} {...lineProps} />\n <g transform={getRotationTransform(labelsPosition, orient)}>\n {getLabel(tick).map((line, idx) => {\n return (\n <text\n key={`${line}_${idx}`}\n fill={BLACK}\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n dominantBaseline={getDominantBaseline(labelsPosition, orient)}\n textAnchor={getTextAnchor(labelsPosition, orient)}\n dy={20 * idx}\n {...textProps}\n >\n {line}\n </text>\n );\n })}\n </g>\n </g>\n ))}\n </g>\n );\n};\n"],"names":["translateX","x","translateY","y","FONT_HEIGHT","getRotationTransform","labelsPosition","orient","TICK_OFFSET","getDominantBaseline","getTextAnchor","BandAxis","scale","tickSize","tickPadding","labels","offset","center","d","value","values","getLabel","tick","spacing","position","transform","k","lineProps","textProps","i","jsxs","jsx","BLAC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KApBqBL,CAqBzB,CACH,GACL;AAER;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splitTextByWidth.d.ts","sourceRoot":"","sources":["../../../src/discrete/utils/splitTextByWidth.ts"],"names":[],"mappings":"AAmDA,wBAAgB,gBAAgB,CAAE,IAAI,EAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,YA0ChF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splitTextByWidth.js","sources":["../../../src/discrete/utils/splitTextByWidth.ts"],"sourcesContent":["import { TextMeasurer } from '../../utils/TextMeasurer/TextMeasurer';\n\nfunction splitWord(word:string, startLineLength:number, maxLength:number, fontSize = 14) {\n const textMeasurer = new TextMeasurer(`600 ${fontSize}px Manrope`);\n // \"_\" and \"-\" symbols have priority as separation bounds, if this is not enough split by single symbols\n const parts:string[] = [];\n word\n .split(/(?=[_-])|(?<=[_-])/)\n .forEach((part) => {\n const length = textMeasurer.getTextWidth(part);\n if (length > maxLength) {\n parts.push(...part.split(''));\n } else {\n parts.push(part);\n }\n });\n let currentLine = '';\n let currentLineLength = 0;\n let i = 0;\n let firstPart = '';\n while (currentLineLength <= startLineLength) {\n const nextLength = textMeasurer.getTextWidth(currentLine + parts[i]);\n if (nextLength < startLineLength) {\n currentLine += parts[i];\n firstPart = currentLine;\n i++;\n }\n currentLineLength = nextLength;\n }\n currentLine = '';\n currentLineLength = 0;\n const lines:string[] = [];\n for (i; i < parts.length; i++) {\n const nextLength = textMeasurer.getTextWidth(currentLine + parts[i]);\n if (nextLength < maxLength) {\n currentLine += parts[i];\n currentLineLength = nextLength;\n } else {\n lines.push(currentLine);\n currentLine = parts[i];\n currentLineLength = textMeasurer.getTextWidth(parts[i]);\n }\n }\n return {\n firstPart,\n lines,\n lastPart: currentLine,\n lastPartLength: currentLineLength\n };\n}\n\nexport function splitTextByWidth (text:string, maxWidth: number, fontSize: number) {\n const textMeasurer = new TextMeasurer(`600 ${fontSize}px Manrope`);\n if (text.trim() === '') {\n return [];\n }\n if (textMeasurer.getTextWidth(text) <= maxWidth) {\n return [text];\n }\n const words = text.split(/\\s+/);\n const result:string[] = [];\n let currentLine = '';\n let currentLineLength = 0;\n for (let i = 0; i < words.length; i++) {\n const tempLine = `${currentLine} ${words[i]}`;\n const tempLineLength = textMeasurer.getTextWidth(tempLine);\n if (tempLineLength <= maxWidth) {\n currentLine = tempLine;\n currentLineLength = tempLineLength;\n } else {\n const wordLength = textMeasurer.getTextWidth(words[i]);\n if (wordLength > maxWidth) {\n const {\n firstPart,\n lines,\n lastPart,\n lastPartLength\n } = splitWord(words[i], maxWidth - currentLineLength, maxWidth, fontSize);\n result.push(`${currentLine} ${firstPart}`);\n result.push(...lines);\n currentLine = lastPart;\n currentLineLength = lastPartLength;\n } else {\n result.push(currentLine);\n currentLine = words[i];\n currentLineLength = wordLength;\n }\n }\n }\n result.push(currentLine);\n return result.filter((line) => {\n return line.length > 0;\n });\n}\n"],"names":["splitWord","word","startLineLength","maxLength","fontSize","textMeasurer","TextMeasurer","parts","part","currentLine","currentLineLength","i","firstPart","nextLength","lines","splitTextByWidth","text","maxWidth","words","result","tempLine","tempLineLength","wordLength","lastPart","lastPartLength","line"],"mappings":";AAEA,SAASA,EAAUC,GAAaC,GAAwBC,GAAkBC,IAAW,IAAI;AACrF,QAAMC,IAAe,IAAIC,EAAa,OAAOF,CAAQ,YAAY,GAE3DG,IAAiB,CAAA;AACvB,EAAAN,EACK,MAAM,WAAA,oBAAoB,GAC1B,QAAQ,CAACO,MAAS;AAEf,IADeH,EAAa,aAAaG,CAAI,IAChCL,IACTI,EAAM,KAAK,GAAGC,EAAK,MAAM,EAAE,CAAC,IAE5BD,EAAM,KAAKC,CAAI;AAAA,EAEvB,CAAC;AACL,MAAIC,IAAc,IACdC,IAAoB,GACpBC,IAAI,GACJC,IAAY;AAChB,SAAOF,KAAqBR,KAAiB;AACzC,UAAMW,IAAaR,EAAa,aAAaI,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S;AAAA,UACA,gBAAAC;AAAA,QAAA,IACAxB,EAAUkB,EAAMP,CAAC,GAAGM,IAAWP,GAAmBO,GAAUb,CAAQ;AACxE,QAAAe,EAAO,KAAK,GAAGV,CAAW,IAAIG,CAAS,EAAE,GACzCO,EAAO,KAAK,GAAGL,CAAK,GACpBL,IAAcc,GACdb,IAAoBc;AAAA,MACxB;AACI,QAAAL,EAAO,KAAKV,CAAW,GACvBA,IAAcS,EAAMP,CAAC,GACrBD,IAAoBY;AAAA,IAE5B;AAAA,EACJ;AACA,SAAAH,EAAO,KAAKV,CAAW,GAChBU,EAAO,OAAO,CAACM,MACXA,EAAK,SAAS,CACxB;AACL;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ScaleLinear, ScaleLogarithmic } from 'd3-scale';
|
|
2
|
-
type Scale = ScaleLinear<number, number> | ScaleLogarithmic<number, number>;
|
|
3
|
-
type Orient = 'left' | 'bottom';
|
|
4
|
-
export declare const Axis: ({ scale, tickSize, tickPadding, orient, onlyPositive, offset, }: {
|
|
5
|
-
scale: Scale;
|
|
6
|
-
tickSize?: number;
|
|
7
|
-
tickPadding?: number;
|
|
8
|
-
offset?: number;
|
|
9
|
-
orient?: Orient;
|
|
10
|
-
onlyPositive?: boolean;
|
|
11
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=Axis.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Axis.d.ts","sourceRoot":"","sources":["../../../src/scatterplot/components/Axis.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAE5D,KAAK,KAAK,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC5E,KAAK,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAsBhC,eAAO,MAAM,IAAI,GAAI,iEAOlB;IACC,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,4CA4CA,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { j as o } from "../../node_modules/react/jsx-runtime.js";
|
|
2
|
-
import { BLACK as l } from "../../constants.js";
|
|
3
|
-
import { TICK_OFFSET as s } from "../../discrete/constants.js";
|
|
4
|
-
import { getTicksAndFormat as A } from "../utils/getTicksAndFormat.js";
|
|
5
|
-
function T(t) {
|
|
6
|
-
return `translate(${t},0)`;
|
|
7
|
-
}
|
|
8
|
-
function v(t) {
|
|
9
|
-
return `translate(0,${t})`;
|
|
10
|
-
}
|
|
11
|
-
function w(t) {
|
|
12
|
-
return t === "bottom" ? `translate(0,${s})` : `translate(${-s},0)`;
|
|
13
|
-
}
|
|
14
|
-
function F(t) {
|
|
15
|
-
return t === "bottom" ? "hanging" : "central";
|
|
16
|
-
}
|
|
17
|
-
function $(t) {
|
|
18
|
-
return t === "bottom" ? "middle" : "end";
|
|
19
|
-
}
|
|
20
|
-
const C = ({
|
|
21
|
-
scale: t,
|
|
22
|
-
tickSize: a = 6,
|
|
23
|
-
tickPadding: c = s,
|
|
24
|
-
orient: n = "bottom",
|
|
25
|
-
onlyPositive: f = !1,
|
|
26
|
-
offset: u = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5
|
|
27
|
-
}) => {
|
|
28
|
-
function x(r) {
|
|
29
|
-
return (e) => {
|
|
30
|
-
const m = r(e);
|
|
31
|
-
return m === void 0 ? 0 : +m;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const { ticks: d, format: p } = A(t, f, n === "bottom"), g = Math.max(a, 0) + c, h = x(t.copy()), b = n === "bottom" ? T : v, i = n === "left" ? -1 : 1, j = {
|
|
35
|
-
[(n === "left" ? "x" : "y") + "2"]: i * a
|
|
36
|
-
}, y = {
|
|
37
|
-
[n === "left" ? "x" : "y"]: i * g
|
|
38
|
-
};
|
|
39
|
-
return /* @__PURE__ */ o.jsx("g", { children: d.map((r, e) => /* @__PURE__ */ o.jsxs("g", { className: "tick", transform: b(h(r) + u), children: [
|
|
40
|
-
/* @__PURE__ */ o.jsx("line", { stroke: l, ...j }),
|
|
41
|
-
/* @__PURE__ */ o.jsx("g", { transform: w(n), children: /* @__PURE__ */ o.jsx(
|
|
42
|
-
"text",
|
|
43
|
-
{
|
|
44
|
-
fill: l,
|
|
45
|
-
fontSize: "14px",
|
|
46
|
-
fontWeight: "500",
|
|
47
|
-
fontFamily: "Manrope",
|
|
48
|
-
dominantBaseline: F(n),
|
|
49
|
-
textAnchor: $(n),
|
|
50
|
-
...y,
|
|
51
|
-
children: p(r)
|
|
52
|
-
}
|
|
53
|
-
) })
|
|
54
|
-
] }, e)) });
|
|
55
|
-
};
|
|
56
|
-
export {
|
|
57
|
-
C as Axis
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=Axis.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Axis.js","sources":["../../../src/scatterplot/components/Axis.tsx"],"sourcesContent":["import {BLACK} from '../../constants';\nimport {TICK_OFFSET} from '../../discrete/constants';\nimport {getTicksAndFormat} from '../utils/getTicksAndFormat';\nimport React from 'react';\nimport type {ScaleLinear, ScaleLogarithmic} from 'd3-scale';\n\ntype Scale = ScaleLinear<number, number> | ScaleLogarithmic<number, number>;\ntype Orient = 'left' | 'bottom';\n\nfunction translateX(x: number) {\n return `translate(${x},0)`;\n}\n\nfunction translateY(y: number) {\n return `translate(0,${y})`;\n}\n\nfunction getRotationTransform(orient: 'left' | 'bottom') {\n return orient === 'bottom' ? `translate(0,${TICK_OFFSET})` : `translate(${-TICK_OFFSET},0)`;\n}\n\nfunction getDominantBaseline(orient: 'left' | 'bottom') {\n return orient === 'bottom' ? 'hanging' : 'central';\n}\n\nfunction getTextAnchor( orient: 'left' | 'bottom') {\n return orient === 'bottom' ? 'middle' : 'end';\n}\n\nexport const Axis = ({\n scale,\n tickSize = 6,\n tickPadding = TICK_OFFSET,\n orient = 'bottom',\n onlyPositive = false,\n offset = typeof window !== 'undefined' && window.devicePixelRatio > 1 ? 0 : 0.5,\n}: {\n scale: Scale;\n tickSize?: number;\n tickPadding?: number;\n offset?: number;\n orient?: Orient;\n onlyPositive?: boolean;\n}) => {\n function number(scale: Scale) {\n return (d: number) => {\n const value = scale(d);\n return value === undefined ? 0 : +value;\n };\n }\n const {ticks: values, format} = getTicksAndFormat(scale, onlyPositive, orient === 'bottom');\n const spacing = Math.max(tickSize, 0) + tickPadding,\n position = (number)(scale.copy());\n\n const transform = orient === 'bottom' ? translateX : translateY;\n const k = orient === 'left' ? -1 : 1;\n\n const lineProps = {\n [(orient === 'left' ? 'x' : 'y') + '2']: k * tickSize,\n };\n\n const textProps = {\n [orient === 'left' ? 'x' : 'y']: k * spacing,\n };\n\n return (\n <g>\n {values.map((tick: number, i: number) => (\n <g className=\"tick\" key={i} transform={transform(position(tick) + offset)}>\n <line stroke={BLACK} {...lineProps} />\n <g transform={getRotationTransform(orient)}>\n <text\n fill={BLACK}\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n dominantBaseline={getDominantBaseline(orient)}\n textAnchor={getTextAnchor(orient)}\n {...textProps}\n >\n {format(tick)}\n </text>\n </g>\n </g>\n ))}\n </g>\n );\n};\n"],"names":["translateX","x","translateY","y","getRotationTransform","orient","TICK_OFFSET","getDominantBaseline","getTextAnchor","Axis","scale","tickSize","tickPadding","onlyPositive","offset","number","d","value","values","format","getTicksAndFormat","spacing","position","transform","k","lineProps","textProps","tick","i","jsxs","jsx","BLACK"],"mappings":";;;;AASA,SAASA,EAAWC,GAAW;AAC3B,SAAO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