@axdspub/axiom-charts 0.0.37 → 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 +25 -4
- package/library/browser.js.map +1 -1
- package/library/cjs.js +25 -4
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var AxiomCharts = (function (exports, axiomUiDataServices, d3Array,
|
|
1
|
+
var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, _, require$$0) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
/******************************************************************************
|
|
@@ -277,7 +277,7 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, lodash, requ
|
|
|
277
277
|
return param;
|
|
278
278
|
}
|
|
279
279
|
getPlotImplementationGroups(plots, axis) {
|
|
280
|
-
const groups =
|
|
280
|
+
const groups = _.groupBy(plots, p => {
|
|
281
281
|
const param = this.getDimensionAxisParam(p, axis);
|
|
282
282
|
return `${param}${this.reversePlotAxis(p, axis) ? '.reverse' : ''}`;
|
|
283
283
|
});
|
|
@@ -317,13 +317,13 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, lodash, requ
|
|
|
317
317
|
this.runtime.resizeEventHandler.cancel();
|
|
318
318
|
console.log('cancel');
|
|
319
319
|
}
|
|
320
|
-
this.runtime.resizeEventHandler =
|
|
320
|
+
this.runtime.resizeEventHandler = _.debounce(() => { this.onResize(this.runtime.prevWidth, this.runtime.prevHeight); }, 1000);
|
|
321
321
|
this.runtime.resizeEventHandler();
|
|
322
322
|
}
|
|
323
323
|
init(drawImmediately = false) {
|
|
324
324
|
var _a;
|
|
325
325
|
return __awaiter(this, void 0, void 0, function* () {
|
|
326
|
-
this.runtime.resizeEventHandler =
|
|
326
|
+
this.runtime.resizeEventHandler = _.debounce(() => { this.onResize(this.runtime.prevWidth, this.runtime.prevHeight); }, 1000);
|
|
327
327
|
window.addEventListener('resize', () => { this.debouncedResize(); });
|
|
328
328
|
(_a = this.plotImplementations) === null || _a === void 0 ? void 0 : _a.forEach(plot => { plot.destroy(); });
|
|
329
329
|
this.plotImplementations = this.createPlots();
|
|
@@ -1847,6 +1847,26 @@ var AxiomCharts = (function (exports, axiomUiDataServices, d3Array, lodash, requ
|
|
|
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, lodash, requ
|
|
|
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;
|