@datagrok/curves 1.2.12 → 1.2.13

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/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@datagrok/curves",
3
3
  "friendlyName": "Curves",
4
- "version": "1.2.12",
4
+ "version": "1.2.13",
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.9",
12
- "@datagrok-libraries/utils": "^4.1.3",
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": "latest",
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++) {
@@ -389,7 +389,7 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
389
389
 
390
390
  for (let i = 0; i < data.series?.length!; i++) {
391
391
  const series = data.series![i];
392
- if (series.points.some((point) => !point.x || !point.y))
392
+ if (series.points.some((point) => point.x === undefined || point.y === undefined))
393
393
  continue;
394
394
  if (w < MIN_POINTS_AND_STATS_VISIBILITY_PX_WIDTH || h < MIN_POINTS_AND_STATS_VISIBILITY_PX_HEIGHT) {
395
395
  series.showPoints = '';
@@ -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.6908990263493584);
52
- expect(polynomialFitSeries.fittedCurve(3.99876), 6.306103656922533);
53
- expectArray(sigmoidFitSeries.parameters, [1.6915930199522453, 1.1420615719998677, 5.4181972283003, 0.19770452774609057]);
54
- expectArray(polynomialFitSeries.parameters, [0.05844454303535648, -1.0810191408551957, 3.964405091374009, 4.002010146398808]);
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