@datagrok/curves 1.2.12 → 1.2.14
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/CHANGELOG.md +14 -0
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +4 -4
- package/src/fit/fit-grid-cell-handler.ts +5 -0
- package/src/fit/fit-renderer.ts +5 -2
- package/src/tests/fit-tests.ts +4 -4
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/curves",
|
|
3
3
|
"friendlyName": "Curves",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.14",
|
|
5
5
|
"description": "Curves provides support for fitted curves (such as dose-response curves), including in-grid rendering, storing charts in cells, interactivity, and automatic fitting.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Dmytro Kovalyov",
|
|
8
8
|
"email": "dkovalyov@datagrok.ai"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@datagrok-libraries/statistics": "^1.2.
|
|
12
|
-
"@datagrok-libraries/utils": "^4.1.
|
|
11
|
+
"@datagrok-libraries/statistics": "^1.2.10",
|
|
12
|
+
"@datagrok-libraries/utils": "^4.1.0",
|
|
13
13
|
"@types/wu": "^2.1.42",
|
|
14
14
|
"cash-dom": "latest",
|
|
15
15
|
"datagrok-api": "^1.17.0",
|
|
16
|
-
"dayjs": "
|
|
16
|
+
"dayjs": "^1.11.7",
|
|
17
17
|
"rxjs": "6.5.5"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
getSeriesFitFunction,
|
|
9
9
|
getDataFrameChartOptions,
|
|
10
10
|
LogOptions,
|
|
11
|
+
getChartBounds,
|
|
11
12
|
} from '@datagrok-libraries/statistics/src/fit/fit-data';
|
|
12
13
|
import {statisticsProperties, fitSeriesProperties, fitChartDataProperties, FIT_CELL_TYPE, TAG_FIT, IFitChartData, IFitSeries, IFitChartOptions, FIT_SEM_TYPE, IFitSeriesOptions, FitStatistics} from '@datagrok-libraries/statistics/src/fit/fit-curve';
|
|
13
14
|
import {TAG_FIT_CHART_FORMAT, TAG_FIT_CHART_FORMAT_3DX, getChartData, isColorValid, mergeProperties} from './fit-renderer';
|
|
@@ -346,6 +347,10 @@ export class FitGridCellHandler extends DG.ObjectHandler {
|
|
|
346
347
|
|
|
347
348
|
function createFitPane(): HTMLElement {
|
|
348
349
|
const host = ui.divV(seriesStatsInput.stringValue === 'aggregated' ? [seriesStatsInput.root, aggrTypeInput.root] : [seriesStatsInput.root]);
|
|
350
|
+
const dataBounds = getChartBounds(chartData);
|
|
351
|
+
if (dataBounds.x <= 0 && chartData.chartOptions) chartData.chartOptions.logX = false;
|
|
352
|
+
if (dataBounds.y <= 0 && chartData.chartOptions) chartData.chartOptions.logY = false;
|
|
353
|
+
|
|
349
354
|
if (seriesStatsInput.stringValue === 'all') {
|
|
350
355
|
const chartLogOptions: LogOptions = {logX: chartData.chartOptions?.logX, logY: chartData.chartOptions?.logY};
|
|
351
356
|
for (let i = 0; i < chartData.series!.length; i++) {
|
package/src/fit/fit-renderer.ts
CHANGED
|
@@ -52,6 +52,8 @@ const MIN_TITLE_PX_WIDTH = 275;
|
|
|
52
52
|
const MIN_TITLE_PX_HEIGHT = 225;
|
|
53
53
|
const MIN_X_AXIS_NAME_VISIBILITY_PX_WIDTH = 180;
|
|
54
54
|
const MIN_Y_AXIS_NAME_VISIBILITY_PX_HEIGHT = 140;
|
|
55
|
+
const MIN_DROPLINES_VISIBILITY_PX_WIDTH = 120;
|
|
56
|
+
const MIN_DROPLINES_VISIBILITY_PX_HEIGHT = 110;
|
|
55
57
|
const AXES_LEFT_PX_MARGIN = 38;
|
|
56
58
|
const AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS = 45;
|
|
57
59
|
const AXES_TOP_PX_MARGIN = 5;
|
|
@@ -371,6 +373,7 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
371
373
|
const showAxesLabels = w >= MIN_X_AXIS_NAME_VISIBILITY_PX_WIDTH && h >= MIN_Y_AXIS_NAME_VISIBILITY_PX_HEIGHT
|
|
372
374
|
&& !!data.chartOptions?.xAxisName && !!data.chartOptions.yAxisName;
|
|
373
375
|
const showTitle = w >= MIN_TITLE_PX_WIDTH && h >= MIN_TITLE_PX_HEIGHT && !!data.chartOptions?.title;
|
|
376
|
+
const showDroplines = w >= MIN_DROPLINES_VISIBILITY_PX_WIDTH && h >= MIN_DROPLINES_VISIBILITY_PX_HEIGHT;
|
|
374
377
|
const [dataBox, xAxisBox, yAxisBox] = layoutChart(screenBounds, showAxesLabels, showTitle);
|
|
375
378
|
|
|
376
379
|
const dataBounds = getChartBounds(data);
|
|
@@ -389,7 +392,7 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
389
392
|
|
|
390
393
|
for (let i = 0; i < data.series?.length!; i++) {
|
|
391
394
|
const series = data.series![i];
|
|
392
|
-
if (series.points.some((point) =>
|
|
395
|
+
if (series.points.some((point) => point.x === undefined || point.y === undefined))
|
|
393
396
|
continue;
|
|
394
397
|
if (w < MIN_POINTS_AND_STATS_VISIBILITY_PX_WIDTH || h < MIN_POINTS_AND_STATS_VISIBILITY_PX_HEIGHT) {
|
|
395
398
|
series.showPoints = '';
|
|
@@ -461,7 +464,7 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
461
464
|
fillConfidenceInterval(g, confidenceIntervals, screenBounds, viewport, showAxes, showAxesLabels, chartLogOptions);
|
|
462
465
|
}
|
|
463
466
|
|
|
464
|
-
if (series.droplines &&
|
|
467
|
+
if (series.droplines && showDroplines) {
|
|
465
468
|
g.save();
|
|
466
469
|
g.strokeStyle = 'blue';
|
|
467
470
|
g.lineWidth = ratio;
|
package/src/tests/fit-tests.ts
CHANGED
|
@@ -48,10 +48,10 @@ category('fit', () => {
|
|
|
48
48
|
const polynomialFitSeries = fitSeries(polynomialSeries, polynomialFitFunc);
|
|
49
49
|
const stop = Date.now();
|
|
50
50
|
|
|
51
|
-
expect(sigmoidFitSeries.fittedCurve(2.5), 1.
|
|
52
|
-
expect(polynomialFitSeries.fittedCurve(3.99876), 6.
|
|
53
|
-
expectArray(sigmoidFitSeries.parameters, [1.
|
|
54
|
-
expectArray(polynomialFitSeries.parameters, [0.
|
|
51
|
+
expect(sigmoidFitSeries.fittedCurve(2.5), 1.690742266220136);
|
|
52
|
+
expect(polynomialFitSeries.fittedCurve(3.99876), 6.09328601677405);
|
|
53
|
+
expectArray(sigmoidFitSeries.parameters, [1.691390784119389, 1.1540819399621425, 5.4104428146970704, 0.20886765646057662]);
|
|
54
|
+
expectArray(polynomialFitSeries.parameters, [0.07070206940832963, -1.138666933634074, 3.947509109407932, 3.9947960440506685]);
|
|
55
55
|
return `${stop.valueOf() - start.valueOf()} ms`;
|
|
56
56
|
});
|
|
57
57
|
|