@datagrok/curves 1.2.7 → 1.2.8

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.
@@ -1,119 +0,0 @@
1
- import * as DG from 'datagrok-api/dg';
2
- import { FIT_FUNCTION_SIGMOID, } from '@datagrok-libraries/statistics/src/fit/fit-curve';
3
- const AXES = { x: 'xAxis', y: 'yAxis' };
4
- const EXTREMUMS = { min: 'min', max: 'max' };
5
- /** Constructs {@link IFitChartOptions} from grid and settings xml tags.
6
- * @param {Element} grid XML grid tag
7
- * @param {Element} settings XML settings tag
8
- * @return {IFitChartOptions} IFitChartOptions for the fitted curve
9
- */
10
- function getChartOptions(grid, settings) {
11
- return {
12
- minX: +grid.getElementsByTagName(AXES.x)[0].getAttribute(EXTREMUMS.min),
13
- minY: +grid.getElementsByTagName(AXES.y)[0].getAttribute(EXTREMUMS.min),
14
- maxX: +grid.getElementsByTagName(AXES.x)[0].getAttribute(EXTREMUMS.max),
15
- maxY: +grid.getElementsByTagName(AXES.y)[0].getAttribute(EXTREMUMS.max),
16
- xAxisName: settings.getAttribute('xLabel'),
17
- yAxisName: settings.getAttribute('yLabel'),
18
- logX: !!settings.getAttribute('logX'),
19
- };
20
- }
21
- /** Constructs {@link IFitSeriesOptions} from the series xml tag.
22
- * @param {Element} series XML series tag
23
- * @return {IFitSeriesOptions} IFitSeriesOptions for the fitted curve
24
- */
25
- function getSeriesOptions(series) {
26
- var _a, _b, _c;
27
- const params = (_b = ((_a = series.getElementsByTagName('params')[0]) === null || _a === void 0 ? void 0 : _a.childNodes[0].nodeValue)) === null || _b === void 0 ? void 0 : _b.split(',').map(Number);
28
- let funcType = (_c = series.getElementsByTagName('function')[0]) === null || _c === void 0 ? void 0 : _c.getAttribute('type');
29
- funcType = !funcType || funcType === 'sigif' ? FIT_FUNCTION_SIGMOID : funcType;
30
- const markerColor = series.getElementsByTagName('settings')[0].getAttribute('markerColor');
31
- const lineColor = series.getElementsByTagName('settings')[0].getAttribute('color');
32
- const drawLine = !!series.getElementsByTagName('settings')[0].getAttribute('drawLine');
33
- const seriesName = series.getAttribute('name');
34
- const seriesOptions = {
35
- name: seriesName,
36
- fitFunction: funcType,
37
- markerType: DG.MARKER_TYPE.CIRCLE,
38
- pointColor: markerColor,
39
- fitLineColor: lineColor,
40
- showFitLine: drawLine,
41
- showPoints: 'points',
42
- showCurveConfidenceInterval: false,
43
- clickToToggle: false
44
- };
45
- // params there are: [IC50, tan, max, min] - so we place them correctly: [max, tan, IC50, min]
46
- if (params)
47
- seriesOptions.parameters = [params[2], params[1], params[0], params[3]];
48
- return seriesOptions;
49
- }
50
- /** Constructs {@link IFitPoint} array from the grid series tag.
51
- * @param {Element} series XML series tag
52
- * @return {IFitPoint[]} IFitPoint array for current series
53
- */
54
- function getPoints(series) {
55
- var _a, _b, _c;
56
- const xCoords = (_a = (series.getElementsByTagName('x')[0].childNodes[0].nodeValue)) === null || _a === void 0 ? void 0 : _a.split(',');
57
- const yCoords = (_b = (series.getElementsByTagName('y')[0].childNodes[0].nodeValue)) === null || _b === void 0 ? void 0 : _b.split(',');
58
- const mask = (_c = (series.getElementsByTagName('mask')[0].childNodes[0].nodeValue)) === null || _c === void 0 ? void 0 : _c.split('');
59
- const points = [];
60
- for (let j = 0; j < xCoords.length; j++) {
61
- points[j] = {
62
- x: +xCoords[j],
63
- y: +yCoords[j],
64
- outlier: !Boolean(mask[j]),
65
- };
66
- }
67
- return points;
68
- }
69
- /** Constructs {@link IFitSeries} from the grid series tag.
70
- * @param {Element} series XML series tag
71
- * @return {IFitSeries} IFitSeries for the current series
72
- */
73
- function getSeries(series) {
74
- const points = getPoints(series);
75
- const currentFitSeriesOptions = getSeriesOptions(series);
76
- const returnSeries = {
77
- points: points,
78
- };
79
- Object.assign(returnSeries, currentFitSeriesOptions);
80
- return returnSeries;
81
- }
82
- /** Constructs {@link IFitSeries} array from the seriesCollection xml tag.
83
- * @param {Element} seriesCollection XML seriesCollection tag
84
- * @return {IFitSeries[]} IFitSeries array for the fitted curve
85
- */
86
- function getSeriesArray(seriesCollection) {
87
- const fitSeries = [];
88
- const seriesCollectionLength = seriesCollection.getElementsByTagName('series').length;
89
- for (let i = 0; i < seriesCollectionLength; i++) {
90
- const currentSeries = seriesCollection.getElementsByTagName('series')[i];
91
- fitSeries[i] = getSeries(currentSeries);
92
- }
93
- return fitSeries;
94
- }
95
- /** Converts XML fitted curve chart document into {@link IFitChartData} interface.
96
- * @param {string} xmlText XML document
97
- * @return {IFitChartData} IFitChartData interface for the fitted curve
98
- */
99
- export function convertXMLToIFitChartData(xmlText) {
100
- const parser = new DOMParser();
101
- const xmlDoc = parser.parseFromString(xmlText, 'text/xml');
102
- // get IFitChartOptions from grid
103
- const gridElement = xmlDoc.getElementsByTagName('grid')[0];
104
- const settingsElement = xmlDoc.getElementsByTagName('settings')[0];
105
- const fitChartOptions = getChartOptions(gridElement, settingsElement);
106
- // get the whole series collection
107
- const seriesCollection = xmlDoc.getElementsByTagName('seriesCollection')[0];
108
- // get first series to make it the default options (IFitSeriesOptions)
109
- const firstSeries = seriesCollection.getElementsByTagName('series')[0];
110
- const fitSeriesOptions = getSeriesOptions(firstSeries);
111
- // get IFitSeries[]
112
- const fitSeries = getSeriesArray(seriesCollection);
113
- return {
114
- chartOptions: fitChartOptions,
115
- seriesOptions: fitSeriesOptions,
116
- series: fitSeries
117
- };
118
- }
119
- //# sourceMappingURL=fit-parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fit-parser.js","sourceRoot":"","sources":["fit-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAML,oBAAoB,GACrB,MAAM,kDAAkD,CAAC;AAG1D,MAAM,IAAI,GAAG,EAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAC,CAAC;AACtC,MAAM,SAAS,GAAG,EAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAA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from 'datagrok-api/dg';
2
- import * as grok from 'datagrok-api/grok';
3
- import * as ui from 'datagrok-api/ui';
4
- import { statisticsProperties, CONFIDENCE_INTERVAL_FILL_COLOR, CONFIDENCE_INTERVAL_STROKE_COLOR, CURVE_CONFIDENCE_INTERVAL_BOUNDS, FIT_CELL_TYPE, fitChartDataProperties, fitSeriesProperties, } from '@datagrok-libraries/statistics/src/fit/fit-curve';
5
- import { calculateBoxPlotStatistics } from '@datagrok-libraries/statistics/src/box-plot-statistics';
6
- import { Viewport } from '@datagrok-libraries/utils/src/transform';
7
- import { StringUtils } from '@datagrok-libraries/utils/src/string-utils';
8
- import { fitSeries, createDefaultChartData, getChartBounds, getSeriesFitFunction, getSeriesConfidenceInterval, getSeriesStatistics, getCurve, getColumnChartOptions, getDataFrameChartOptions } from '@datagrok-libraries/statistics/src/fit/fit-data';
9
- import { convertXMLToIFitChartData } from './fit-parser';
10
- import { CellRenderViewer } from './cell-render-viewer';
11
- export const TAG_FIT_CHART_FORMAT = '.fitChartFormat';
12
- export const TAG_FIT_CHART_FORMAT_3DX = '3dx';
13
- const MIN_CELL_RENDERER_PX_WIDTH = 20;
14
- const MIN_CELL_RENDERER_PX_HEIGHT = 10;
15
- const MIN_POINTS_AND_STATS_VISIBILITY_PX_WIDTH = 70;
16
- const MIN_POINTS_AND_STATS_VISIBILITY_PX_HEIGHT = 45;
17
- const OUTLIER_PX_SIZE = 12;
18
- const POINT_PX_SIZE = 4;
19
- const OUTLIER_HITBOX_RADIUS = 2;
20
- const MIN_AXES_CELL_PX_WIDTH = 100;
21
- const MIN_AXES_CELL_PX_HEIGHT = 55;
22
- const MIN_TITLE_PX_WIDTH = 275;
23
- const MIN_TITLE_PX_HEIGHT = 225;
24
- const MIN_X_AXIS_NAME_VISIBILITY_PX_WIDTH = 180;
25
- const MIN_Y_AXIS_NAME_VISIBILITY_PX_HEIGHT = 140;
26
- const AXES_LEFT_PX_MARGIN = 38;
27
- const AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS = 45;
28
- const AXES_TOP_PX_MARGIN = 5;
29
- const AXES_TOP_PX_MARGIN_WITH_TITLE = 25;
30
- const AXES_RIGHT_PX_MARGIN = 18;
31
- const AXES_BOTTOM_PX_MARGIN = 15;
32
- const AXES_BOTTOM_PX_MARGIN_WITH_AXES_LABELS = 30;
33
- const CANDLESTICK_BORDER_PX_SIZE = 4;
34
- const CANDLESTICK_MEDIAN_PX_SIZE = 3.5;
35
- const CANDLESTICK_OUTLIER_PX_SIZE = 6;
36
- export const INFLATE_SIZE = -12;
37
- export const LINE_STYLES = {
38
- 'solid': [],
39
- 'dotted': [1, 1],
40
- 'dashed': [5, 5],
41
- 'dashdotted': [5, 5, 2, 5],
42
- };
43
- /** Merges properties of the two objects by iterating over the specified {@link properties}
44
- * and assigning properties from {@link source} to {@link target} only when
45
- * the property is not defined in target and is defined in source. */
46
- export function mergeProperties(properties, source, target) {
47
- if (!source || !target)
48
- return;
49
- for (const p of properties) {
50
- if (!(p.name in target) && p.name in source)
51
- target[p.name] = source[p.name];
52
- }
53
- }
54
- /** Constructs {@link IFitChartData} from the grid cell, taking into account
55
- * chart and fit settings potentially defined on the dataframe and column level. */
56
- export function getChartData(gridCell) {
57
- var _a, _b, _c, _d, _e, _f;
58
- const cellChartData = ((_b = (_a = gridCell.cell) === null || _a === void 0 ? void 0 : _a.column) === null || _b === void 0 ? void 0 : _b.type) === DG.TYPE.STRING ?
59
- (gridCell.cell.column.getTag(TAG_FIT_CHART_FORMAT) === TAG_FIT_CHART_FORMAT_3DX ?
60
- convertXMLToIFitChartData(gridCell.cell.value) :
61
- (_d = JSON.parse((_c = gridCell.cell.value) !== null && _c !== void 0 ? _c : '{}')) !== null && _d !== void 0 ? _d : {}) : createDefaultChartData();
62
- const columnChartOptions = getColumnChartOptions(gridCell.cell.column);
63
- const dfChartOptions = getDataFrameChartOptions(gridCell.cell.dataFrame);
64
- (_e = cellChartData.series) !== null && _e !== void 0 ? _e : (cellChartData.series = []);
65
- (_f = cellChartData.chartOptions) !== null && _f !== void 0 ? _f : (cellChartData.chartOptions = columnChartOptions.chartOptions);
66
- // merge cell options with column options
67
- mergeProperties(fitChartDataProperties, columnChartOptions.chartOptions, cellChartData.chartOptions);
68
- mergeProperties(fitChartDataProperties, dfChartOptions.chartOptions, cellChartData.chartOptions);
69
- for (const series of cellChartData.series) {
70
- mergeProperties(fitSeriesProperties, columnChartOptions.seriesOptions, series);
71
- mergeProperties(fitSeriesProperties, dfChartOptions.seriesOptions, series);
72
- }
73
- return cellChartData;
74
- }
75
- /** Performs a chart layout, returning [viewport, xAxis, yAxis] */
76
- export function layoutChart(rect, showAxesLabels, showTitle) {
77
- if (rect.width < MIN_AXES_CELL_PX_WIDTH || rect.height < MIN_AXES_CELL_PX_HEIGHT)
78
- return [rect, undefined, undefined];
79
- const axesLeftPxMargin = showAxesLabels ? AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS : AXES_LEFT_PX_MARGIN;
80
- const axesBottomPxMargin = showAxesLabels ? AXES_BOTTOM_PX_MARGIN_WITH_AXES_LABELS : AXES_BOTTOM_PX_MARGIN;
81
- const axesTopPxMargin = showTitle ? AXES_TOP_PX_MARGIN_WITH_TITLE : AXES_TOP_PX_MARGIN;
82
- return [
83
- rect.cutLeft(axesLeftPxMargin).cutBottom(axesBottomPxMargin).cutTop(axesTopPxMargin).cutRight(AXES_RIGHT_PX_MARGIN),
84
- rect.getBottom(axesBottomPxMargin).getTop(axesTopPxMargin).cutLeft(axesLeftPxMargin).cutRight(AXES_RIGHT_PX_MARGIN),
85
- rect.getLeft(axesLeftPxMargin).getRight(AXES_RIGHT_PX_MARGIN).cutBottom(axesBottomPxMargin).cutTop(axesTopPxMargin)
86
- ];
87
- }
88
- /** Performs candlestick border drawing */
89
- function drawCandlestickBorder(g, x, adjacentValue, transform) {
90
- g.moveTo(transform.xToScreen(x) - (CANDLESTICK_BORDER_PX_SIZE / 2), transform.yToScreen(adjacentValue));
91
- g.lineTo(transform.xToScreen(x) + (CANDLESTICK_BORDER_PX_SIZE / 2), transform.yToScreen(adjacentValue));
92
- }
93
- /** Performs candlestick drawing */
94
- function drawCandlestick(g, x, boxPlotStats, transform, ratio, markerColor) {
95
- drawCandlestickBorder(g, x, boxPlotStats.lowerAdjacentValue, transform);
96
- g.moveTo(transform.xToScreen(x), transform.yToScreen(boxPlotStats.lowerAdjacentValue));
97
- g.lineTo(transform.xToScreen(x), transform.yToScreen(boxPlotStats.upperAdjacentValue));
98
- drawCandlestickBorder(g, x, boxPlotStats.upperAdjacentValue, transform);
99
- DG.Paint.marker(g, DG.MARKER_TYPE.CIRCLE, transform.xToScreen(x), transform.yToScreen(boxPlotStats.q2), markerColor, CANDLESTICK_MEDIAN_PX_SIZE * ratio);
100
- }
101
- /** Performs points drawing */
102
- function drawPoints(g, series, transform, ratio, logOptions, pointColor) {
103
- for (let i = 0; i < series.points.length; i++) {
104
- const p = series.points[i];
105
- const color = p.outlier ? DG.Color.red :
106
- p.color ? DG.Color.fromHtml(p.color) ? DG.Color.fromHtml(p.color) : pointColor : pointColor;
107
- const marker = p.marker ? p.marker : series.markerType;
108
- const size = p.outlier ? OUTLIER_PX_SIZE * ratio : p.size ? p.size : POINT_PX_SIZE * ratio;
109
- DG.Paint.marker(g, p.outlier ? DG.MARKER_TYPE.OUTLIER : marker, transform.xToScreen(p.x), transform.yToScreen(p.y), color, size);
110
- if (p.stdev && !p.outlier) {
111
- g.strokeStyle = DG.Color.toHtml(color);
112
- g.beginPath();
113
- g.moveTo(transform.xToScreen(p.x), transform.yToScreen(p.y + p.stdev));
114
- g.lineTo(transform.xToScreen(p.x), transform.yToScreen(p.y - p.stdev));
115
- g.stroke();
116
- }
117
- }
118
- }
119
- /** Performs candles drawing */
120
- function drawCandles(g, series, transform, ratio, markerColor) {
121
- for (let i = 0, candleStart = null; i < series.points.length; i++) {
122
- const p = series.points[i];
123
- if (p.outlier)
124
- continue;
125
- const nextSame = i + 1 < series.points.length && series.points[i + 1].x === p.x;
126
- if (!candleStart && nextSame)
127
- candleStart = i;
128
- else if (candleStart !== null && !nextSame) {
129
- const values = [];
130
- for (let j = candleStart, ind = 0; j <= i; j++, ind++) {
131
- values[ind] = series.points[j].y;
132
- }
133
- const boxPlotStats = calculateBoxPlotStatistics(values);
134
- g.beginPath();
135
- drawCandlestick(g, p.x, boxPlotStats, transform, ratio, markerColor);
136
- g.stroke();
137
- if (series.showPoints === 'both') {
138
- for (let ind = 0; ind < values.length; ind++) {
139
- if (values[ind] < boxPlotStats.lowerAdjacentValue || values[ind] > boxPlotStats.upperAdjacentValue) {
140
- DG.Paint.marker(g, DG.MARKER_TYPE.OUTLIER, transform.xToScreen(p.x), transform.yToScreen(values[ind]), series.pointColor ? DG.Color.fromHtml(series.pointColor) : DG.Color.scatterPlotMarker, CANDLESTICK_OUTLIER_PX_SIZE * ratio);
141
- }
142
- }
143
- }
144
- candleStart = null;
145
- }
146
- }
147
- }
148
- /** Performs a curve confidence interval drawing */
149
- function drawConfidenceInterval(g, confIntervals, screenBounds, transform, confidenceType, showAxesLabels, logOptions) {
150
- g.beginPath();
151
- const axesLeftPxMargin = showAxesLabels ? AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS : AXES_LEFT_PX_MARGIN;
152
- const confIntervalFunc = confidenceType === CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP ?
153
- confIntervals.confidenceTop : confIntervals.confidenceBottom;
154
- for (let i = axesLeftPxMargin; i <= screenBounds.width - AXES_RIGHT_PX_MARGIN; i++) {
155
- const x = screenBounds.x + i;
156
- const xForY = logOptions.logX ? Math.log10(transform.xToWorld(x)) : transform.xToWorld(x);
157
- const y = logOptions.logY ? transform.yToScreen(Math.pow(10, confIntervalFunc(xForY))) : transform.yToScreen(confIntervalFunc(xForY));
158
- if (i === axesLeftPxMargin)
159
- g.moveTo(x, y);
160
- else
161
- g.lineTo(x, y);
162
- }
163
- g.stroke();
164
- }
165
- /** Performs a curve confidence interval color filling */
166
- function fillConfidenceInterval(g, confIntervals, screenBounds, transform, showAxesLabels, logOptions) {
167
- g.beginPath();
168
- const axesLeftPxMargin = showAxesLabels ? AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS : AXES_LEFT_PX_MARGIN;
169
- for (let i = axesLeftPxMargin; i <= screenBounds.width - AXES_RIGHT_PX_MARGIN; i++) {
170
- const x = screenBounds.x + i;
171
- const xForY = logOptions.logX ? Math.log10(transform.xToWorld(x)) : transform.xToWorld(x);
172
- const y = logOptions.logY ? transform.yToScreen(Math.pow(10, confIntervals.confidenceTop(xForY))) :
173
- transform.yToScreen(confIntervals.confidenceTop(xForY));
174
- if (i === axesLeftPxMargin)
175
- g.moveTo(x, y);
176
- else
177
- g.lineTo(x, y);
178
- }
179
- // reverse traverse to make a shape of confidence interval to fill it
180
- for (let i = screenBounds.width - AXES_RIGHT_PX_MARGIN; i >= axesLeftPxMargin; i--) {
181
- const x = screenBounds.x + i;
182
- const xForY = logOptions.logX ? Math.log10(transform.xToWorld(x)) : transform.xToWorld(x);
183
- const y = logOptions.logY ? transform.yToScreen(Math.pow(10, confIntervals.confidenceBottom(xForY))) :
184
- transform.yToScreen(confIntervals.confidenceBottom(xForY));
185
- g.lineTo(x, y);
186
- }
187
- g.closePath();
188
- g.fill();
189
- }
190
- /** Performs a dropline drawing */
191
- function drawDropline(g, transform, xValue, dataBounds, curve, logOptions) {
192
- if (logOptions.logX)
193
- xValue = Math.pow(10, xValue);
194
- const xForY = logOptions.logX ? Math.log10(xValue) : xValue;
195
- const y = logOptions.logY ? Math.pow(10, curve(xForY)) : curve(xForY);
196
- g.moveTo(transform.xToScreen(dataBounds.minX), transform.yToScreen(y));
197
- g.lineTo(transform.xToScreen(xValue), transform.yToScreen(y));
198
- g.lineTo(transform.xToScreen(xValue), transform.yToScreen(dataBounds.minY));
199
- }
200
- export class FitChartCellRenderer extends DG.GridCellRenderer {
201
- get name() { return FIT_CELL_TYPE; }
202
- get cellType() { return FIT_CELL_TYPE; }
203
- getDefaultSize(gridColumn) {
204
- return { width: 220, height: 150 };
205
- }
206
- onClick(gridCell, e) {
207
- var _a, _b, _c, _d, _e;
208
- if (!gridCell.cell.value)
209
- return;
210
- grok.shell.o = gridCell;
211
- const data = gridCell.cell.column.getTag(TAG_FIT_CHART_FORMAT) === TAG_FIT_CHART_FORMAT_3DX
212
- ? convertXMLToIFitChartData(gridCell.cell.value)
213
- : getChartData(gridCell);
214
- const screenBounds = gridCell.bounds.inflate(INFLATE_SIZE / 2, INFLATE_SIZE / 2);
215
- const showAxesLabels = gridCell.bounds.width >= MIN_X_AXIS_NAME_VISIBILITY_PX_WIDTH && gridCell.bounds.height >= MIN_Y_AXIS_NAME_VISIBILITY_PX_HEIGHT;
216
- const showTitle = gridCell.bounds.width >= MIN_TITLE_PX_WIDTH && gridCell.bounds.height >= MIN_TITLE_PX_HEIGHT;
217
- const dataBox = layoutChart(screenBounds, showAxesLabels, showTitle)[0];
218
- const dataBounds = getChartBounds(data);
219
- const viewport = new Viewport(dataBounds, dataBox, (_b = (_a = data.chartOptions) === null || _a === void 0 ? void 0 : _a.logX) !== null && _b !== void 0 ? _b : false, (_d = (_c = data.chartOptions) === null || _c === void 0 ? void 0 : _c.logY) !== null && _d !== void 0 ? _d : false);
220
- for (let i = 0; i < ((_e = data.series) === null || _e === void 0 ? void 0 : _e.length); i++) {
221
- if (!data.series[i].clickToToggle || data.series[i].showPoints !== 'points')
222
- continue;
223
- for (let j = 0; j < data.series[i].points.length; j++) {
224
- const p = data.series[i].points[j];
225
- const screenX = viewport.xToScreen(p.x);
226
- const screenY = viewport.yToScreen(p.y);
227
- const pxPerMarkerType = ((p.outlier ? OUTLIER_PX_SIZE : POINT_PX_SIZE) / 2) + OUTLIER_HITBOX_RADIUS;
228
- if (e.offsetX >= screenX - pxPerMarkerType && e.offsetX <= screenX + pxPerMarkerType &&
229
- e.offsetY >= screenY - pxPerMarkerType && e.offsetY <= screenY + pxPerMarkerType) {
230
- p.outlier = !p.outlier;
231
- const columns = gridCell.grid.dataFrame.columns.byTags({ '.sourceColumn': gridCell.cell.column.name, '.seriesNumber': i });
232
- if (columns) {
233
- const stats = getSeriesStatistics(data.series[i], getSeriesFitFunction(data.series[i]));
234
- for (const column of columns) {
235
- column.set(gridCell.cell.rowIndex, stats[column.name]);
236
- }
237
- }
238
- // temporarily works only for JSON structure
239
- if (gridCell.cell.column.getTag(TAG_FIT_CHART_FORMAT) !== TAG_FIT_CHART_FORMAT_3DX) {
240
- const gridCellValue = JSON.parse(gridCell.cell.value);
241
- gridCellValue.series[i].points[j].outlier = p.outlier;
242
- gridCell.cell.value = JSON.stringify(gridCellValue);
243
- }
244
- return;
245
- }
246
- }
247
- }
248
- }
249
- onDoubleClick(gridCell, e) {
250
- if (!gridCell.cell.value)
251
- return;
252
- const cellRenderViewer = CellRenderViewer.fromGridCell(gridCell);
253
- const dlg = ui.dialog({ title: 'Edit chart' })
254
- .add(cellRenderViewer.root)
255
- .show({ resizable: true });
256
- // canvas is created as (300, 150), so we change its size to the dialog contents box size
257
- const dlgContentsBox = dlg.root.getElementsByClassName('d4-dialog-contents dlg-edit-chart')[0].firstChild;
258
- cellRenderViewer.canvas.width = dlgContentsBox.clientWidth;
259
- cellRenderViewer.canvas.height = dlgContentsBox.clientHeight;
260
- cellRenderViewer.render();
261
- // contents ui-box isn't resizable by default
262
- dlgContentsBox.style.width = '100%';
263
- dlgContentsBox.style.height = '100%';
264
- ui.tools.handleResize(dlgContentsBox, (w, h) => {
265
- cellRenderViewer.canvas.width = w;
266
- cellRenderViewer.canvas.height = h;
267
- cellRenderViewer.render();
268
- });
269
- }
270
- renderCurves(g, x, y, w, h, data) {
271
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
272
- g.save();
273
- g.beginPath();
274
- g.rect(x, y, w, h);
275
- g.clip();
276
- const screenBounds = new DG.Rect(x, y, w, h).inflate(INFLATE_SIZE / 2, INFLATE_SIZE / 2);
277
- const showAxesLabels = w >= MIN_X_AXIS_NAME_VISIBILITY_PX_WIDTH && h >= MIN_Y_AXIS_NAME_VISIBILITY_PX_HEIGHT
278
- && !!((_a = data.chartOptions) === null || _a === void 0 ? void 0 : _a.xAxisName) && !!data.chartOptions.yAxisName;
279
- const showTitle = w >= MIN_TITLE_PX_WIDTH && h >= MIN_TITLE_PX_HEIGHT && !!((_b = data.chartOptions) === null || _b === void 0 ? void 0 : _b.title);
280
- const [dataBox, xAxisBox, yAxisBox] = layoutChart(screenBounds, showAxesLabels, showTitle);
281
- const dataBounds = getChartBounds(data);
282
- if (dataBounds.x <= 0 && data.chartOptions)
283
- data.chartOptions.logX = false;
284
- if (dataBounds.y <= 0 && data.chartOptions)
285
- data.chartOptions.logY = false;
286
- const viewport = new Viewport(dataBounds, dataBox, (_d = (_c = data.chartOptions) === null || _c === void 0 ? void 0 : _c.logX) !== null && _d !== void 0 ? _d : false, (_f = (_e = data.chartOptions) === null || _e === void 0 ? void 0 : _e.logY) !== null && _f !== void 0 ? _f : false);
287
- const minSize = Math.min(dataBox.width, dataBox.height);
288
- const ratio = minSize > 100 ? 1 : 0.2 + (minSize / 100) * 0.8;
289
- const chartLogOptions = { logX: (_g = data.chartOptions) === null || _g === void 0 ? void 0 : _g.logX, logY: (_h = data.chartOptions) === null || _h === void 0 ? void 0 : _h.logY };
290
- g.save();
291
- g.font = '11px Roboto, "Roboto Local"';
292
- viewport.drawCoordinateGrid(g, xAxisBox, yAxisBox);
293
- g.restore();
294
- for (let i = 0; i < ((_j = data.series) === null || _j === void 0 ? void 0 : _j.length); i++) {
295
- const series = data.series[i];
296
- if (w < MIN_POINTS_AND_STATS_VISIBILITY_PX_WIDTH || h < MIN_POINTS_AND_STATS_VISIBILITY_PX_HEIGHT) {
297
- series.showPoints = '';
298
- if (data.chartOptions)
299
- data.chartOptions.showStatistics = [];
300
- }
301
- series.points.sort((a, b) => a.x - b.x);
302
- let userParamsFlag = true;
303
- const fitFunc = getSeriesFitFunction(series);
304
- let curve;
305
- if (series.parameters) {
306
- if ((_k = data.chartOptions) === null || _k === void 0 ? void 0 : _k.logX) {
307
- if (series.parameters[2] > 0)
308
- series.parameters[2] = Math.log10(series.parameters[2]);
309
- }
310
- curve = getCurve(series, fitFunc);
311
- }
312
- else {
313
- const fitResult = fitSeries(series, fitFunc, chartLogOptions);
314
- curve = fitResult.fittedCurve;
315
- series.parameters = fitResult.parameters;
316
- userParamsFlag = false;
317
- }
318
- if ((_l = series.showPoints) !== null && _l !== void 0 ? _l : 'points') {
319
- const pointColor = series.pointColor ? DG.Color.fromHtml(series.pointColor) ?
320
- series.pointColor : DG.Color.toHtml(DG.Color.getCategoricalColor(i)) : DG.Color.toHtml(DG.Color.getCategoricalColor(i));
321
- g.strokeStyle = pointColor;
322
- if (series.showPoints === 'points')
323
- drawPoints(g, series, viewport, ratio, chartLogOptions, DG.Color.fromHtml(pointColor));
324
- else if (['candlesticks', 'both'].includes(series.showPoints))
325
- drawCandles(g, series, viewport, ratio, DG.Color.fromHtml(pointColor));
326
- }
327
- if ((_m = series.showFitLine) !== null && _m !== void 0 ? _m : true) {
328
- const lineColor = series.fitLineColor ? DG.Color.fromHtml(series.fitLineColor) ?
329
- series.fitLineColor : DG.Color.toHtml(DG.Color.getCategoricalColor(i)) : DG.Color.toHtml(DG.Color.getCategoricalColor(i));
330
- g.save();
331
- g.strokeStyle = lineColor;
332
- g.lineWidth = 2 * ratio;
333
- g.beginPath();
334
- if (series.lineStyle)
335
- g.setLineDash(LINE_STYLES[series.lineStyle]);
336
- const axesLeftPxMargin = showAxesLabels ? AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS : AXES_LEFT_PX_MARGIN;
337
- for (let j = axesLeftPxMargin; j <= screenBounds.width - AXES_RIGHT_PX_MARGIN; j++) {
338
- const x = screenBounds.x + j;
339
- const xForY = ((_o = data.chartOptions) === null || _o === void 0 ? void 0 : _o.logX) ? Math.log10(viewport.xToWorld(x)) : viewport.xToWorld(x);
340
- const y = ((_p = data.chartOptions) === null || _p === void 0 ? void 0 : _p.logY) ? viewport.yToScreen(Math.pow(10, curve(xForY))) : viewport.yToScreen(curve(xForY));
341
- if (j === axesLeftPxMargin)
342
- g.moveTo(x, y);
343
- else
344
- g.lineTo(x, y);
345
- }
346
- g.stroke();
347
- g.restore();
348
- }
349
- if (((_q = series.showFitLine) !== null && _q !== void 0 ? _q : true) && ((_r = series.showCurveConfidenceInterval) !== null && _r !== void 0 ? _r : false)) {
350
- g.strokeStyle = (_s = series.confidenceIntervalColor) !== null && _s !== void 0 ? _s : CONFIDENCE_INTERVAL_STROKE_COLOR;
351
- g.fillStyle = (_t = series.confidenceIntervalColor) !== null && _t !== void 0 ? _t : CONFIDENCE_INTERVAL_FILL_COLOR;
352
- const confidenceIntervals = getSeriesConfidenceInterval(series, fitFunc, userParamsFlag, chartLogOptions);
353
- drawConfidenceInterval(g, confidenceIntervals, screenBounds, viewport, CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP, showAxesLabels, chartLogOptions);
354
- drawConfidenceInterval(g, confidenceIntervals, screenBounds, viewport, CURVE_CONFIDENCE_INTERVAL_BOUNDS.BOTTOM, showAxesLabels, chartLogOptions);
355
- fillConfidenceInterval(g, confidenceIntervals, screenBounds, viewport, showAxesLabels, chartLogOptions);
356
- }
357
- if (series.droplines && showAxesLabels) {
358
- g.save();
359
- g.strokeStyle = 'blue';
360
- g.lineWidth = ratio;
361
- g.beginPath();
362
- g.setLineDash([5, 5]);
363
- for (let j = 0; j < series.droplines.length; j++) {
364
- const droplineName = series.droplines[j];
365
- if (droplineName === 'IC50')
366
- drawDropline(g, viewport, series.parameters[2], dataBounds, curve, chartLogOptions);
367
- }
368
- g.stroke();
369
- g.restore();
370
- }
371
- if ((_u = data.chartOptions) === null || _u === void 0 ? void 0 : _u.showStatistics) {
372
- const statistics = getSeriesStatistics(series, fitFunc);
373
- for (let j = 0; j < data.chartOptions.showStatistics.length; j++) {
374
- const statName = data.chartOptions.showStatistics[j];
375
- const prop = statisticsProperties.find(p => p.name === statName);
376
- if (prop) {
377
- const s = StringUtils.formatNumber(prop.get(statistics));
378
- const statColor = series.fitLineColor ? DG.Color.fromHtml(series.fitLineColor) ?
379
- series.fitLineColor : DG.Color.toHtml(DG.Color.getCategoricalColor(i)) : DG.Color.toHtml(DG.Color.getCategoricalColor(i));
380
- g.fillStyle = statColor;
381
- g.textAlign = 'left';
382
- g.fillText(prop.name + ': ' + s, dataBox.x + 5, dataBox.y + 20 + 20 * j);
383
- }
384
- }
385
- }
386
- }
387
- if (showTitle) {
388
- g.font = '12px Roboto, "Roboto Local"';
389
- g.textAlign = 'center';
390
- g.fillStyle = 'black';
391
- g.fillText((_v = data.chartOptions) === null || _v === void 0 ? void 0 : _v.title, dataBox.midX - 5, y + 15);
392
- }
393
- if (showAxesLabels) {
394
- g.font = '11px Roboto, "Roboto Local"';
395
- g.textAlign = 'center';
396
- g.fillStyle = 'black';
397
- g.fillText((_w = data.chartOptions) === null || _w === void 0 ? void 0 : _w.xAxisName, dataBox.midX - 5, y + h - 10);
398
- g.translate(x, y);
399
- g.rotate(-Math.PI / 2);
400
- const axesTopPxMargin = showTitle ? AXES_TOP_PX_MARGIN_WITH_TITLE : AXES_TOP_PX_MARGIN;
401
- g.fillText((_x = data.chartOptions) === null || _x === void 0 ? void 0 : _x.yAxisName, -(dataBox.height / 2 + axesTopPxMargin + 15), 15);
402
- g.restore();
403
- }
404
- g.restore();
405
- }
406
- render(g, x, y, w, h, gridCell, cellStyle) {
407
- if (w < MIN_CELL_RENDERER_PX_WIDTH || h < MIN_CELL_RENDERER_PX_HEIGHT)
408
- return;
409
- if (!gridCell.cell.value)
410
- return;
411
- const data = gridCell.cell.column.getTag(TAG_FIT_CHART_FORMAT) === TAG_FIT_CHART_FORMAT_3DX
412
- ? convertXMLToIFitChartData(gridCell.cell.value)
413
- : getChartData(gridCell);
414
- this.renderCurves(g, x, y, w, h, data);
415
- }
416
- onMouseMove(gridCell, e) {
417
- var _a, _b, _c, _d, _e;
418
- if (!gridCell.cell.value)
419
- return;
420
- if (gridCell.bounds.width < MIN_POINTS_AND_STATS_VISIBILITY_PX_WIDTH || gridCell.bounds.height < MIN_POINTS_AND_STATS_VISIBILITY_PX_HEIGHT) {
421
- const canvas = ui.canvas(300, 200);
422
- this.render(canvas.getContext('2d'), 0, 0, 300, 200, gridCell, null);
423
- const content = ui.divV([canvas]);
424
- ui.tooltip.show(content, e.x, e.y);
425
- }
426
- // TODO: add caching
427
- const data = gridCell.cell.column.getTag(TAG_FIT_CHART_FORMAT) === TAG_FIT_CHART_FORMAT_3DX
428
- ? convertXMLToIFitChartData(gridCell.cell.value)
429
- : getChartData(gridCell);
430
- const screenBounds = gridCell.bounds.inflate(INFLATE_SIZE / 2, INFLATE_SIZE / 2);
431
- const showAxesLabels = gridCell.bounds.width >= MIN_X_AXIS_NAME_VISIBILITY_PX_WIDTH && gridCell.bounds.height >= MIN_Y_AXIS_NAME_VISIBILITY_PX_HEIGHT;
432
- const showTitle = gridCell.bounds.width >= MIN_TITLE_PX_WIDTH && gridCell.bounds.height >= MIN_TITLE_PX_HEIGHT;
433
- const dataBox = layoutChart(screenBounds, showAxesLabels, showTitle)[0];
434
- const dataBounds = getChartBounds(data);
435
- const viewport = new Viewport(dataBounds, dataBox, (_b = (_a = data.chartOptions) === null || _a === void 0 ? void 0 : _a.logX) !== null && _b !== void 0 ? _b : false, (_d = (_c = data.chartOptions) === null || _c === void 0 ? void 0 : _c.logY) !== null && _d !== void 0 ? _d : false);
436
- for (let i = 0; i < ((_e = data.series) === null || _e === void 0 ? void 0 : _e.length); i++) {
437
- if (!data.series[i].clickToToggle || data.series[i].showPoints !== 'points')
438
- continue;
439
- for (let j = 0; j < data.series[i].points.length; j++) {
440
- const p = data.series[i].points[j];
441
- const screenX = viewport.xToScreen(p.x);
442
- const screenY = viewport.yToScreen(p.y);
443
- const pxPerMarkerType = ((p.outlier ? OUTLIER_PX_SIZE : POINT_PX_SIZE) / 2) + OUTLIER_HITBOX_RADIUS;
444
- if (e.offsetX >= screenX - pxPerMarkerType && e.offsetX <= screenX + pxPerMarkerType &&
445
- e.offsetY >= screenY - pxPerMarkerType && e.offsetY <= screenY + pxPerMarkerType) {
446
- document.body.style.cursor = 'pointer';
447
- return;
448
- }
449
- }
450
- }
451
- document.body.style.cursor = 'default';
452
- }
453
- }
454
- const sample = {
455
- // chartOptions could be retrieved either from the column, or from the cell
456
- 'chartOptions': {
457
- 'minX': 0, 'minY': 0, 'maxX': 5, 'maxY': 10,
458
- 'xAxisName': 'concentration',
459
- 'yAxisName': 'activity',
460
- 'logX': false,
461
- 'logY': false,
462
- },
463
- // These options are used as default options for the series. They could be overridden in series.
464
- 'seriesOptions': {
465
- 'fitFunction': 'sigmoid',
466
- // parameters not specified -> auto-fitting by default
467
- 'pointColor': 'blue',
468
- 'fitLineColor': 'red',
469
- 'clickToToggle': true,
470
- 'showPoints': 'points',
471
- 'showFitLine': true,
472
- 'showCurveConfidenceInterval': true,
473
- },
474
- 'series': [
475
- {
476
- 'fitFunction': 'sigmoid',
477
- // parameters specified -> use them, no autofitting
478
- 'parameters': [1.86011e-07, -0.900, 103.748, -0.001],
479
- 'points': [
480
- { 'x': 0, 'y': 0 },
481
- { 'x': 1, 'y': 0.5 },
482
- { 'x': 2, 'y': 1 },
483
- { 'x': 3, 'y': 10, 'outlier': true },
484
- { 'x': 4, 'y': 0 },
485
- ],
486
- },
487
- ],
488
- };
489
- //# sourceMappingURL=fit-renderer.js.map