@datagrok/curves 1.2.16 → 1.3.1

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.
Binary file
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@datagrok/curves",
3
3
  "friendlyName": "Curves",
4
- "version": "1.2.16",
4
+ "version": "1.3.1",
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",
11
+ "@datagrok-libraries/statistics": "^1.2.13",
12
12
  "@datagrok-libraries/utils": "^4.1.45",
13
13
  "@types/wu": "^2.1.42",
14
14
  "cash-dom": "^8.0.0",
@@ -0,0 +1,96 @@
1
+ import {IFitSeries} from '@datagrok-libraries/statistics/src/fit/fit-curve';
2
+
3
+ export class FitConstants {
4
+ static CELL_DEFAULT_WIDTH = 230;
5
+
6
+ static CELL_DEFAULT_HEIGHT = 160;
7
+
8
+ static TAG_FIT_CHART_FORMAT = '.fitChartFormat';
9
+
10
+ static TAG_FIT_CHART_FORMAT_3DX = '3dx';
11
+
12
+ static MIN_CELL_RENDERER_PX_WIDTH = 20;
13
+
14
+ static MIN_CELL_RENDERER_PX_HEIGHT = 10;
15
+
16
+ static MIN_POINTS_AND_STATS_VISIBILITY_PX_WIDTH = 70;
17
+
18
+ static MIN_POINTS_AND_STATS_VISIBILITY_PX_HEIGHT = 45;
19
+
20
+ static OUTLIER_PX_SIZE = 12;
21
+
22
+ static POINT_PX_SIZE = 4;
23
+
24
+ static OUTLIER_HITBOX_RADIUS = 2;
25
+
26
+ static MIN_AXES_CELL_PX_WIDTH = 100;
27
+
28
+ static MIN_AXES_CELL_PX_HEIGHT = 55;
29
+
30
+ static MIN_TITLE_PX_WIDTH = 275;
31
+
32
+ static MIN_TITLE_PX_HEIGHT = 225;
33
+
34
+ static MIN_X_AXIS_NAME_VISIBILITY_PX_WIDTH = 180;
35
+
36
+ static MIN_Y_AXIS_NAME_VISIBILITY_PX_HEIGHT = 140;
37
+
38
+ static MIN_LEGEND_PX_WIDTH = 325;
39
+
40
+ static MIN_LEGEND_PX_HEIGHT = 275;
41
+
42
+ static MIN_DROPLINES_VISIBILITY_PX_WIDTH = 120;
43
+
44
+ static MIN_DROPLINES_VISIBILITY_PX_HEIGHT = 110;
45
+
46
+ static AXES_LEFT_PX_MARGIN = 38;
47
+
48
+ static AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS = 45;
49
+
50
+ static AXES_TOP_PX_MARGIN = 5;
51
+
52
+ static AXES_TOP_PX_MARGIN_WITH_TITLE = 25;
53
+
54
+ static AXES_RIGHT_PX_MARGIN = 18;
55
+
56
+ static AXES_BOTTOM_PX_MARGIN = 15;
57
+
58
+ static AXES_BOTTOM_PX_MARGIN_WITH_AXES_LABELS = 30;
59
+
60
+ static X_AXIS_LABEL_BOTTOM_PX_MARGIN = 4;
61
+
62
+ static CANDLESTICK_BORDER_PX_SIZE = 4;
63
+
64
+ static CANDLESTICK_MEDIAN_PX_SIZE = 3.5;
65
+
66
+ static CANDLESTICK_OUTLIER_PX_SIZE = 6;
67
+
68
+ static INFLATE_SIZE = -12 / 2;
69
+
70
+ static LEGEND_TOP_PX_MARGIN = 10;
71
+
72
+ static LEGEND_RECORD_PX_HEIGHT = 18;
73
+
74
+ static LEGEND_RECORD_LINE_PX_WIDTH = 20;
75
+
76
+ static LEGEND_RECORD_LINE_RIGHT_PX_MARGIN = 5;
77
+
78
+ static LEGEND_RECORD_LINE_BOTTOM_PX_MARGIN = 4;
79
+
80
+ static LINE_STYLES: {[key: string]: number[]} = {
81
+ 'solid': [],
82
+ 'dotted': [1, 1],
83
+ 'dashed': [5, 5],
84
+ 'dashdotted': [5, 5, 2, 5],
85
+ };
86
+
87
+ static CONDITION_MAP: {[key: string]: ((series?: IFitSeries[]) => boolean)} = {
88
+ 'No series to show': (series) => series === undefined || series?.length === 0,
89
+ 'There were series with no points': (series) =>
90
+ series!.some((series) => series.points?.length === 0),
91
+ 'There were series with all x zeroes': (series) =>
92
+ series!.some((series) => series.points?.every((point) => point.x === 0)),
93
+ 'There were series with all y zeroes': (series) =>
94
+ series!.some((series) => series.points?.every((point) => point.y === 0)),
95
+ };
96
+ }
@@ -11,9 +11,10 @@ import {
11
11
  getChartBounds,
12
12
  } from '@datagrok-libraries/statistics/src/fit/fit-data';
