@datagrok/curves 1.0.1 → 1.1.0
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/detectors.js +3 -1
- package/dist/package-test.js +15045 -100
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +65 -78
- package/dist/package.js.map +1 -1
- package/package.json +1 -1
- package/src/fit/cell-render-viewer.js.map +1 -1
- package/src/fit/cell-render-viewer.ts +6 -5
- package/src/fit/fit-data.js +22 -28
- package/src/fit/fit-data.js.map +1 -1
- package/src/fit/fit-data.ts +32 -39
- package/src/fit/fit-demo.js +8 -7
- package/src/fit/fit-demo.js.map +1 -1
- package/src/fit/fit-demo.ts +11 -11
- package/src/fit/fit-grid-cell-handler.js +8 -11
- package/src/fit/fit-grid-cell-handler.js.map +1 -1
- package/src/fit/fit-grid-cell-handler.ts +9 -13
- package/src/fit/fit-renderer.js +32 -35
- package/src/fit/fit-renderer.js.map +1 -1
- package/src/fit/fit-renderer.ts +30 -33
- package/src/fit/multi-curve-viewer.js +3 -3
- package/src/fit/multi-curve-viewer.js.map +1 -1
- package/src/fit/multi-curve-viewer.ts +11 -9
- package/src/fit/transform.js +2 -2
- package/src/fit/transform.js.map +1 -1
- package/src/fit/transform.ts +7 -9
- package/src/package-test.js +1 -1
- package/src/package-test.js.map +1 -1
- package/src/package-test.ts +1 -1
- package/src/tests/detector-tests.js +38 -0
- package/src/tests/detector-tests.js.map +1 -0
- package/src/tests/detector-tests.ts +34 -0
- package/src/tests/fit-viewer-test.js +0 -16
- package/src/tests/fit-viewer-test.js.map +0 -1
- package/src/tests/fit-viewer-test.ts +0 -11
package/dist/package.js
CHANGED
|
@@ -14602,9 +14602,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
14602
14602
|
/* harmony export */ "getChartBounds": () => (/* binding */ getChartBounds),
|
|
14603
14603
|
/* harmony export */ "getChartData": () => (/* binding */ getChartData),
|
|
14604
14604
|
/* harmony export */ "getColumnChartOptions": () => (/* binding */ getColumnChartOptions),
|
|
14605
|
-
/* harmony export */ "getConfidenceIntrevals": () => (/* binding */ getConfidenceIntrevals),
|
|
14606
14605
|
/* harmony export */ "getDataBounds": () => (/* binding */ getDataBounds),
|
|
14607
|
-
/* harmony export */ "getFittedCurve": () => (/* binding */ getFittedCurve),
|
|
14608
14606
|
/* harmony export */ "mergeProperties": () => (/* binding */ mergeProperties)
|
|
14609
14607
|
/* harmony export */ });
|
|
14610
14608
|
/* harmony import */ var datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! datagrok-api/dg */ "datagrok-api/dg");
|
|
@@ -14647,6 +14645,7 @@ const CURVE_CONFIDENCE_INTERVAL_BOUNDS = {
|
|
|
14647
14645
|
TOP: 'top',
|
|
14648
14646
|
BOTTOM: 'bottom'
|
|
14649
14647
|
};
|
|
14648
|
+
/** Class that implements {@link IFitChartData} interface */
|
|
14650
14649
|
class FitChartData {
|
|
14651
14650
|
constructor() {
|
|
14652
14651
|
this.chartOptions = {};
|
|
@@ -14682,7 +14681,7 @@ const fitSeriesProperties = [
|
|
|
14682
14681
|
function createFromProperties(properties) {
|
|
14683
14682
|
const o = {};
|
|
14684
14683
|
for (const p of properties) {
|
|
14685
|
-
if (p.defaultValue
|
|
14684
|
+
if (p.defaultValue !== null)
|
|
14686
14685
|
o[p.name] = p.defaultValue;
|
|
14687
14686
|
}
|
|
14688
14687
|
return o;
|
|
@@ -14698,6 +14697,7 @@ function mergeProperties(properties, source, target) {
|
|
|
14698
14697
|
target[p.name] = source[p.name];
|
|
14699
14698
|
}
|
|
14700
14699
|
}
|
|
14700
|
+
/** Creates default {@link IFitChartData} object */
|
|
14701
14701
|
function createDefaultChartData() {
|
|
14702
14702
|
return {
|
|
14703
14703
|
chartOptions: createFromProperties(fitChartDataProperties),
|
|
@@ -14710,6 +14710,7 @@ function getColumnChartOptions(gridColumn) {
|
|
|
14710
14710
|
var _b;
|
|
14711
14711
|
return (_a = (_b = gridColumn.temp)[TAG_FIT]) !== null && _a !== void 0 ? _a : (_b[TAG_FIT] = createDefaultChartData());
|
|
14712
14712
|
}
|
|
14713
|
+
/** Returns the bounds of an {@link IFitChartData} object */
|
|
14713
14714
|
function getChartBounds(chartData) {
|
|
14714
14715
|
var _a;
|
|
14715
14716
|
const o = chartData.chartOptions;
|
|
@@ -14726,6 +14727,7 @@ function getChartBounds(chartData) {
|
|
|
14726
14727
|
}
|
|
14727
14728
|
}
|
|
14728
14729
|
//TODO: move to DG.Rect
|
|
14730
|
+
/** Gets the bounds of provided points */
|
|
14729
14731
|
function getDataBounds(points) {
|
|
14730
14732
|
let minX = points[0].x;
|
|
14731
14733
|
let minY = points[0].y;
|
|
@@ -14741,18 +14743,8 @@ function getDataBounds(points) {
|
|
|
14741
14743
|
}
|
|
14742
14744
|
/** Fits the series data according to the series fitting settings */
|
|
14743
14745
|
function fitSeries(series, statistics = false) {
|
|
14744
|
-
//TODO: optimize the calculation of the initial parameters
|
|
14745
14746
|
const dataBounds = getDataBounds(series.points);
|
|
14746
|
-
// const ys = series.points.map((p) => p.y);
|
|
14747
|
-
// const medY = ys[Math.floor(series.points.length / 2)];
|
|
14748
14747
|
const medY = (dataBounds.bottom - dataBounds.top) / 2 + dataBounds.top;
|
|
14749
|
-
let xAtMedY = -1;
|
|
14750
|
-
// for (let i = 0; i < series.points.length; i++) {
|
|
14751
|
-
// if (series.points[i].y === medY) {
|
|
14752
|
-
// xAtMedY = series.points[i].x;
|
|
14753
|
-
// break;
|
|
14754
|
-
// }
|
|
14755
|
-
// }
|
|
14756
14748
|
let maxYInterval = dataBounds.bottom - dataBounds.top;
|
|
14757
14749
|
let nearestXIndex = 0;
|
|
14758
14750
|
for (let i = 0; i < series.points.length; i++) {
|
|
@@ -14762,31 +14754,31 @@ function fitSeries(series, statistics = false) {
|
|
|
14762
14754
|
nearestXIndex = i;
|
|
14763
14755
|
}
|
|
14764
14756
|
}
|
|
14765
|
-
xAtMedY = series.points[nearestXIndex].x;
|
|
14766
|
-
|
|
14757
|
+
const xAtMedY = series.points[nearestXIndex].x;
|
|
14758
|
+
const slope = series.points[0].y > series.points[series.points.length - 1].y ? 1.2 : -1.2;
|
|
14767
14759
|
// params are: [max, tan, IC50, min]
|
|
14768
14760
|
const initialParams = [{ value: dataBounds.bottom }, { value: slope }, { value: xAtMedY }, { value: dataBounds.top }];
|
|
14769
14761
|
return (0,_datagrok_libraries_statistics_src_parameter_estimation_fit_curve__WEBPACK_IMPORTED_MODULE_3__.fit)({ x: series.points.map((p) => p.x), y: series.points.map((p) => p.y) }, initialParams, _datagrok_libraries_statistics_src_parameter_estimation_fit_curve__WEBPACK_IMPORTED_MODULE_3__.sigmoid, _datagrok_libraries_statistics_src_parameter_estimation_fit_curve__WEBPACK_IMPORTED_MODULE_3__.FitErrorModel.Constant, 0.05, statistics);
|
|
14770
14762
|
}
|
|
14771
|
-
/** Returns a curve function, either using the pre-computed parameters
|
|
14772
|
-
|
|
14773
|
-
function getFittedCurve(series) {
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
}
|
|
14779
|
-
/** Returns confidence interval functions */
|
|
14780
|
-
function
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
}
|
|
14763
|
+
// /** Returns a curve function, either using the pre-computed parameters
|
|
14764
|
+
// * or by fitting on-the-fly */
|
|
14765
|
+
// export function getFittedCurve(series: IFitSeries): (x: number) => number {
|
|
14766
|
+
// if (series.parameters)
|
|
14767
|
+
// return (x) => sigmoid(series.parameters!, x);
|
|
14768
|
+
// else
|
|
14769
|
+
// return fitSeries(series).fittedCurve;
|
|
14770
|
+
// }
|
|
14771
|
+
// /** Returns confidence interval functions */
|
|
14772
|
+
// export function getConfidenceIntervals(series: IFitSeries): {top: (x: number) => number, bottom: (x: number) => number} {
|
|
14773
|
+
// const confTop = fitSeries(series).confidenceTop;
|
|
14774
|
+
// const confBottom = fitSeries(series).confidenceBottom;
|
|
14775
|
+
// return {top: confTop, bottom: confBottom};
|
|
14776
|
+
// }
|
|
14785
14777
|
/** Constructs {@link IFitChartData} from the grid cell, taking into account
|
|
14786
14778
|
* chart and fit settings potentially defined on the dataframe and column level. */
|
|
14787
14779
|
function getChartData(gridCell) {
|
|
14788
14780
|
var _a, _b, _c, _d, _e, _f;
|
|
14789
|
-
const cellChartData = ((_b = (_a = gridCell.cell) === null || _a === void 0 ? void 0 : _a.column) === null || _b === void 0 ? void 0 : _b.type)
|
|
14781
|
+
const cellChartData = ((_b = (_a = gridCell.cell) === null || _a === void 0 ? void 0 : _a.column) === null || _b === void 0 ? void 0 : _b.type) === datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.TYPE.STRING ?
|
|
14790
14782
|
((_d = JSON.parse((_c = gridCell.cell.value) !== null && _c !== void 0 ? _c : '{}')) !== null && _d !== void 0 ? _d : {}) : createDefaultChartData();
|
|
14791
14783
|
const columnChartOptions = getColumnChartOptions(gridCell.gridColumn);
|
|
14792
14784
|
(_e = cellChartData.series) !== null && _e !== void 0 ? _e : (cellChartData.series = []);
|
|
@@ -14871,6 +14863,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|
|
14871
14863
|
|
|
14872
14864
|
|
|
14873
14865
|
|
|
14866
|
+
/** Returns random number from the interval */
|
|
14874
14867
|
function rnd(min, max) {
|
|
14875
14868
|
return Math.random() * (max - min) + min;
|
|
14876
14869
|
}
|
|
@@ -14888,7 +14881,7 @@ function createSigmoidPoints(length, step, pointsPerX = 1) {
|
|
|
14888
14881
|
}
|
|
14889
14882
|
}
|
|
14890
14883
|
// adding 20% noise
|
|
14891
|
-
const range = (pointsPerX
|
|
14884
|
+
const range = (pointsPerX === 1 ? 0.2 : 0.4) * (Math.max(...y) - Math.min(...y));
|
|
14892
14885
|
const minY = Math.min(...y);
|
|
14893
14886
|
for (let i = 0; i < x.length; i++) {
|
|
14894
14887
|
y[i] = -minY + y[i] + rnd(0, range);
|
|
@@ -14911,21 +14904,21 @@ function createDemoDataFrame(rowCount, chartsCount, chartsPerCell) {
|
|
|
14911
14904
|
dataFrameColumn.set(i, df);
|
|
14912
14905
|
}
|
|
14913
14906
|
for (let colIdx = 0; colIdx < chartsCount; colIdx++) {
|
|
14914
|
-
const pointsPerX = colIdx
|
|
14907
|
+
const pointsPerX = colIdx === 3 ? 5 : 1;
|
|
14915
14908
|
const jsonColumn = df.columns.addNewString(`json chart ${colIdx}`); // charts as json
|
|
14916
14909
|
jsonColumn.semType = _fit_data__WEBPACK_IMPORTED_MODULE_2__.FIT_SEM_TYPE;
|
|
14917
|
-
let charts = colIdx % 2
|
|
14910
|
+
let charts = colIdx % 2 === 0 ? chartsPerCell : 1;
|
|
14918
14911
|
for (let i = 0; i < rowCount; i++) {
|
|
14919
14912
|
const chartData = {
|
|
14920
14913
|
//chartOptions: { minX: -10, minY: -2, maxX: 10, maxY: 2},
|
|
14921
14914
|
series: [],
|
|
14922
|
-
chartOptions: charts
|
|
14915
|
+
chartOptions: charts === 1 ? { showStatistics: ['auc'] } : undefined
|
|
14923
14916
|
};
|
|
14924
14917
|
for (let j = 0; j < charts; j++) {
|
|
14925
14918
|
const points = createSigmoidPoints(seriesLength, step, pointsPerX);
|
|
14926
14919
|
let color = datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.Color.toHtml(datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.Color.getCategoricalColor(colIdx * chartsPerCell + j));
|
|
14927
14920
|
(_a = chartData.series) === null || _a === void 0 ? void 0 : _a.push({
|
|
14928
|
-
parameters: j % 2
|
|
14921
|
+
parameters: j % 2 === 0 ? points.params : undefined,
|
|
14929
14922
|
fitLineColor: color,
|
|
14930
14923
|
pointColor: color,
|
|
14931
14924
|
showCurveConfidenceInterval: charts === 1,
|
|
@@ -14973,15 +14966,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
14973
14966
|
|
|
14974
14967
|
|
|
14975
14968
|
|
|
14976
|
-
|
|
14977
|
-
|
|
14978
|
-
|
|
14979
14969
|
function addStatisticsColumn(chartColumn, p) {
|
|
14980
14970
|
const grid = chartColumn.grid;
|
|
14981
14971
|
grid.dataFrame.columns
|
|
14982
14972
|
.addNew(p.name, p.propertyType)
|
|
14983
14973
|
.init((i) => {
|
|
14984
|
-
const chartData = _fit_data__WEBPACK_IMPORTED_MODULE_2__.getChartData(datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.GridCell.fromColumnRow(grid, chartColumn.name, grid.tableRowToGrid(i)));
|
|
14974
|
+
const chartData = (0,_fit_data__WEBPACK_IMPORTED_MODULE_2__.getChartData)(datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.GridCell.fromColumnRow(grid, chartColumn.name, grid.tableRowToGrid(i)));
|
|
14985
14975
|
const fitResult = (0,_fit_data__WEBPACK_IMPORTED_MODULE_2__.fitSeries)(chartData.series[0], true);
|
|
14986
14976
|
return p.get(fitResult);
|
|
14987
14977
|
});
|
|
@@ -14995,8 +14985,8 @@ class FitGridCellHandler extends datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.Ob
|
|
|
14995
14985
|
}
|
|
14996
14986
|
renderProperties(gridCell, context = null) {
|
|
14997
14987
|
const acc = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_1__.accordion();
|
|
14998
|
-
const chartData = _fit_data__WEBPACK_IMPORTED_MODULE_2__.getChartData(gridCell);
|
|
14999
|
-
const columnChartOptions = _fit_data__WEBPACK_IMPORTED_MODULE_2__.getColumnChartOptions(gridCell.gridColumn);
|
|
14988
|
+
const chartData = (0,_fit_data__WEBPACK_IMPORTED_MODULE_2__.getChartData)(gridCell);
|
|
14989
|
+
const columnChartOptions = (0,_fit_data__WEBPACK_IMPORTED_MODULE_2__.getColumnChartOptions)(gridCell.gridColumn);
|
|
15000
14990
|
const refresh = { onValueChanged: (_) => gridCell.grid.invalidate() };
|
|
15001
14991
|
acc.addPane('Options', () => datagrok_api_ui__WEBPACK_IMPORTED_MODULE_1__.divV([
|
|
15002
14992
|
datagrok_api_ui__WEBPACK_IMPORTED_MODULE_1__.input.form(columnChartOptions.seriesOptions, _fit_data__WEBPACK_IMPORTED_MODULE_2__.fitSeriesProperties, refresh),
|
|
@@ -15004,7 +14994,7 @@ class FitGridCellHandler extends datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.Ob
|
|
|
15004
14994
|
]));
|
|
15005
14995
|
acc.addPane('Results', () => {
|
|
15006
14996
|
var _a;
|
|
15007
|
-
const host =
|
|
14997
|
+
const host = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_1__.divV([]);
|
|
15008
14998
|
for (let i = 0; i < chartData.series.length; i++) {
|
|
15009
14999
|
const series = chartData.series[i];
|
|
15010
15000
|
const fitResult = (0,_fit_data__WEBPACK_IMPORTED_MODULE_2__.fitSeries)(series, true);
|
|
@@ -15197,14 +15187,13 @@ function layoutChart(rect) {
|
|
|
15197
15187
|
];
|
|
15198
15188
|
}
|
|
15199
15189
|
/** Performs a curve confidence interval drawing */
|
|
15200
|
-
function drawConfidenceInterval(g, series,
|
|
15201
|
-
//const fitResult = fitSeries(series);
|
|
15190
|
+
function drawConfidenceInterval(g, series, fitResult, transform, confidenceType) {
|
|
15202
15191
|
g.beginPath();
|
|
15203
15192
|
for (let i = 0; i < series.points.length; i++) {
|
|
15204
15193
|
const x = transform.xToScreen(series.points[i].x);
|
|
15205
|
-
const y = confidenceType === _fit_data__WEBPACK_IMPORTED_MODULE_5__.CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP
|
|
15206
|
-
|
|
15207
|
-
|
|
15194
|
+
const y = confidenceType === _fit_data__WEBPACK_IMPORTED_MODULE_5__.CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP ?
|
|
15195
|
+
transform.yToScreen(fitResult.confidenceTop(series.points[i].x)) :
|
|
15196
|
+
transform.yToScreen(fitResult.confidenceBottom(series.points[i].x));
|
|
15208
15197
|
if (i === 0)
|
|
15209
15198
|
g.moveTo(x, y);
|
|
15210
15199
|
else
|
|
@@ -15212,9 +15201,8 @@ function drawConfidenceInterval(g, series, confidenceType, fitResult, transform)
|
|
|
15212
15201
|
}
|
|
15213
15202
|
g.stroke();
|
|
15214
15203
|
}
|
|
15215
|
-
/** Performs a curve confidence interval filling */
|
|
15216
|
-
function fillConfidenceInterval(g, series, transform) {
|
|
15217
|
-
const fitResult = (0,_fit_data__WEBPACK_IMPORTED_MODULE_5__.fitSeries)(series);
|
|
15204
|
+
/** Performs a curve confidence interval color filling */
|
|
15205
|
+
function fillConfidenceInterval(g, series, fitResult, transform) {
|
|
15218
15206
|
g.beginPath();
|
|
15219
15207
|
for (let i = 0; i < series.points.length; i++) {
|
|
15220
15208
|
const x = transform.xToScreen(series.points[i].x);
|
|
@@ -15248,7 +15236,7 @@ class FitChartCellRenderer extends datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.
|
|
|
15248
15236
|
.show();
|
|
15249
15237
|
}
|
|
15250
15238
|
renderCurves(g, x, y, w, h, data) {
|
|
15251
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
15239
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
15252
15240
|
g.save();
|
|
15253
15241
|
g.beginPath();
|
|
15254
15242
|
g.rect(x, y, w, h);
|
|
@@ -15261,14 +15249,16 @@ class FitChartCellRenderer extends datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.
|
|
|
15261
15249
|
const ratio = minSize > 100 ? 1 : 0.2 + (minSize / 100) * 0.8;
|
|
15262
15250
|
viewport.drawCoordinateGrid(g, xAxisBox, yAxisBox);
|
|
15263
15251
|
for (const series of data.series) {
|
|
15264
|
-
|
|
15265
|
-
|
|
15252
|
+
series.points.sort((a, b) => a.x - b.x);
|
|
15253
|
+
const fitResult = (0,_fit_data__WEBPACK_IMPORTED_MODULE_5__.fitSeries)(series, !!((_e = data.chartOptions) === null || _e === void 0 ? void 0 : _e.showStatistics));
|
|
15254
|
+
if ((_f = series.showPoints) !== null && _f !== void 0 ? _f : true) {
|
|
15255
|
+
g.strokeStyle = (_g = series.pointColor) !== null && _g !== void 0 ? _g : '0xFF40699c';
|
|
15266
15256
|
for (let i = 0, candleStart = null; i < series.points.length; i++) {
|
|
15267
15257
|
const p = series.points[i];
|
|
15268
|
-
const nextSame = i + 1 < series.points.length && series.points[i + 1].x
|
|
15258
|
+
const nextSame = i + 1 < series.points.length && series.points[i + 1].x === p.x;
|
|
15269
15259
|
if (!candleStart && nextSame)
|
|
15270
15260
|
candleStart = i;
|
|
15271
|
-
else if (candleStart
|
|
15261
|
+
else if (candleStart !== null && !nextSame) {
|
|
15272
15262
|
let minY = series.points[candleStart].y;
|
|
15273
15263
|
let maxY = minY;
|
|
15274
15264
|
for (let j = candleStart; j < i; j++) {
|
|
@@ -15286,39 +15276,36 @@ class FitChartCellRenderer extends datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.
|
|
|
15286
15276
|
}
|
|
15287
15277
|
}
|
|
15288
15278
|
}
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
g.strokeStyle = (_h = series.fitLineColor) !== null && _h !== void 0 ? _h : 'black';
|
|
15279
|
+
if ((_h = series.showFitLine) !== null && _h !== void 0 ? _h : true) {
|
|
15280
|
+
g.strokeStyle = (_j = series.fitLineColor) !== null && _j !== void 0 ? _j : 'black';
|
|
15292
15281
|
g.lineWidth = 2 * ratio;
|
|
15293
|
-
|
|
15294
|
-
const curve = fitRes.fittedCurve; //getFittedCurve(series);
|
|
15282
|
+
const curve = fitResult.fittedCurve;
|
|
15295
15283
|
g.beginPath();
|
|
15296
15284
|
for (let i = 0; i < series.points.length; i++) {
|
|
15297
15285
|
const x = viewport.xToScreen(series.points[i].x);
|
|
15298
15286
|
const y = viewport.yToScreen(curve(series.points[i].x));
|
|
15299
|
-
if (i
|
|
15287
|
+
if (i === 0)
|
|
15300
15288
|
g.moveTo(x, y);
|
|
15301
15289
|
else
|
|
15302
15290
|
g.lineTo(x, y);
|
|
15303
15291
|
}
|
|
15304
15292
|
g.stroke();
|
|
15305
15293
|
}
|
|
15306
|
-
if (((
|
|
15307
|
-
g.strokeStyle = (
|
|
15308
|
-
g.fillStyle = (
|
|
15309
|
-
drawConfidenceInterval(g, series, _fit_data__WEBPACK_IMPORTED_MODULE_5__.CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP
|
|
15310
|
-
drawConfidenceInterval(g, series, _fit_data__WEBPACK_IMPORTED_MODULE_5__.CURVE_CONFIDENCE_INTERVAL_BOUNDS.BOTTOM
|
|
15311
|
-
fillConfidenceInterval(g, series, viewport);
|
|
15294
|
+
if (((_k = series.showFitLine) !== null && _k !== void 0 ? _k : true) && ((_l = series.showCurveConfidenceInterval) !== null && _l !== void 0 ? _l : true)) {
|
|
15295
|
+
g.strokeStyle = (_m = series.confidenceIntervalColor) !== null && _m !== void 0 ? _m : _fit_data__WEBPACK_IMPORTED_MODULE_5__.CONFIDENCE_INTERVAL_STROKE_COLOR;
|
|
15296
|
+
g.fillStyle = (_o = series.confidenceIntervalColor) !== null && _o !== void 0 ? _o : _fit_data__WEBPACK_IMPORTED_MODULE_5__.CONFIDENCE_INTERVAL_FILL_COLOR;
|
|
15297
|
+
drawConfidenceInterval(g, series, fitResult, viewport, _fit_data__WEBPACK_IMPORTED_MODULE_5__.CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP);
|
|
15298
|
+
drawConfidenceInterval(g, series, fitResult, viewport, _fit_data__WEBPACK_IMPORTED_MODULE_5__.CURVE_CONFIDENCE_INTERVAL_BOUNDS.BOTTOM);
|
|
15299
|
+
fillConfidenceInterval(g, series, fitResult, viewport);
|
|
15312
15300
|
}
|
|
15313
|
-
if ((
|
|
15314
|
-
let fitResult = (0,_fit_data__WEBPACK_IMPORTED_MODULE_5__.fitSeries)(series, true);
|
|
15301
|
+
if ((_p = data.chartOptions) === null || _p === void 0 ? void 0 : _p.showStatistics) {
|
|
15315
15302
|
for (let i = 0; i < data.chartOptions.showStatistics.length; i++) {
|
|
15316
15303
|
const statName = data.chartOptions.showStatistics[i];
|
|
15317
|
-
const prop = _datagrok_libraries_statistics_src_parameter_estimation_fit_curve__WEBPACK_IMPORTED_MODULE_3__.fitResultProperties.find(p => p.name
|
|
15304
|
+
const prop = _datagrok_libraries_statistics_src_parameter_estimation_fit_curve__WEBPACK_IMPORTED_MODULE_3__.fitResultProperties.find(p => p.name === statName);
|
|
15318
15305
|
if (prop) {
|
|
15319
15306
|
const s = _datagrok_libraries_utils_src_string_utils__WEBPACK_IMPORTED_MODULE_4__.StringUtils.formatNumber(prop.get(fitResult));
|
|
15320
|
-
g.fillStyle = (
|
|
15321
|
-
g.textAlign =
|
|
15307
|
+
g.fillStyle = (_q = series.fitLineColor) !== null && _q !== void 0 ? _q : 'black';
|
|
15308
|
+
g.textAlign = 'left';
|
|
15322
15309
|
g.fillText(prop.name + ': ' + s, dataBox.x + 5, dataBox.y + 20 + 20 * i);
|
|
15323
15310
|
}
|
|
15324
15311
|
}
|
|
@@ -15337,7 +15324,7 @@ class FitChartCellRenderer extends datagrok_api_dg__WEBPACK_IMPORTED_MODULE_0__.
|
|
|
15337
15324
|
onMouseMove(gridCell, e) {
|
|
15338
15325
|
if (gridCell.bounds.width < 50) {
|
|
15339
15326
|
const canvas = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_2__.canvas(300, 200);
|
|
15340
|
-
this.render(canvas.getContext(
|
|
15327
|
+
this.render(canvas.getContext('2d'), 0, 0, 300, 200, gridCell, null);
|
|
15341
15328
|
const content = datagrok_api_ui__WEBPACK_IMPORTED_MODULE_2__.divV([canvas]);
|
|
15342
15329
|
datagrok_api_ui__WEBPACK_IMPORTED_MODULE_2__.tooltip.show(content, e.x, e.y);
|
|
15343
15330
|
}
|
|
@@ -15397,11 +15384,11 @@ class MultiCurveViewer extends _cell_render_viewer__WEBPACK_IMPORTED_MODULE_0__.
|
|
|
15397
15384
|
createChartData() {
|
|
15398
15385
|
var _a, _b;
|
|
15399
15386
|
this.rows.length = 0;
|
|
15400
|
-
if (this.showCurrentRowCurve && this.dataFrame.currentRowIdx
|
|
15387
|
+
if (this.showCurrentRowCurve && this.dataFrame.currentRowIdx !== -1)
|
|
15401
15388
|
this.rows.push(this.dataFrame.currentRowIdx);
|
|
15402
|
-
if (this.showMouseOverRowCurve && this.dataFrame.mouseOverRowIdx
|
|
15389
|
+
if (this.showMouseOverRowCurve && this.dataFrame.mouseOverRowIdx !== -1)
|
|
15403
15390
|
this.rows.push(this.dataFrame.mouseOverRowIdx);
|
|
15404
|
-
if (this.showSelectedRowsCurves && this.dataFrame.mouseOverRowIdx
|
|
15391
|
+
if (this.showSelectedRowsCurves && this.dataFrame.mouseOverRowIdx !== -1)
|
|
15405
15392
|
this.rows.push(...this.dataFrame.selection.getSelectedIndexes());
|
|
15406
15393
|
this.data = new _fit_data__WEBPACK_IMPORTED_MODULE_2__.FitChartData();
|
|
15407
15394
|
const grid = (_a = this.tableView) === null || _a === void 0 ? void 0 : _a.grid;
|
|
@@ -15473,9 +15460,9 @@ class _LogTransform {
|
|
|
15473
15460
|
if (world <= 0)
|
|
15474
15461
|
return NaN;
|
|
15475
15462
|
//eliminates problems with rounding
|
|
15476
|
-
if (world
|
|
15463
|
+
if (world === min)
|
|
15477
15464
|
return inverse ? length : 0.0;
|
|
15478
|
-
if (world
|
|
15465
|
+
if (world === max)
|
|
15479
15466
|
return inverse ? 0.0 : length;
|
|
15480
15467
|
min = (min < 0.00000001 ? 0.00000001 : min);
|
|
15481
15468
|
world = (world < 0.00000001 ? 0.00000001 : world);
|