@axdspub/axiom-charts 0.0.38 → 0.0.39
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/library/axiom-charts.d.ts +8 -1
- package/library/browser.js +21 -0
- package/library/browser.js.map +1 -1
- package/library/cjs.js +21 -0
- package/library/cjs.js.map +1 -1
- package/library/index.js +22 -2
- package/library/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -246,10 +246,17 @@ declare abstract class RadialChartRoot extends ChartRoot {
|
|
|
246
246
|
|
|
247
247
|
declare const AxiomChartComponent: (props: IChart) => ReactElement;
|
|
248
248
|
|
|
249
|
+
interface IPopupProps extends IPlotScrubSettings {
|
|
250
|
+
plotScrubs: IPlotScrubs;
|
|
251
|
+
chartSettings: IChartSettings;
|
|
252
|
+
children?: ReactElement;
|
|
253
|
+
}
|
|
254
|
+
declare const Popup: ({ plotScrubs, chartSettings, axis, followCursor, children }: IPopupProps) => ReactElement;
|
|
255
|
+
|
|
249
256
|
interface ILegendProps {
|
|
250
257
|
plotLegends: IPlotLegends;
|
|
251
258
|
style?: CSSProperties;
|
|
252
259
|
}
|
|
253
260
|
declare const Legend: ({ plotLegends, style }: ILegendProps) => ReactElement;
|
|
254
261
|
|
|
255
|
-
export { AxiomChartComponent as Chart, ChartRoot, EChartAxes, EPlotTypes, IChart, IChartAxes, IChartAxis, IChartDimension, IChartDimensionAccessor, IChartDimensionDomain, IChartDimensionParameter, IChartDimensions, IChartImplementation, IChartImplementationProps, IChartLibrary, IChartScale, IChartSettings, ILegendItem, INumericRange, INumericScale, IPlot, IPlotAxisSetting, IPlotAxisSettings, IPlotData, IPlotDataAccessors, IPlotDataLoadEvent, IPlotImplementation, IPlotImplementationGroup, IPlotImplementationGroups, IPlotImplementationProps, IPlotLegendSettings, IPlotLegends, IPlotScrubEvent, IPlotScrubSettings, IPlotScrubs, IPlotStyle, IPlotTypes, Legend, RadialChartRoot };
|
|
262
|
+
export { AxiomChartComponent as Chart, ChartRoot, EChartAxes, EPlotTypes, IChart, IChartAxes, IChartAxis, IChartDimension, IChartDimensionAccessor, IChartDimensionDomain, IChartDimensionParameter, IChartDimensions, IChartImplementation, IChartImplementationProps, IChartLibrary, IChartScale, IChartSettings, ILegendItem, INumericRange, INumericScale, IPlot, IPlotAxisSetting, IPlotAxisSettings, IPlotData, IPlotDataAccessors, IPlotDataLoadEvent, IPlotImplementation, IPlotImplementationGroup, IPlotImplementationGroups, IPlotImplementationProps, IPlotLegendSettings, IPlotLegends, IPlotScrubEvent, IPlotScrubSettings, IPlotScrubs, IPlotStyle, IPlotTypes, Legend, Popup, RadialChartRoot };
|
package/library/browser.js
CHANGED
|
@@ -1847,6 +1847,26 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, _, require$$
|
|
|
1847
1847
|
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [error !== undefined ? jsxRuntimeExports.jsx("p", { children: error }) : '', jsxRuntimeExports.jsx("div", { className: "chart relative", style: { width: w, height: `${props.settings.height}px` }, ref: chartRef })] }));
|
|
1848
1848
|
};
|
|
1849
1849
|
|
|
1850
|
+
const Popup = ({ plotScrubs, chartSettings, axis, followCursor, children }) => {
|
|
1851
|
+
const ref = require$$0.useRef(null);
|
|
1852
|
+
const getMean = (axis) => _.meanBy(Object.values(plotScrubs), scrubData => { var _a; return (_a = scrubData[axis]) === null || _a === void 0 ? void 0 : _a.position; });
|
|
1853
|
+
let x = 0;
|
|
1854
|
+
let y = 0;
|
|
1855
|
+
if (followCursor !== null && followCursor !== void 0 ? followCursor : false) {
|
|
1856
|
+
x = getMean(exports.EChartAxes.x);
|
|
1857
|
+
y = getMean(exports.EChartAxes.y) + 50; // TODO: fix
|
|
1858
|
+
}
|
|
1859
|
+
else {
|
|
1860
|
+
x = axis === exports.EChartAxes.x ? getMean(exports.EChartAxes.x) : Number(chartSettings.width) + chartSettings.margin.right;
|
|
1861
|
+
y = axis === exports.EChartAxes.y ? getMean(exports.EChartAxes.y) : chartSettings.height + chartSettings.margin.bottom;
|
|
1862
|
+
}
|
|
1863
|
+
const position = { x, y };
|
|
1864
|
+
if (Object.keys(plotScrubs).length === 0) {
|
|
1865
|
+
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
1866
|
+
}
|
|
1867
|
+
return (jsxRuntimeExports.jsx("div", { className: 'absolute z-30', style: { left: position.x, top: position.y }, children: jsxRuntimeExports.jsx("div", { ref: ref, children: children }) }));
|
|
1868
|
+
};
|
|
1869
|
+
|
|
1850
1870
|
const Legend = ({ plotLegends, style }) => {
|
|
1851
1871
|
return (jsxRuntimeExports.jsx("div", { className: 'flex gap-4 flex-wrap hover:cursor-pointer', style: style, children: Object.entries(plotLegends).map(([plotId, legendItems]) => (jsxRuntimeExports.jsx("div", { className: 'flex gap-4 flex-wrap', children: legendItems.map(item => (jsxRuntimeExports.jsxs("div", { className: 'flex gap-2 items-center', children: [jsxRuntimeExports.jsx("div", { className: 'w-4 h-4 rounded-full', style: item.style }), jsxRuntimeExports.jsx("div", { children: item.label })] }, item.id))) }, plotId))) }));
|
|
1852
1872
|
};
|
|
@@ -1854,6 +1874,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, _, require$$
|
|
|
1854
1874
|
exports.Chart = AxiomChartComponent;
|
|
1855
1875
|
exports.ChartRoot = ChartRoot;
|
|
1856
1876
|
exports.Legend = Legend;
|
|
1877
|
+
exports.Popup = Popup;
|
|
1857
1878
|
exports.RadialChartRoot = RadialChartRoot;
|
|
1858
1879
|
|
|
1859
1880
|
return exports;
|