13
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';
14
- import {TAG_FIT_CHART_FORMAT, TAG_FIT_CHART_FORMAT_3DX, getChartData, isColorValid, mergeProperties, substituteZeroes} from './fit-renderer';
14
+ import {getChartData, isColorValid, mergeProperties, substituteZeroes} from './fit-renderer';
15
15
  import {CellRenderViewer} from './cell-render-viewer';
16
16
  import {convertXMLToIFitChartData} from './fit-parser';
17
+ import {FitConstants} from './const';
17
18
 
18
19
 
19
20
  const CHART_OPTIONS = 'chartOptions';
@@ -106,7 +107,7 @@ function convertJnJColumnToJSON(column: DG.Column): void {
106
107
  const chartData: IFitChartData = convertXMLToIFitChartData(value);
107
108
  column.set(i, JSON.stringify(chartData));
108
109
  }
109
- column.setTag(TAG_FIT_CHART_FORMAT, '');
110
+ column.setTag(FitConstants.TAG_FIT_CHART_FORMAT, '');
110
111
  }
111
112
 
112
113
  function detectSettings(df: DG.DataFrame): void {
@@ -118,7 +119,7 @@ function detectSettings(df: DG.DataFrame): void {
118
119
  fitSeriesProperties.map((prop) => {
119
120
  fitColumns[i].temp[`${SERIES_OPTIONS}-custom-${prop.name}`] = false;
120
121
  });
121
- if (fitColumns[i].getTag(TAG_FIT_CHART_FORMAT) === TAG_FIT_CHART_FORMAT_3DX)
122
+ if (fitColumns[i].getTag(FitConstants.TAG_FIT_CHART_FORMAT) === FitConstants.TAG_FIT_CHART_FORMAT_3DX)
122
123
  convertJnJColumnToJSON(fitColumns[i]);
123
124
 
124
125
  for (let j = 0; j < fitColumns[i].length; j++) {
@@ -328,7 +329,7 @@ export class FitGridCellHandler extends DG.ObjectHandler {
328
329
  ui.input.form(seriesStatistics, statisticsProperties, {
329
330
  onCreated: (input) => input.root.appendChild(ui.iconFA('plus', async () => {
330
331
  const funcParams = {df: gridCell.cell.dataFrame, colName: gridCell.gridColumn.name, propName: input.property.name, seriesName: series.name, seriesNumber: i};
331
- await DG.Func.find({name: 'addStatisticsColumn'})[0].prepare(funcParams).call(undefined, undefined, {processed: false})
332
+ await DG.Func.find({name: 'addStatisticsColumn'})[0].prepare(funcParams).call(undefined, undefined, {processed: false});
332
333
  }, `Calculate ${input.property.name} for the whole column`))
333
334
  })
334
335
  ]));