@datagrok/curves 1.2.6 → 1.2.7
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 +27 -0
- package/README.md +3 -0
- package/dist/package-test.js +131 -166
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +299 -81
- package/dist/package.js.map +1 -1
- package/package.json +2 -2
- package/src/fit/cell-render-viewer.js +7 -0
- package/src/fit/cell-render-viewer.js.map +1 -1
- package/src/fit/cell-render-viewer.ts +8 -0
- package/src/fit/fit-grid-cell-handler.js +172 -9
- package/src/fit/fit-grid-cell-handler.js.map +1 -1
- package/src/fit/fit-grid-cell-handler.ts +174 -8
- package/src/fit/fit-renderer.js +71 -41
- package/src/fit/fit-renderer.js.map +1 -1
- package/src/fit/fit-renderer.ts +77 -43
- package/src/tests/transform-tests.js +2 -2
- package/src/tests/transform-tests.js.map +1 -1
- package/src/tests/transform-tests.ts +2 -2
package/src/fit/fit-renderer.ts
CHANGED
|
@@ -28,11 +28,12 @@ import {
|
|
|
28
28
|
getSeriesStatistics,
|
|
29
29
|
getCurve,
|
|
30
30
|
getColumnChartOptions,
|
|
31
|
-
LogOptions
|
|
31
|
+
LogOptions,
|
|
32
|
+
getDataFrameChartOptions
|
|
32
33
|
} from '@datagrok-libraries/statistics/src/fit/fit-data';
|
|
33
34
|
|
|
34
35
|
import {convertXMLToIFitChartData} from './fit-parser';
|
|
35
|
-
import {
|
|
36
|
+
import {CellRenderViewer} from './cell-render-viewer';
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
export const TAG_FIT_CHART_FORMAT = '.fitChartFormat';
|
|
@@ -44,10 +45,10 @@ const MIN_POINTS_AND_STATS_VISIBILITY_PX_HEIGHT = 45;
|
|
|
44
45
|
const OUTLIER_PX_SIZE = 12;
|
|
45
46
|
const POINT_PX_SIZE = 4;
|
|
46
47
|
const OUTLIER_HITBOX_RADIUS = 2;
|
|
47
|
-
const MIN_AXES_CELL_PX_WIDTH =
|
|
48
|
+
const MIN_AXES_CELL_PX_WIDTH = 100;
|
|
48
49
|
const MIN_AXES_CELL_PX_HEIGHT = 55;
|
|
49
|
-
const MIN_TITLE_PX_WIDTH =
|
|
50
|
-
const MIN_TITLE_PX_HEIGHT =
|
|
50
|
+
const MIN_TITLE_PX_WIDTH = 275;
|
|
51
|
+
const MIN_TITLE_PX_HEIGHT = 225;
|
|
51
52
|
const MIN_X_AXIS_NAME_VISIBILITY_PX_WIDTH = 180;
|
|
52
53
|
const MIN_Y_AXIS_NAME_VISIBILITY_PX_HEIGHT = 140;
|
|
53
54
|
const AXES_LEFT_PX_MARGIN = 38;
|
|
@@ -90,28 +91,32 @@ export function getChartData(gridCell: DG.GridCell): IFitChartData {
|
|
|
90
91
|
convertXMLToIFitChartData(gridCell.cell.value) :
|
|
91
92
|
JSON.parse(gridCell.cell.value ?? '{}') ?? {}) : createDefaultChartData();
|
|
92
93
|
|
|
93
|
-
const columnChartOptions = getColumnChartOptions(gridCell.
|
|
94
|
+
const columnChartOptions = getColumnChartOptions(gridCell.cell.column);
|
|
95
|
+
const dfChartOptions = getDataFrameChartOptions(gridCell.cell.dataFrame);
|
|
94
96
|
|
|
95
97
|
cellChartData.series ??= [];
|
|
96
98
|
cellChartData.chartOptions ??= columnChartOptions.chartOptions;
|
|
97
99
|
|
|
98
100
|
// merge cell options with column options
|
|
99
101
|
mergeProperties(fitChartDataProperties, columnChartOptions.chartOptions, cellChartData.chartOptions);
|
|
100
|
-
|
|
102
|
+
mergeProperties(fitChartDataProperties, dfChartOptions.chartOptions, cellChartData.chartOptions);
|
|
103
|
+
for (const series of cellChartData.series) {
|
|
101
104
|
mergeProperties(fitSeriesProperties, columnChartOptions.seriesOptions, series);
|
|
105
|
+
mergeProperties(fitSeriesProperties, dfChartOptions.seriesOptions, series);
|
|
106
|
+
}
|
|
102
107
|
|
|
103
108
|
return cellChartData;
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
/** Performs a chart layout, returning [viewport, xAxis, yAxis] */
|
|
107
|
-
export function layoutChart(rect: DG.Rect,
|
|
112
|
+
export function layoutChart(rect: DG.Rect, showAxesLabels: boolean, showTitle: boolean): [DG.Rect, DG.Rect?, DG.Rect?] {
|
|
108
113
|
if (rect.width < MIN_AXES_CELL_PX_WIDTH || rect.height < MIN_AXES_CELL_PX_HEIGHT)
|
|
109
114
|
return [rect, undefined, undefined];
|
|
110
|
-
const axesLeftPxMargin =
|
|
111
|
-
const axesBottomPxMargin =
|
|
115
|
+
const axesLeftPxMargin = showAxesLabels ? AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS : AXES_LEFT_PX_MARGIN;
|
|
116
|
+
const axesBottomPxMargin = showAxesLabels ? AXES_BOTTOM_PX_MARGIN_WITH_AXES_LABELS : AXES_BOTTOM_PX_MARGIN;
|
|
112
117
|
const axesTopPxMargin = showTitle ? AXES_TOP_PX_MARGIN_WITH_TITLE : AXES_TOP_PX_MARGIN;
|
|
113
118
|
return [
|
|
114
|
-
rect.cutLeft(axesLeftPxMargin).cutBottom(
|
|
119
|
+
rect.cutLeft(axesLeftPxMargin).cutBottom(axesBottomPxMargin).cutTop(axesTopPxMargin).cutRight(AXES_RIGHT_PX_MARGIN),
|
|
115
120
|
rect.getBottom(axesBottomPxMargin).getTop(axesTopPxMargin).cutLeft(axesLeftPxMargin).cutRight(AXES_RIGHT_PX_MARGIN),
|
|
116
121
|
rect.getLeft(axesLeftPxMargin).getRight(AXES_RIGHT_PX_MARGIN).cutBottom(axesBottomPxMargin).cutTop(axesTopPxMargin)
|
|
117
122
|
];
|
|
@@ -194,15 +199,16 @@ function drawCandles(g: CanvasRenderingContext2D, series: IFitSeries,
|
|
|
194
199
|
}
|
|
195
200
|
|
|
196
201
|
/** Performs a curve confidence interval drawing */
|
|
197
|
-
function drawConfidenceInterval(g: CanvasRenderingContext2D, confIntervals: FitConfidenceIntervals,
|
|
198
|
-
|
|
202
|
+
function drawConfidenceInterval(g: CanvasRenderingContext2D, confIntervals: FitConfidenceIntervals, screenBounds: DG.Rect,
|
|
203
|
+
transform: Viewport, confidenceType: string, showAxesLabels: boolean, logOptions: LogOptions): void {
|
|
199
204
|
g.beginPath();
|
|
200
|
-
const axesLeftPxMargin =
|
|
205
|
+
const axesLeftPxMargin = showAxesLabels ? AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS : AXES_LEFT_PX_MARGIN;
|
|
206
|
+
const confIntervalFunc = confidenceType === CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP ?
|
|
207
|
+
confIntervals.confidenceTop : confIntervals.confidenceBottom;
|
|
201
208
|
for (let i = axesLeftPxMargin; i <= screenBounds.width - AXES_RIGHT_PX_MARGIN; i++) {
|
|
202
209
|
const x = screenBounds.x + i;
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
transform.yToScreen(confIntervals.confidenceBottom(transform.xToWorld(x)));
|
|
210
|
+
const xForY = logOptions.logX ? Math.log10(transform.xToWorld(x)) : transform.xToWorld(x);
|
|
211
|
+
const y = logOptions.logY ? transform.yToScreen(Math.pow(10, confIntervalFunc(xForY))) : transform.yToScreen(confIntervalFunc(xForY));
|
|
206
212
|
if (i === axesLeftPxMargin)
|
|
207
213
|
g.moveTo(x, y);
|
|
208
214
|
else
|
|
@@ -212,13 +218,15 @@ function drawConfidenceInterval(g: CanvasRenderingContext2D, confIntervals: FitC
|
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
/** Performs a curve confidence interval color filling */
|
|
215
|
-
function fillConfidenceInterval(g: CanvasRenderingContext2D, confIntervals: FitConfidenceIntervals,
|
|
216
|
-
|
|
221
|
+
function fillConfidenceInterval(g: CanvasRenderingContext2D, confIntervals: FitConfidenceIntervals, screenBounds: DG.Rect,
|
|
222
|
+
transform: Viewport, showAxesLabels: boolean, logOptions: LogOptions): void {
|
|
217
223
|
g.beginPath();
|
|
218
|
-
const axesLeftPxMargin =
|
|
224
|
+
const axesLeftPxMargin = showAxesLabels ? AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS : AXES_LEFT_PX_MARGIN;
|
|
219
225
|
for (let i = axesLeftPxMargin; i <= screenBounds.width - AXES_RIGHT_PX_MARGIN; i++) {
|
|
220
226
|
const x = screenBounds.x + i;
|
|
221
|
-
const
|
|
227
|
+
const xForY = logOptions.logX ? Math.log10(transform.xToWorld(x)) : transform.xToWorld(x);
|
|
228
|
+
const y = logOptions.logY ? transform.yToScreen(Math.pow(10, confIntervals.confidenceTop(xForY))) :
|
|
229
|
+
transform.yToScreen(confIntervals.confidenceTop(xForY));
|
|
222
230
|
if (i === axesLeftPxMargin)
|
|
223
231
|
g.moveTo(x, y);
|
|
224
232
|
else
|
|
@@ -228,7 +236,9 @@ function fillConfidenceInterval(g: CanvasRenderingContext2D, confIntervals: FitC
|
|
|
228
236
|
// reverse traverse to make a shape of confidence interval to fill it
|
|
229
237
|
for (let i = screenBounds.width - AXES_RIGHT_PX_MARGIN; i >= axesLeftPxMargin; i--) {
|
|
230
238
|
const x = screenBounds.x + i;
|
|
231
|
-
const
|
|
239
|
+
const xForY = logOptions.logX ? Math.log10(transform.xToWorld(x)) : transform.xToWorld(x);
|
|
240
|
+
const y = logOptions.logY ? transform.yToScreen(Math.pow(10, confIntervals.confidenceBottom(xForY))) :
|
|
241
|
+
transform.yToScreen(confIntervals.confidenceBottom(xForY));
|
|
232
242
|
g.lineTo(x, y);
|
|
233
243
|
}
|
|
234
244
|
g.closePath();
|
|
@@ -237,9 +247,13 @@ function fillConfidenceInterval(g: CanvasRenderingContext2D, confIntervals: FitC
|
|
|
237
247
|
|
|
238
248
|
/** Performs a dropline drawing */
|
|
239
249
|
function drawDropline(g: CanvasRenderingContext2D, transform: Viewport, xValue: number, dataBounds: DG.Rect,
|
|
240
|
-
curve: (x: number) => number): void {
|
|
241
|
-
|
|
242
|
-
|
|
250
|
+
curve: (x: number) => number, logOptions: LogOptions): void {
|
|
251
|
+
if (logOptions.logX)
|
|
252
|
+
xValue = Math.pow(10, xValue);
|
|
253
|
+
const xForY = logOptions.logX ? Math.log10(xValue) : xValue;
|
|
254
|
+
const y = logOptions.logY ? Math.pow(10, curve(xForY)) : curve(xForY);
|
|
255
|
+
g.moveTo(transform.xToScreen(dataBounds.minX), transform.yToScreen(y));
|
|
256
|
+
g.lineTo(transform.xToScreen(xValue), transform.yToScreen(y));
|
|
243
257
|
g.lineTo(transform.xToScreen(xValue), transform.yToScreen(dataBounds.minY));
|
|
244
258
|
}
|
|
245
259
|
|
|
@@ -263,9 +277,9 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
263
277
|
: getChartData(gridCell);
|
|
264
278
|
|
|
265
279
|
const screenBounds = gridCell.bounds.inflate(INFLATE_SIZE / 2, INFLATE_SIZE / 2);
|
|
266
|
-
const
|
|
280
|
+
const showAxesLabels = gridCell.bounds.width >= MIN_X_AXIS_NAME_VISIBILITY_PX_WIDTH && gridCell.bounds.height >= MIN_Y_AXIS_NAME_VISIBILITY_PX_HEIGHT;
|
|
267
281
|
const showTitle = gridCell.bounds.width >= MIN_TITLE_PX_WIDTH && gridCell.bounds.height >= MIN_TITLE_PX_HEIGHT;
|
|
268
|
-
const dataBox = layoutChart(screenBounds,
|
|
282
|
+
const dataBox = layoutChart(screenBounds, showAxesLabels, showTitle)[0];
|
|
269
283
|
const dataBounds = getChartBounds(data);
|
|
270
284
|
const viewport = new Viewport(dataBounds, dataBox, data.chartOptions?.logX ?? false, data.chartOptions?.logY ?? false);
|
|
271
285
|
|
|
@@ -304,9 +318,26 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
304
318
|
if (!gridCell.cell.value)
|
|
305
319
|
return;
|
|
306
320
|
|
|
307
|
-
|
|
308
|
-
|
|
321
|
+
const cellRenderViewer = CellRenderViewer.fromGridCell(gridCell);
|
|
322
|
+
const dlg = ui.dialog({title: 'Edit chart'})
|
|
323
|
+
.add(cellRenderViewer.root)
|
|
309
324
|
.show({resizable: true});
|
|
325
|
+
|
|
326
|
+
// canvas is created as (300, 150), so we change its size to the dialog contents box size
|
|
327
|
+
const dlgContentsBox = dlg.root.getElementsByClassName('d4-dialog-contents dlg-edit-chart')[0].firstChild as HTMLElement;
|
|
328
|
+
cellRenderViewer.canvas.width = dlgContentsBox.clientWidth;
|
|
329
|
+
cellRenderViewer.canvas.height = dlgContentsBox.clientHeight;
|
|
330
|
+
cellRenderViewer.render();
|
|
331
|
+
|
|
332
|
+
// contents ui-box isn't resizable by default
|
|
333
|
+
dlgContentsBox.style.width = '100%';
|
|
334
|
+
dlgContentsBox.style.height = '100%';
|
|
335
|
+
|
|
336
|
+
ui.tools.handleResize(dlgContentsBox, (w: number, h: number) => {
|
|
337
|
+
cellRenderViewer.canvas.width = w;
|
|
338
|
+
cellRenderViewer.canvas.height = h;
|
|
339
|
+
cellRenderViewer.render();
|
|
340
|
+
});
|
|
310
341
|
}
|
|
311
342
|
|
|
312
343
|
renderCurves(g: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, data: IFitChartData): void {
|
|
@@ -316,12 +347,14 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
316
347
|
g.clip();
|
|
317
348
|
|
|
318
349
|
const screenBounds = new DG.Rect(x, y, w, h).inflate(INFLATE_SIZE / 2, INFLATE_SIZE / 2);
|
|
319
|
-
const
|
|
350
|
+
const showAxesLabels = w >= MIN_X_AXIS_NAME_VISIBILITY_PX_WIDTH && h >= MIN_Y_AXIS_NAME_VISIBILITY_PX_HEIGHT
|
|
320
351
|
&& !!data.chartOptions?.xAxisName && !!data.chartOptions.yAxisName;
|
|
321
352
|
const showTitle = w >= MIN_TITLE_PX_WIDTH && h >= MIN_TITLE_PX_HEIGHT && !!data.chartOptions?.title;
|
|
322
|
-
const [dataBox, xAxisBox, yAxisBox] = layoutChart(screenBounds,
|
|
353
|
+
const [dataBox, xAxisBox, yAxisBox] = layoutChart(screenBounds, showAxesLabels, showTitle);
|
|
323
354
|
|
|
324
355
|
const dataBounds = getChartBounds(data);
|
|
356
|
+
if (dataBounds.x <= 0 && data.chartOptions) data.chartOptions.logX = false;
|
|
357
|
+
if (dataBounds.y <= 0 && data.chartOptions) data.chartOptions.logY = false;
|
|
325
358
|
const viewport = new Viewport(dataBounds, dataBox, data.chartOptions?.logX ?? false, data.chartOptions?.logY ?? false);
|
|
326
359
|
const minSize = Math.min(dataBox.width, dataBox.height);
|
|
327
360
|
const ratio = minSize > 100 ? 1 : 0.2 + (minSize / 100) * 0.8;
|
|
@@ -377,12 +410,11 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
377
410
|
g.beginPath();
|
|
378
411
|
if (series.lineStyle)
|
|
379
412
|
g.setLineDash(LINE_STYLES[series.lineStyle]);
|
|
380
|
-
const axesLeftPxMargin =
|
|
413
|
+
const axesLeftPxMargin = showAxesLabels ? AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS : AXES_LEFT_PX_MARGIN;
|
|
381
414
|
for (let j = axesLeftPxMargin; j <= screenBounds.width - AXES_RIGHT_PX_MARGIN; j++) {
|
|
382
415
|
const x = screenBounds.x + j;
|
|
383
416
|
const xForY = data.chartOptions?.logX ? Math.log10(viewport.xToWorld(x)) : viewport.xToWorld(x);
|
|
384
417
|
const y = data.chartOptions?.logY ? viewport.yToScreen(Math.pow(10, curve(xForY))) : viewport.yToScreen(curve(xForY));
|
|
385
|
-
viewport.yToScreen(curve(viewport.xToWorld(x)));
|
|
386
418
|
if (j === axesLeftPxMargin)
|
|
387
419
|
g.moveTo(x, y);
|
|
388
420
|
else
|
|
@@ -396,13 +428,15 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
396
428
|
g.strokeStyle = series.confidenceIntervalColor ?? CONFIDENCE_INTERVAL_STROKE_COLOR;
|
|
397
429
|
g.fillStyle = series.confidenceIntervalColor ?? CONFIDENCE_INTERVAL_FILL_COLOR;
|
|
398
430
|
|
|
399
|
-
const confidenceIntervals = getSeriesConfidenceInterval(series, fitFunc, userParamsFlag);
|
|
400
|
-
drawConfidenceInterval(g, confidenceIntervals, screenBounds, viewport,
|
|
401
|
-
|
|
402
|
-
|
|
431
|
+
const confidenceIntervals = getSeriesConfidenceInterval(series, fitFunc, userParamsFlag, chartLogOptions);
|
|
432
|
+
drawConfidenceInterval(g, confidenceIntervals, screenBounds, viewport,
|
|
433
|
+
CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP, showAxesLabels, chartLogOptions);
|
|
434
|
+
drawConfidenceInterval(g, confidenceIntervals, screenBounds, viewport,
|
|
435
|
+
CURVE_CONFIDENCE_INTERVAL_BOUNDS.BOTTOM, showAxesLabels, chartLogOptions);
|
|
436
|
+
fillConfidenceInterval(g, confidenceIntervals, screenBounds, viewport, showAxesLabels, chartLogOptions);
|
|
403
437
|
}
|
|
404
438
|
|
|
405
|
-
if (series.droplines) {
|
|
439
|
+
if (series.droplines && showAxesLabels) {
|
|
406
440
|
g.save();
|
|
407
441
|
g.strokeStyle = 'blue';
|
|
408
442
|
g.lineWidth = ratio;
|
|
@@ -411,7 +445,7 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
411
445
|
for (let j = 0; j < series.droplines.length; j++) {
|
|
412
446
|
const droplineName = series.droplines[j];
|
|
413
447
|
if (droplineName === 'IC50')
|
|
414
|
-
drawDropline(g, viewport, series.parameters[2], dataBounds, curve);
|
|
448
|
+
drawDropline(g, viewport, series.parameters[2], dataBounds, curve, chartLogOptions);
|
|
415
449
|
}
|
|
416
450
|
g.stroke();
|
|
417
451
|
g.restore();
|
|
@@ -441,7 +475,7 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
441
475
|
g.fillText(data.chartOptions?.title!, dataBox.midX - 5, y + 15);
|
|
442
476
|
}
|
|
443
477
|
|
|
444
|
-
if (
|
|
478
|
+
if (showAxesLabels) {
|
|
445
479
|
g.font = '11px Roboto, "Roboto Local"';
|
|
446
480
|
g.textAlign = 'center';
|
|
447
481
|
g.fillStyle = 'black';
|
|
@@ -475,7 +509,7 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
475
509
|
if (!gridCell.cell.value)
|
|
476
510
|
return;
|
|
477
511
|
|
|
478
|
-
if (gridCell.bounds.width <
|
|
512
|
+
if (gridCell.bounds.width < MIN_POINTS_AND_STATS_VISIBILITY_PX_WIDTH || gridCell.bounds.height < MIN_POINTS_AND_STATS_VISIBILITY_PX_HEIGHT) {
|
|
479
513
|
const canvas = ui.canvas(300, 200);
|
|
480
514
|
this.render(canvas.getContext('2d')!, 0, 0, 300, 200, gridCell, null as any);
|
|
481
515
|
const content = ui.divV([canvas]);
|
|
@@ -488,9 +522,9 @@ export class FitChartCellRenderer extends DG.GridCellRenderer {
|
|
|
488
522
|
: getChartData(gridCell);
|
|
489
523
|
|
|
490
524
|
const screenBounds = gridCell.bounds.inflate(INFLATE_SIZE / 2, INFLATE_SIZE / 2);
|
|
491
|
-
const
|
|
525
|
+
const showAxesLabels = gridCell.bounds.width >= MIN_X_AXIS_NAME_VISIBILITY_PX_WIDTH && gridCell.bounds.height >= MIN_Y_AXIS_NAME_VISIBILITY_PX_HEIGHT;
|
|
492
526
|
const showTitle = gridCell.bounds.width >= MIN_TITLE_PX_WIDTH && gridCell.bounds.height >= MIN_TITLE_PX_HEIGHT;
|
|
493
|
-
const dataBox = layoutChart(screenBounds,
|
|
527
|
+
const dataBox = layoutChart(screenBounds, showAxesLabels, showTitle)[0];
|
|
494
528
|
const dataBounds = getChartBounds(data);
|
|
495
529
|
const viewport = new Viewport(dataBounds, dataBox, data.chartOptions?.logX ?? false, data.chartOptions?.logY ?? false);
|
|
496
530
|
|
|
@@ -18,9 +18,9 @@ category('viewport', () => {
|
|
|
18
18
|
const dataBounds = new DG.Rect(0.1, 0.06, 7, 5.94);
|
|
19
19
|
const viewport = new Viewport(dataBounds, dataBox, false, false);
|
|
20
20
|
expect(viewport.xToScreen(1.5), 182.4);
|
|
21
|
-
expect(viewport.yToScreen(2.33),
|
|
21
|
+
expect(viewport.yToScreen(2.33), 73.01346801346801);
|
|
22
22
|
expect(viewport.xToWorld(150), -0.9652173913043479);
|
|
23
|
-
expect(viewport.yToWorld(67),
|
|
23
|
+
expect(viewport.yToWorld(67), 2.855294117647059);
|
|
24
24
|
}));
|
|
25
25
|
});
|
|
26
26
|
//# sourceMappingURL=transform-tests.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-tests.js","sourceRoot":"","sources":["transform-tests.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAC,QAAQ,EAAC,MAAM,yCAAyC,CAAC;AACjE,OAAO,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,oCAAoC,CAAC;AAG1E,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,CAAC,iBAAiB,EAAE,GAAS,EAAE;QACjC,MAAM,YAAY,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,GAAG,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;QAChG,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC1D,MAAM,UAAU,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAEnE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"transform-tests.js","sourceRoot":"","sources":["transform-tests.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAC,QAAQ,EAAC,MAAM,yCAAyC,CAAC;AACjE,OAAO,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,oCAAoC,CAAC;AAG1E,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,CAAC,iBAAiB,EAAE,GAAS,EAAE;QACjC,MAAM,YAAY,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,GAAG,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;QAChG,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC1D,MAAM,UAAU,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAEnE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC,CAAC;QACpD,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC;QACpD,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,iBAAiB,CAAC,CAAC;IACjD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -14,8 +14,8 @@ category('viewport', () => {
|
|
|
14
14
|
const viewport = new Viewport(dataBounds, dataBox, false, false);
|
|
15
15
|
|
|
16
16
|
expect(viewport.xToScreen(1.5), 182.4);
|
|
17
|
-
expect(viewport.yToScreen(2.33),
|
|
17
|
+
expect(viewport.yToScreen(2.33), 73.01346801346801);
|
|
18
18
|
expect(viewport.xToWorld(150), -0.9652173913043479);
|
|
19
|
-
expect(viewport.yToWorld(67),
|
|
19
|
+
expect(viewport.yToWorld(67), 2.855294117647059);
|
|
20
20
|
});
|
|
21
21
|
});
|