@datagrok/curves 1.8.0 → 1.10.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.
Files changed (55) hide show
  1. package/.eslintrc.json +39 -0
  2. package/.vscode/launch.json +10 -9
  3. package/.vscode/tasks.json +14 -0
  4. package/CHANGELOG.md +39 -0
  5. package/databases/plates/0000_init.sql +167 -0
  6. package/detectors.js +18 -2
  7. package/dist/package-test.js +16647 -1
  8. package/dist/package-test.js.map +1 -1
  9. package/dist/package.js +14467 -1
  10. package/dist/package.js.map +1 -1
  11. package/package.json +13 -9
  12. package/queries/plates-crud.sql +148 -0
  13. package/src/fit/const.ts +60 -60
  14. package/src/fit/data-to-curves.ts +592 -0
  15. package/src/fit/fit-demo.ts +6 -6
  16. package/src/fit/fit-grid-cell-handler.ts +49 -45
  17. package/src/fit/fit-renderer.ts +58 -57
  18. package/src/fit/multi-curve-viewer.ts +43 -21
  19. package/src/fit/render-utils.ts +315 -315
  20. package/src/package-api.ts +179 -0
  21. package/src/package-test.ts +1 -1
  22. package/src/package.g.ts +171 -3
  23. package/src/package.ts +227 -298
  24. package/src/plate/excel-plates.ts +1 -1
  25. package/src/plate/plate-cell-renderer.ts +20 -12
  26. package/src/plate/plate-drc-analysis.ts +262 -0
  27. package/src/plate/plate-reader.ts +5 -5
  28. package/src/plate/plate-well-validators.ts +41 -0
  29. package/src/plate/plate-widget.ts +132 -368
  30. package/src/plate/plate.ts +168 -57
  31. package/src/plate/plates-folder-preview.ts +63 -0
  32. package/src/plate/readers/bmg-pherastar-96.ts +7 -7
  33. package/src/plate/readers/delfia-envision-96-max-rlu.ts +4 -3
  34. package/src/plate/readers/delfia-envision-by-row.ts +3 -3
  35. package/src/plate/readers/spectramax.ts +7 -8
  36. package/src/plate/utils.ts +22 -10
  37. package/src/plates/numeric_matcher.ts +191 -0
  38. package/src/plates/objects/plate-template-handler.ts +48 -0
  39. package/src/plates/plates-app.ts +64 -0
  40. package/src/plates/plates-crud.ts +502 -0
  41. package/src/plates/plates-demo.ts +107 -0
  42. package/src/plates/plates.sql +169 -0
  43. package/src/plates/views/plates-create-view.ts +123 -0
  44. package/src/plates/views/plates-schema-view.ts +58 -0
  45. package/src/plates/views/plates-search-view.ts +137 -0
  46. package/src/plates/views/plates-templates-view.ts +37 -0
  47. package/src/pngRenderer.ts +98 -0
  48. package/src/tests/curves-cell-renderer-tests.ts +93 -92
  49. package/src/tests/detector-tests.ts +3 -2
  50. package/src/tests/fit-tests.ts +199 -198
  51. package/src/tests/plate-tests.ts +6 -7
  52. package/src/tests/transform-tests.ts +4 -4
  53. package/test-console-output-1.log +436 -0
  54. package/test-record-1.mp4 +0 -0
  55. package/tsconfig.json +1 -1
@@ -1,20 +1,21 @@
1
+ /* eslint-disable max-len */
1
2
  import * as DG from 'datagrok-api/dg';
2
3
  import {
3
- FitConfidenceIntervals,
4
- FitFunction,
5
- IFitChartData,
6
- IFitSeries,
7
- statisticsProperties
8
- } from "@datagrok-libraries/statistics/src/fit/fit-curve";
4
+ FitConfidenceIntervals,
5
+ IFitChartData,
6
+ IFitSeries,
7
+ statisticsProperties
8
+ } from '@datagrok-libraries/statistics/src/fit/fit-curve';
9
9
  import {
10
- getSeriesConfidenceInterval,
11
- getSeriesStatistics,
12
- LogOptions
13
- } from "@datagrok-libraries/statistics/src/fit/fit-data";
14
- import {Viewport} from "@datagrok-libraries/utils/src/transform";
15
- import {FitConstants} from "./const";
16
- import {BoxPlotStatistics, calculateBoxPlotStatistics} from "@datagrok-libraries/statistics/src/box-plot-statistics";
17
- import {StringUtils} from "@datagrok-libraries/utils/src/string-utils";
10
+ getSeriesConfidenceInterval,
11
+ getSeriesStatistics,
12
+ LogOptions
13
+ } from '@datagrok-libraries/statistics/src/fit/fit-data';
14
+ import {Viewport} from '@datagrok-libraries/utils/src/transform';
15
+ import {FitConstants} from './const';
16
+ import {BoxPlotStatistics, calculateBoxPlotStatistics} from '@datagrok-libraries/statistics/src/box-plot-statistics';
17
+ import {StringUtils} from '@datagrok-libraries/utils/src/string-utils';
18
+ import {FitFunction} from '@datagrok-libraries/statistics/src/fit/new-fit-API';
18
19
 
19
20
 
20
21
  export enum ColorType {
@@ -104,386 +105,385 @@ export function getSeriesColor(series: IFitSeries, seriesIdx: number, colorType:
104
105
  }
105
106
 
106
107
  export function renderConnectDots(g: CanvasRenderingContext2D, series: IFitSeries, renderOptions: FitRenderOptions): void {
107
- if (series.connectDots ?? false) {
108
- const viewport = renderOptions.viewport;
109
- g.strokeStyle = getSeriesColor(series, renderOptions.seriesIdx!, 'pointColor');
110
- g.lineWidth = 2 * renderOptions.ratio!;
111
- g.beginPath();
112
- for (let i = 0; i < series.points.length; i++) {
113
- const x = series.points[i].x;
114
- const y = series.points[i].y;
115
- const screenX = viewport.xToScreen(x);
116
- const screenY = viewport.yToScreen(y);
117
- if (i === 0)
118
- g.moveTo(screenX, screenY);
119
- else
120
- g.lineTo(screenX, screenY);
121
- }
122
- g.stroke();
108
+ if (series.connectDots ?? false) {
109
+ const viewport = renderOptions.viewport;
110
+ g.strokeStyle = getSeriesColor(series, renderOptions.seriesIdx!, 'pointColor');
111
+ g.lineWidth = 2 * renderOptions.ratio!;
112
+ g.beginPath();
113
+ for (let i = 0; i < series.points.length; i++) {
114
+ const x = series.points[i].x;
115
+ const y = series.points[i].y;
116
+ const screenX = viewport.xToScreen(x);
117
+ const screenY = viewport.yToScreen(y);
118
+ if (i === 0)
119
+ g.moveTo(screenX, screenY);
120
+ else
121
+ g.lineTo(screenX, screenY);
123
122
  }
123
+ g.stroke();
124
+ }
124
125
  }
125
126
 
126
127
  export function renderPoints(g: CanvasRenderingContext2D, series: IFitSeries, options: FitRenderOptions) {
127
- const screenBounds = options.screenBounds!;
128
- const showPoints = screenBounds.width < FitConstants.MIN_POINTS_AND_STATS_VISIBILITY_PX_WIDTH ||
128
+ const screenBounds = options.screenBounds!;
129
+ const showPoints = screenBounds.width < FitConstants.MIN_POINTS_AND_STATS_VISIBILITY_PX_WIDTH ||
129
130
  screenBounds.height < FitConstants.MIN_POINTS_AND_STATS_VISIBILITY_PX_HEIGHT ? '' : series.showPoints ?? 'points';
130
- if (showPoints) {
131
- g.strokeStyle = getSeriesColor(series, options.seriesIdx!, ColorType.POINT);
132
- if ((series.connectDots && series.showPoints !== '') || series.showPoints === 'points')
133
- drawPoints(g, series, options);
134
- else if (['candlesticks', 'both'].includes(series.showPoints!))
135
- drawCandles(g, series, options);
136
- }
131
+ if (showPoints) {
132
+ g.strokeStyle = getSeriesColor(series, options.seriesIdx!, ColorType.POINT);
133
+ if ((series.connectDots && series.showPoints !== '') || series.showPoints === 'points')
134
+ drawPoints(g, series, options);
135
+ else if (['candlesticks', 'both'].includes(series.showPoints!))
136
+ drawCandles(g, series, options);
137
+ }
137
138
  }
138
139
 
139
140
  /** Performs points drawing */
140
141
  function drawPoints(g: CanvasRenderingContext2D, series: IFitSeries, options: FitRenderOptions): void {
141
- const ratio = options.ratio!;
142
- const defaultSize = FitConstants.POINT_PX_SIZE * ratio;
143
- const viewport = options.viewport;
144
- const connectDots = series.connectDots;
145
- const pointColor = getSeriesColor(series, options.seriesIdx!, ColorType.POINT);
146
- const outlierColor = getSeriesColor(series, options.seriesIdx!, ColorType.OUTLIER);
147
-
148
- for (let i = 0; i < series.points.length!; i++) {
149
- const p = series.points[i];
150
- const xScreen = viewport.xToScreen(p.x);
151
- const yScreen = viewport.yToScreen(p.y);
152
- const color = connectDots ? pointColor :
153
- p.outlier ? (p.outlierColor ? DG.Color.fromHtml(p.outlierColor) ? p.outlierColor : outlierColor : outlierColor) :
154
- (p.color ? DG.Color.fromHtml(p.color) ? p.color : pointColor : pointColor);
155
- const marker = p.marker ? p.marker as DG.MARKER_TYPE : series.markerType as DG.MARKER_TYPE;
156
- const outlierMarker = p.outlierMarker ? p.outlierMarker as DG.MARKER_TYPE : series.outlierMarkerType as DG.MARKER_TYPE;
157
- const size = !connectDots ? p.outlier ? FitConstants.OUTLIER_PX_SIZE * ratio : p.size ? p.size : defaultSize : defaultSize;
158
- const markerToDraw = !connectDots ? p.outlier ? outlierMarker : marker : marker;
159
-
160
- DG.Paint.marker(g, markerToDraw, xScreen, yScreen, color, size);
161
- if (p.stdev && !p.outlier) {
162
- g.strokeStyle = color;
163
- g.beginPath();
164
- g.moveTo(xScreen, viewport.yToScreen(p.y + p.stdev));
165
- g.lineTo(xScreen, viewport.yToScreen(p.y - p.stdev));
166
- g.stroke();
167
- }
142
+ const ratio = options.ratio!;
143
+ const defaultSize = FitConstants.POINT_PX_SIZE * ratio;
144
+ const viewport = options.viewport;
145
+ const connectDots = series.connectDots;
146
+ const pointColor = getSeriesColor(series, options.seriesIdx!, ColorType.POINT);
147
+ const outlierColor = getSeriesColor(series, options.seriesIdx!, ColorType.OUTLIER);
148
+
149
+ for (let i = 0; i < series.points.length!; i++) {
150
+ const p = series.points[i];
151
+ const xScreen = viewport.xToScreen(p.x);
152
+ const yScreen = viewport.yToScreen(p.y);
153
+ const color = connectDots ? pointColor :
154
+ p.outlier ? (p.outlierColor ? DG.Color.fromHtml(p.outlierColor) ? p.outlierColor : outlierColor : outlierColor) :
155
+ (p.color ? DG.Color.fromHtml(p.color) ? p.color : pointColor : pointColor);
156
+ const marker = p.marker ? p.marker as DG.MARKER_TYPE : series.markerType as DG.MARKER_TYPE;
157
+ const outlierMarker = p.outlierMarker ? p.outlierMarker as DG.MARKER_TYPE : series.outlierMarkerType as DG.MARKER_TYPE;
158
+ const size = !connectDots ? p.outlier ? FitConstants.OUTLIER_PX_SIZE * ratio : p.size ? p.size : defaultSize : defaultSize;
159
+ const markerToDraw = !connectDots ? p.outlier ? outlierMarker : marker : marker;
160
+
161
+ DG.Paint.marker(g, markerToDraw, xScreen, yScreen, color, size);
162
+ if (p.stdev && !p.outlier) {
163
+ g.strokeStyle = color;
164
+ g.beginPath();
165
+ g.moveTo(xScreen, viewport.yToScreen(p.y + p.stdev));
166
+ g.lineTo(xScreen, viewport.yToScreen(p.y - p.stdev));
167
+ g.stroke();
168
168
  }
169
+ }
169
170
  }
170
171
 
171
172
  /** Performs candles drawing */
172
173
  function drawCandles(g: CanvasRenderingContext2D, series: IFitSeries, options: FitRenderOptions) : void {
173
- const ratio = options.ratio!;
174
- const viewport = options.viewport;
175
- const pointColor = getSeriesColor(series, options.seriesIdx!, ColorType.POINT);
176
- for (let i = 0, candleStart = null; i < series.points.length!; i++) {
177
- const p = series.points[i];
178
- if (p.outlier)
179
- continue;
180
- const nextSame = i + 1 < series.points.length && series.points[i + 1].x === p.x;
181
- if (!candleStart && nextSame)
182
- candleStart = i;
183
- else if (candleStart !== null && !nextSame) {
184
- const values: number[] = [];
185
- for (let j = candleStart, ind = 0; j <= i; j++, ind++)
186
- values[ind] = series.points[j].y;
187
- const boxPlotStats = calculateBoxPlotStatistics(values);
188
-
189
- g.beginPath();
190
- drawCandlestick(g, {viewport: viewport, ratio: ratio, x: p.x, boxPlotStats: boxPlotStats, color: pointColor});
191
- g.stroke();
192
-
193
- if (series.showPoints === 'both') {
194
- for (let ind = 0; ind < values.length; ind++) {
195
- if (values[ind] < boxPlotStats.lowerAdjacentValue || values[ind] > boxPlotStats.upperAdjacentValue) {
196
- DG.Paint.marker(g, DG.MARKER_TYPE.OUTLIER, viewport.xToScreen(p.x),
197
- viewport.yToScreen(values[ind]), pointColor, FitConstants.CANDLESTICK_OUTLIER_PX_SIZE * ratio);
198
- }
199
- }
200
- }
201
-
202
- candleStart = null;
174
+ const ratio = options.ratio!;
175
+ const viewport = options.viewport;
176
+ const pointColor = getSeriesColor(series, options.seriesIdx!, ColorType.POINT);
177
+ for (let i = 0, candleStart = null; i < series.points.length!; i++) {
178
+ const p = series.points[i];
179
+ if (p.outlier)
180
+ continue;
181
+ const nextSame = i + 1 < series.points.length && series.points[i + 1].x === p.x;
182
+ if (!candleStart && nextSame) { candleStart = i; } else if (candleStart !== null && !nextSame) {
183
+ const values: number[] = [];
184
+ for (let j = candleStart, ind = 0; j <= i; j++, ind++)
185
+ values[ind] = series.points[j].y;
186
+ const boxPlotStats = calculateBoxPlotStatistics(values);
187
+
188
+ g.beginPath();
189
+ drawCandlestick(g, {viewport: viewport, ratio: ratio, x: p.x, boxPlotStats: boxPlotStats, color: pointColor});
190
+ g.stroke();
191
+
192
+ if (series.showPoints === 'both') {
193
+ for (let ind = 0; ind < values.length; ind++) {
194
+ if (values[ind] < boxPlotStats.lowerAdjacentValue || values[ind] > boxPlotStats.upperAdjacentValue) {
195
+ DG.Paint.marker(g, DG.MARKER_TYPE.OUTLIER, viewport.xToScreen(p.x),
196
+ viewport.yToScreen(values[ind]), pointColor, FitConstants.CANDLESTICK_OUTLIER_PX_SIZE * ratio);
197
+ }
203
198
  }
199
+ }
200
+
201
+ candleStart = null;
204
202
  }
203
+ }
205
204
  }
206
205
 
207
206
  /** Performs candlestick drawing */
208
207
  function drawCandlestick(g: CanvasRenderingContext2D, renderOptions: FitPointRenderOptions): void {
209
- const viewport = renderOptions.viewport;
210
- const x = renderOptions.x;
211
- const screenX = viewport.xToScreen(x);
212
- const boxPlotStats = renderOptions.boxPlotStats;
213
-
214
- drawCandlestickBorder(g, x, boxPlotStats.lowerAdjacentValue, viewport);
215
- g.moveTo(screenX, viewport.yToScreen(boxPlotStats.lowerAdjacentValue));
216
- g.lineTo(screenX, viewport.yToScreen(boxPlotStats.upperAdjacentValue));
217
- drawCandlestickBorder(g, x, boxPlotStats.upperAdjacentValue, viewport);
218
- DG.Paint.marker(g, DG.MARKER_TYPE.CIRCLE, screenX, viewport.yToScreen(boxPlotStats.q2), renderOptions.color,
219
- FitConstants.CANDLESTICK_MEDIAN_PX_SIZE * renderOptions.ratio!);
208
+ const viewport = renderOptions.viewport;
209
+ const x = renderOptions.x;
210
+ const screenX = viewport.xToScreen(x);
211
+ const boxPlotStats = renderOptions.boxPlotStats;
212
+
213
+ drawCandlestickBorder(g, x, boxPlotStats.lowerAdjacentValue, viewport);
214
+ g.moveTo(screenX, viewport.yToScreen(boxPlotStats.lowerAdjacentValue));
215
+ g.lineTo(screenX, viewport.yToScreen(boxPlotStats.upperAdjacentValue));
216
+ drawCandlestickBorder(g, x, boxPlotStats.upperAdjacentValue, viewport);
217
+ DG.Paint.marker(g, DG.MARKER_TYPE.CIRCLE, screenX, viewport.yToScreen(boxPlotStats.q2), renderOptions.color,
218
+ FitConstants.CANDLESTICK_MEDIAN_PX_SIZE * renderOptions.ratio!);
220
219
  }
221
220
 
222
221
  /** Performs candlestick border drawing */
223
222
  function drawCandlestickBorder(g: CanvasRenderingContext2D, x: number, adjacentValue: number, transform: Viewport): void {
224
- const xScreen = transform.xToScreen(x);
225
- const yScreen = transform.yToScreen(adjacentValue);
226
- g.moveTo(xScreen - (FitConstants.CANDLESTICK_BORDER_PX_SIZE / 2), yScreen);
227
- g.lineTo(xScreen + (FitConstants.CANDLESTICK_BORDER_PX_SIZE / 2), yScreen);
223
+ const xScreen = transform.xToScreen(x);
224
+ const yScreen = transform.yToScreen(adjacentValue);
225
+ g.moveTo(xScreen - (FitConstants.CANDLESTICK_BORDER_PX_SIZE / 2), yScreen);
226
+ g.lineTo(xScreen + (FitConstants.CANDLESTICK_BORDER_PX_SIZE / 2), yScreen);
228
227
  }
229
228
 
230
229
  /** Gets rendering variables */
231
230
  function getRenderingVariables(renderOptions: FitConfidenceIntervalRenderOptions | FitLineRenderOptions) {
232
- const logX = renderOptions.logOptions.logX;
233
- const logY = renderOptions.logOptions.logY;
234
- const screenBounds = renderOptions.screenBounds;
235
- const axesLeftPxMargin = renderOptions.showAxes ? renderOptions.showAxesLabels ?
236
- FitConstants.AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS : FitConstants.AXES_LEFT_PX_MARGIN : 0;
237
- const axesRightPxMargin = renderOptions.showAxes ? FitConstants.AXES_RIGHT_PX_MARGIN : 0;
238
- const xMin = screenBounds.x + axesLeftPxMargin;
239
- const xMax = screenBounds.x + screenBounds.width - axesRightPxMargin;
240
- const viewport = renderOptions.viewport;
241
- return {logX, logY, xMin, xMax, viewport};
231
+ const logX = renderOptions.logOptions.logX;
232
+ const logY = renderOptions.logOptions.logY;
233
+ const screenBounds = renderOptions.screenBounds;
234
+ const axesLeftPxMargin = renderOptions.showAxes ? renderOptions.showAxesLabels ?
235
+ FitConstants.AXES_LEFT_PX_MARGIN_WITH_AXES_LABELS : FitConstants.AXES_LEFT_PX_MARGIN : 0;
236
+ const axesRightPxMargin = renderOptions.showAxes ? FitConstants.AXES_RIGHT_PX_MARGIN : 0;
237
+ const xMin = screenBounds.x + axesLeftPxMargin;
238
+ const xMax = screenBounds.x + screenBounds.width - axesRightPxMargin;
239
+ const viewport = renderOptions.viewport;
240
+ return {logX, logY, xMin, xMax, viewport};
242
241
  }
243
242
 
244
243
  export function renderFitLine(g: CanvasRenderingContext2D, series: IFitSeries, renderOptions: FitLineRenderOptions): void {
245
- if (series.showFitLine ?? true) {
246
- g.save();
247
- g.strokeStyle = getSeriesColor(series, renderOptions.seriesIdx!, ColorType.FIT_LINE);
248
- g.lineWidth = 2 * renderOptions.ratio!;
249
- g.beginPath();
250
- if (series.lineStyle)
251
- g.setLineDash(FitConstants.LINE_STYLES[series.lineStyle]);
252
- const {logX, logY, xMin, xMax, viewport} = getRenderingVariables(renderOptions);
253
- const curveFunc = renderOptions.curveFunc!;
254
-
255
- for (let i = xMin; i <= xMax; i++) {
256
- const xForY = logX ? Math.log10(viewport.xToWorld(i)) : viewport.xToWorld(i);
257
- const y = logY ? viewport.yToScreen(Math.pow(10, curveFunc(xForY))) : viewport.yToScreen(curveFunc(xForY));
258
- if (i === xMin)
259
- g.moveTo(i, y);
260
- else
261
- g.lineTo(i, y);
262
- }
263
- g.stroke();
264
- g.restore();
244
+ if (series.showFitLine ?? true) {
245
+ g.save();
246
+ g.strokeStyle = getSeriesColor(series, renderOptions.seriesIdx!, ColorType.FIT_LINE);
247
+ g.lineWidth = 2 * renderOptions.ratio!;
248
+ g.beginPath();
249
+ if (series.lineStyle)
250
+ g.setLineDash(FitConstants.LINE_STYLES[series.lineStyle]);
251
+ const {logX, logY, xMin, xMax, viewport} = getRenderingVariables(renderOptions);
252
+ const curveFunc = renderOptions.curveFunc!;
253
+
254
+ for (let i = xMin; i <= xMax; i++) {
255
+ const xForY = logX ? Math.log10(viewport.xToWorld(i)) : viewport.xToWorld(i);
256
+ const y = logY ? viewport.yToScreen(Math.pow(10, curveFunc(xForY))) : viewport.yToScreen(curveFunc(xForY));
257
+ if (i === xMin)
258
+ g.moveTo(i, y);
259
+ else
260
+ g.lineTo(i, y);
265
261
  }
262
+ g.stroke();
263
+ g.restore();
264
+ }
266
265
  }
267
266
 
268
267
  export function renderConfidenceIntervals(g: CanvasRenderingContext2D, series: IFitSeries, renderOptions: FitConfidenceIntervalRenderOptions): void {
269
- if ((series.showFitLine ?? true) && (series.showCurveConfidenceInterval ?? false)) {
270
- // TODO: improve confidence intervals colors
271
- g.strokeStyle = series.confidenceIntervalColor ?? FitConstants.CONFIDENCE_INTERVAL_STROKE_COLOR;
272
- g.fillStyle = series.confidenceIntervalColor ?? FitConstants.CONFIDENCE_INTERVAL_FILL_COLOR;
273
- const showAxes = renderOptions.showAxes;
274
- const showAxesLabels = renderOptions.showAxesLabels;
275
- const logOptions = renderOptions.logOptions;
276
- const viewport = renderOptions.viewport;
277
- const screenBounds = renderOptions.screenBounds;
278
- const dataPoints = series.dataPoints;
279
-
280
- const confidenceIntervals = getSeriesConfidenceInterval(series, renderOptions.fitFunc!, renderOptions.userParamsFlag!, dataPoints, logOptions);
281
- drawConfidenceInterval(g, {viewport: viewport, logOptions: logOptions, showAxes: showAxes, showAxesLabels: showAxesLabels,
282
- screenBounds: screenBounds, confidenceIntervals: confidenceIntervals, confidenceType: FitConstants.CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP});
283
- drawConfidenceInterval(g, {viewport: viewport, logOptions: logOptions, showAxes: showAxes, showAxesLabels: showAxesLabels,
284
- screenBounds: screenBounds, confidenceIntervals: confidenceIntervals, confidenceType: FitConstants.CURVE_CONFIDENCE_INTERVAL_BOUNDS.BOTTOM});
285
- fillConfidenceInterval(g, {viewport: viewport, logOptions: logOptions, showAxes: showAxes, showAxesLabels: showAxesLabels,
286
- screenBounds: screenBounds, confidenceIntervals: confidenceIntervals});
287
- }
268
+ if ((series.showFitLine ?? true) && (series.showCurveConfidenceInterval ?? false)) {
269
+ // TODO: improve confidence intervals colors
270
+ g.strokeStyle = series.confidenceIntervalColor ?? FitConstants.CONFIDENCE_INTERVAL_STROKE_COLOR;
271
+ g.fillStyle = series.confidenceIntervalColor ?? FitConstants.CONFIDENCE_INTERVAL_FILL_COLOR;
272
+ const showAxes = renderOptions.showAxes;
273
+ const showAxesLabels = renderOptions.showAxesLabels;
274
+ const logOptions = renderOptions.logOptions;
275
+ const viewport = renderOptions.viewport;
276
+ const screenBounds = renderOptions.screenBounds;
277
+ const dataPoints = series.dataPoints;
278
+
279
+ const confidenceIntervals = getSeriesConfidenceInterval(series, renderOptions.fitFunc!, renderOptions.userParamsFlag!, dataPoints, logOptions);
280
+ drawConfidenceInterval(g, {viewport: viewport, logOptions: logOptions, showAxes: showAxes, showAxesLabels: showAxesLabels,
281
+ screenBounds: screenBounds, confidenceIntervals: confidenceIntervals, confidenceType: FitConstants.CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP});
282
+ drawConfidenceInterval(g, {viewport: viewport, logOptions: logOptions, showAxes: showAxes, showAxesLabels: showAxesLabels,
283
+ screenBounds: screenBounds, confidenceIntervals: confidenceIntervals, confidenceType: FitConstants.CURVE_CONFIDENCE_INTERVAL_BOUNDS.BOTTOM});
284
+ fillConfidenceInterval(g, {viewport: viewport, logOptions: logOptions, showAxes: showAxes, showAxesLabels: showAxesLabels,
285
+ screenBounds: screenBounds, confidenceIntervals: confidenceIntervals});
286
+ }
288
287
  }
289
288
 
290
289
  /** Performs a curve confidence interval drawing */
291
290
  function drawConfidenceInterval(g: CanvasRenderingContext2D, renderOptions: FitConfidenceIntervalRenderOptions): void {
292
- g.beginPath();
291
+ g.beginPath();
293
292
 
294
- const {logX, logY, xMin, xMax, viewport} = getRenderingVariables(renderOptions);
295
- const confIntervalFunc = renderOptions.confidenceType === FitConstants.CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP ?
293
+ const {logX, logY, xMin, xMax, viewport} = getRenderingVariables(renderOptions);
294
+ const confIntervalFunc = renderOptions.confidenceType === FitConstants.CURVE_CONFIDENCE_INTERVAL_BOUNDS.TOP ?
296
295
  renderOptions.confidenceIntervals!.confidenceTop : renderOptions.confidenceIntervals!.confidenceBottom;
297
296
 
298
- for (let i = xMin; i <= xMax; i++) {
299
- const xForY = logX ? Math.log10(viewport.xToWorld(i)) : viewport.xToWorld(i);
300
- const y = logY ? viewport.yToScreen(Math.pow(10, confIntervalFunc(xForY))) : viewport.yToScreen(confIntervalFunc(xForY));
301
- if (i === xMin)
302
- g.moveTo(i, y);
303
- else
304
- g.lineTo(i, y);
305
- }
306
- g.stroke();
297
+ for (let i = xMin; i <= xMax; i++) {
298
+ const xForY = logX ? Math.log10(viewport.xToWorld(i)) : viewport.xToWorld(i);
299
+ const y = logY ? viewport.yToScreen(Math.pow(10, confIntervalFunc(xForY))) : viewport.yToScreen(confIntervalFunc(xForY));
300
+ if (i === xMin)
301
+ g.moveTo(i, y);
302
+ else
303
+ g.lineTo(i, y);
304
+ }
305
+ g.stroke();
307
306
  }
308
307
 
309
308
  /** Performs a curve confidence interval color filling */
310
309
  function fillConfidenceInterval(g: CanvasRenderingContext2D, renderOptions: FitConfidenceIntervalRenderOptions): void {
311
- g.beginPath();
312
-
313
- const {logX, logY, xMin, xMax, viewport} = getRenderingVariables(renderOptions);
314
- const confTop = renderOptions.confidenceIntervals!.confidenceTop;
315
- const confBottom = renderOptions.confidenceIntervals!.confidenceBottom;
316
-
317
- for (let i = xMin; i <= xMax; i++) {
318
- const xForY = logX ? Math.log10(viewport.xToWorld(i)) : viewport.xToWorld(i);
319
- const y = logY ? viewport.yToScreen(Math.pow(10, confTop(xForY))) : viewport.yToScreen(confTop(xForY));
320
- if (i === xMin)
321
- g.moveTo(i, y);
322
- else
323
- g.lineTo(i, y);
324
- }
325
-
326
- // reverse traverse to make a shape of confidence interval to fill it
327
- for (let i = xMax; i >= xMin; i--) {
328
- const xForY = logX ? Math.log10(viewport.xToWorld(i)) : viewport.xToWorld(i);
329
- const y = logY ? viewport.yToScreen(Math.pow(10, confBottom(xForY))) : viewport.yToScreen(confBottom(xForY));
330
- g.lineTo(i, y);
331
- }
332
- g.closePath();
333
- g.fill();
310
+ g.beginPath();
311
+
312
+ const {logX, logY, xMin, xMax, viewport} = getRenderingVariables(renderOptions);
313
+ const confTop = renderOptions.confidenceIntervals!.confidenceTop;
314
+ const confBottom = renderOptions.confidenceIntervals!.confidenceBottom;
315
+
316
+ for (let i = xMin; i <= xMax; i++) {
317
+ const xForY = logX ? Math.log10(viewport.xToWorld(i)) : viewport.xToWorld(i);
318
+ const y = logY ? viewport.yToScreen(Math.pow(10, confTop(xForY))) : viewport.yToScreen(confTop(xForY));
319
+ if (i === xMin)
320
+ g.moveTo(i, y);
321
+ else
322
+ g.lineTo(i, y);
323
+ }
324
+
325
+ // reverse traverse to make a shape of confidence interval to fill it
326
+ for (let i = xMax; i >= xMin; i--) {
327
+ const xForY = logX ? Math.log10(viewport.xToWorld(i)) : viewport.xToWorld(i);
328
+ const y = logY ? viewport.yToScreen(Math.pow(10, confBottom(xForY))) : viewport.yToScreen(confBottom(xForY));
329
+ g.lineTo(i, y);
330
+ }
331
+ g.closePath();
332
+ g.fill();
334
333
  }
335
334
 
336
335
  export function renderDroplines(g: CanvasRenderingContext2D, series: IFitSeries, renderOptions: FitDroplineRenderOptions): void {
337
- if ((series.showFitLine ?? true) && series.droplines && renderOptions.showDroplines!) {
338
- g.save();
339
- g.strokeStyle = 'blue';
340
- g.lineWidth = renderOptions.ratio!;
341
- g.beginPath();
342
- g.setLineDash([5, 5]);
343
- const viewport = renderOptions.viewport;
344
- const dataBounds = renderOptions.dataBounds;
345
- const curveFunc = renderOptions.curveFunc;
346
- const logOptions = renderOptions.logOptions;
347
- for (let j = 0; j < series.droplines.length; j++) {
348
- const droplineName = series.droplines[j];
349
- if (droplineName === 'IC50')
350
- drawDropline(g, {viewport: viewport, xValue: series.parameters![2], dataBounds: dataBounds,
351
- curveFunc: curveFunc, logOptions: logOptions});
352
- }
353
- g.stroke();
354
- g.restore();
336
+ if ((series.showFitLine ?? true) && series.droplines && renderOptions.showDroplines!) {
337
+ g.save();
338
+ g.strokeStyle = 'blue';
339
+ g.lineWidth = renderOptions.ratio!;
340
+ g.beginPath();
341
+ g.setLineDash([5, 5]);
342
+ const viewport = renderOptions.viewport;
343
+ const dataBounds = renderOptions.dataBounds;
344
+ const curveFunc = renderOptions.curveFunc;
345
+ const logOptions = renderOptions.logOptions;
346
+ for (let j = 0; j < series.droplines.length; j++) {
347
+ const droplineName = series.droplines[j];
348
+ if (droplineName === 'IC50') {
349
+ drawDropline(g, {viewport: viewport, xValue: series.parameters![2], dataBounds: dataBounds,
350
+ curveFunc: curveFunc, logOptions: logOptions});
351
+ }
355
352
  }
353
+ g.stroke();
354
+ g.restore();
355
+ }
356
356
  }
357
357
 
358
358
  /** Performs a dropline drawing */
359
359
  function drawDropline(g: CanvasRenderingContext2D, renderOptions: FitDroplineRenderOptions): void {
360
- const logX = renderOptions.logOptions.logX;
361
- const logY = renderOptions.logOptions.logY;
362
- const xValue = logX ? Math.pow(10, renderOptions.xValue) : renderOptions.xValue;
363
- const viewport = renderOptions.viewport;
364
- const dataBounds = renderOptions.dataBounds;
365
-
366
- const xForY = logX ? Math.log10(xValue) : xValue;
367
- const y = logY ? Math.pow(10, renderOptions.curveFunc(xForY)) : renderOptions.curveFunc(xForY);
368
- const screenX = viewport.xToScreen(xValue);
369
- const screenY = viewport.yToScreen(y);
370
- g.moveTo(viewport.xToScreen(dataBounds.minX), screenY);
371
- g.lineTo(screenX, screenY);
372
- g.lineTo(screenX, viewport.yToScreen(dataBounds.minY));
360
+ const logX = renderOptions.logOptions.logX;
361
+ const logY = renderOptions.logOptions.logY;
362
+ const xValue = logX ? Math.pow(10, renderOptions.xValue) : renderOptions.xValue;
363
+ const viewport = renderOptions.viewport;
364
+ const dataBounds = renderOptions.dataBounds;
365
+
366
+ const xForY = logX ? Math.log10(xValue) : xValue;
367
+ const y = logY ? Math.pow(10, renderOptions.curveFunc(xForY)) : renderOptions.curveFunc(xForY);
368
+ const screenX = viewport.xToScreen(xValue);
369
+ const screenY = viewport.yToScreen(y);
370
+ g.moveTo(viewport.xToScreen(dataBounds.minX), screenY);
371
+ g.lineTo(screenX, screenY);
372
+ g.lineTo(screenX, viewport.yToScreen(dataBounds.minY));
373
373
  }
374
374
 
375
375
  export function renderStatistics(g: CanvasRenderingContext2D, series: IFitSeries, renderOptions: FitStatisticsRenderOptions): void {
376
- const screenBounds = renderOptions.screenBounds!;
377
- const statistics = screenBounds.width < FitConstants.MIN_POINTS_AND_STATS_VISIBILITY_PX_WIDTH ||
376
+ const screenBounds = renderOptions.screenBounds!;
377
+ const statistics = screenBounds.width < FitConstants.MIN_POINTS_AND_STATS_VISIBILITY_PX_WIDTH ||
378
378
  screenBounds.height < FitConstants.MIN_POINTS_AND_STATS_VISIBILITY_PX_HEIGHT ? [] : renderOptions.statistics;
379
- if ((series.showFitLine ?? true) && statistics && statistics.length > 0) {
380
- const dataBox = renderOptions.dataBox;
381
- const dataPoints = renderOptions.dataPoints;
382
- const seriesStatistics = getSeriesStatistics(series, renderOptions.fitFunc, dataPoints, renderOptions.logOptions);
383
- const color = getSeriesColor(series, renderOptions.seriesIdx!, ColorType.FIT_LINE);
384
- for (let i = 0; i < statistics.length; i++) {
385
- const statName = statistics[i];
386
- const prop = statisticsProperties.find((p) => p.name === statName);
387
- if (prop) {
388
- const s = StringUtils.formatNumber(prop.get(seriesStatistics));
389
- g.fillStyle = color;
390
- g.textAlign = 'left';
391
- g.fillText(prop.name + ': ' + s, dataBox.x + 5, dataBox.y + 20 + 20 * i);
392
- }
393
- }
379
+ if ((series.showFitLine ?? true) && statistics && statistics.length > 0) {
380
+ const dataBox = renderOptions.dataBox;
381
+ const dataPoints = renderOptions.dataPoints;
382
+ const seriesStatistics = getSeriesStatistics(series, renderOptions.fitFunc, dataPoints, renderOptions.logOptions);
383
+ const color = getSeriesColor(series, renderOptions.seriesIdx!, ColorType.FIT_LINE);
384
+ for (let i = 0; i < statistics.length; i++) {
385
+ const statName = statistics[i];
386
+ const prop = statisticsProperties.find((p) => p.name === statName);
387
+ if (prop) {
388
+ const s = StringUtils.formatNumber(prop.get(seriesStatistics));
389
+ g.fillStyle = color;
390
+ g.textAlign = 'left';
391
+ g.fillText(prop.name + ': ' + s, dataBox.x + 5, dataBox.y + 20 + 20 * i);
392
+ }
394
393
  }
394
+ }
395
395
  }
396
396
 
397
397
  export function renderTitle(g: CanvasRenderingContext2D, renderOptions: FitTitleRenderOptions): void {
398
- if (renderOptions.showTitle) {
399
- g.font = '12px Roboto, "Roboto Local"';
400
- g.textAlign = 'center';
401
- g.fillStyle = 'black';
402
- g.fillText(renderOptions.title!, renderOptions.dataBox.midX - 5, renderOptions.screenBounds.y + 15);
403
- }
398
+ if (renderOptions.showTitle) {
399
+ g.font = '12px Roboto, "Roboto Local"';
400
+ g.textAlign = 'center';
401
+ g.fillStyle = 'black';
402
+ g.fillText(renderOptions.title!, renderOptions.dataBox.midX - 5, renderOptions.screenBounds.y + 15);
403
+ }
404
404
  }
405
405
 
406
406
  export function renderAxesLabels(g: CanvasRenderingContext2D, renderOptions: FitAxesLabelsRenderOptions): void {
407
- if (renderOptions.showAxesLabels) {
408
- const screenBounds = renderOptions.screenBounds;
409
- const dataBox = renderOptions.dataBox;
410
- g.font = '11px Roboto, "Roboto Local"';
411
- g.textAlign = 'center';
412
- g.fillStyle = 'black';
413
- g.fillText(renderOptions.xAxisName!, dataBox.midX - 5, screenBounds.maxY - FitConstants.X_AXIS_LABEL_BOTTOM_PX_MARGIN);
414
- g.translate(screenBounds.x, screenBounds.y);
415
- g.rotate(-Math.PI / 2);
416
- const axesTopPxMargin = renderOptions.showTitle ? FitConstants.AXES_TOP_PX_MARGIN_WITH_TITLE : FitConstants.AXES_TOP_PX_MARGIN;
417
- g.fillText(renderOptions.yAxisName!, -(dataBox.height / 2 + axesTopPxMargin + 15), 15);
418
- g.restore();
419
- }
407
+ if (renderOptions.showAxesLabels) {
408
+ const screenBounds = renderOptions.screenBounds;
409
+ const dataBox = renderOptions.dataBox;
410
+ g.font = '11px Roboto, "Roboto Local"';
411
+ g.textAlign = 'center';
412
+ g.fillStyle = 'black';
413
+ g.fillText(renderOptions.xAxisName!, dataBox.midX - 5, screenBounds.maxY - FitConstants.X_AXIS_LABEL_BOTTOM_PX_MARGIN);
414
+ g.translate(screenBounds.x, screenBounds.y);
415
+ g.rotate(-Math.PI / 2);
416
+ const axesTopPxMargin = renderOptions.showTitle ? FitConstants.AXES_TOP_PX_MARGIN_WITH_TITLE : FitConstants.AXES_TOP_PX_MARGIN;
417
+ g.fillText(renderOptions.yAxisName!, -(dataBox.height / 2 + axesTopPxMargin + 15), 15);
418
+ g.restore();
419
+ }
420
420
  }
421
421
 
422
422
  export function renderLegend(g: CanvasRenderingContext2D, data: IFitChartData, renderOptions: FitLegendRenderOptions): void {
423
- if (renderOptions.showLegend) {
424
- const dataBox = renderOptions.dataBox;
425
- const ratio = renderOptions.ratio;
426
- g.font = '11px Roboto, "Roboto Local"';
427
- const columnNames = [...new Set(data.series?.map((series) => series.columnName))]
428
- .filter((colName) => colName !== null && colName !== undefined);
429
- let drawnCurvesInLegend = 0;
430
- for (let i = 0; i < columnNames.length; i++) {
431
- const colName = columnNames[i];
432
- if (data.chartOptions?.showColumnLabel)
433
- renderColumnLabel(g, colName!, {dataBox: dataBox, columnIdx: i, drawnCurvesInLegend});
434
-
435
- const series = data.series?.filter((series) => series.columnName === colName);
436
- for (let j = 0; j < series?.length!; j++) {
437
- const currentSeries = series![j];
438
- if (currentSeries.name === '' || currentSeries.name === null || currentSeries.name === undefined)
439
- continue;
440
- renderLegendSeries(g, currentSeries, {dataBox: dataBox, ratio: ratio,
441
- columnIdx: i, drawnCurvesInLegend, showColumnLabel: data.chartOptions?.showColumnLabel, seriesIdx: j});
442
- drawnCurvesInLegend++;
443
- }
444
- }
445
- g.restore();
423
+ if (renderOptions.showLegend) {
424
+ const dataBox = renderOptions.dataBox;
425
+ const ratio = renderOptions.ratio;
426
+ g.font = '11px Roboto, "Roboto Local"';
427
+ const columnNames = [...new Set(data.series?.map((series) => series.columnName))]
428
+ .filter((colName) => colName !== null && colName !== undefined);
429
+ let drawnCurvesInLegend = 0;
430
+ for (let i = 0; i < columnNames.length; i++) {
431
+ const colName = columnNames[i];
432
+ if (data.chartOptions?.showColumnLabel)
433
+ renderColumnLabel(g, colName!, {dataBox: dataBox, columnIdx: i, drawnCurvesInLegend});
434
+
435
+ const series = data.series?.filter((series) => series.columnName === colName);
436
+ for (let j = 0; j < series?.length!; j++) {
437
+ const currentSeries = series![j];
438
+ if (currentSeries.name === '' || currentSeries.name === null || currentSeries.name === undefined)
439
+ continue;
440
+ renderLegendSeries(g, currentSeries, {dataBox: dataBox, ratio: ratio,
441
+ columnIdx: i, drawnCurvesInLegend, showColumnLabel: data.chartOptions?.showColumnLabel, seriesIdx: j});
442
+ drawnCurvesInLegend++;
443
+ }
446
444
  }
445
+ g.restore();
446
+ }
447
447
  }
448
448
 
449
449
  function renderColumnLabel(g: CanvasRenderingContext2D, colName: string, renderOptions: FitLegendColumnlabelSeriesRenderOptions): void {
450
- const dataBox = renderOptions.dataBox;
451
- g.beginPath();
452
- g.fillStyle = 'black';
453
- const colNameWidth = g.measureText(colName!).width;
454
- g.fillText(colName!, dataBox.maxX - colNameWidth, dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN +
450
+ const dataBox = renderOptions.dataBox;
451
+ g.beginPath();
452
+ g.fillStyle = 'black';
453
+ const colNameWidth = g.measureText(colName!).width;
454
+ g.fillText(colName!, dataBox.maxX - colNameWidth, dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN +
455
455
  (renderOptions.columnIdx * FitConstants.LEGEND_RECORD_PX_HEIGHT + FitConstants.LEGEND_RECORD_PX_HEIGHT * renderOptions.drawnCurvesInLegend));
456
456
  }
457
457
 
458
458
  function renderLegendSeries(g: CanvasRenderingContext2D, series: IFitSeries, renderOptions: FitLegendColumnlabelSeriesRenderOptions): void {
459
- const dataBox = renderOptions.dataBox;
460
- const columnIdx = renderOptions.columnIdx;
461
- const ratio = renderOptions.ratio!;
462
- const showColumnLabel = renderOptions.showColumnLabel;
463
- const drawnCurvesInLegend = renderOptions.drawnCurvesInLegend;
464
- const pointColor = getSeriesColor(series, renderOptions.seriesIdx!, ColorType.POINT);
465
- const fitLineColor = getSeriesColor(series, renderOptions.seriesIdx!, ColorType.FIT_LINE);
466
- g.beginPath();
467
- g.strokeStyle = fitLineColor;
468
- g.lineWidth = 2 * ratio;
469
- const textWidth = g.measureText(series.name!).width;
470
- g.moveTo(dataBox.maxX - textWidth - FitConstants.LEGEND_RECORD_LINE_PX_WIDTH - FitConstants.LEGEND_RECORD_LINE_RIGHT_PX_MARGIN,
471
- dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN - FitConstants.LEGEND_RECORD_LINE_BOTTOM_PX_MARGIN +
459
+ const dataBox = renderOptions.dataBox;
460
+ const columnIdx = renderOptions.columnIdx;
461
+ const ratio = renderOptions.ratio!;
462
+ const showColumnLabel = renderOptions.showColumnLabel;
463
+ const drawnCurvesInLegend = renderOptions.drawnCurvesInLegend;
464
+ const pointColor = getSeriesColor(series, renderOptions.seriesIdx!, ColorType.POINT);
465
+ const fitLineColor = getSeriesColor(series, renderOptions.seriesIdx!, ColorType.FIT_LINE);
466
+ g.beginPath();
467
+ g.strokeStyle = fitLineColor;
468
+ g.lineWidth = 2 * ratio;
469
+ const textWidth = g.measureText(series.name!).width;
470
+ g.moveTo(dataBox.maxX - textWidth - FitConstants.LEGEND_RECORD_LINE_PX_WIDTH - FitConstants.LEGEND_RECORD_LINE_RIGHT_PX_MARGIN,
471
+ dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN - FitConstants.LEGEND_RECORD_LINE_BOTTOM_PX_MARGIN +
472
472
  (showColumnLabel ? FitConstants.LEGEND_RECORD_PX_HEIGHT * (columnIdx + 1) : 0) +
473
473
  FitConstants.LEGEND_RECORD_PX_HEIGHT * drawnCurvesInLegend);
474
- g.lineTo(dataBox.maxX - textWidth - FitConstants.LEGEND_RECORD_LINE_RIGHT_PX_MARGIN,
475
- dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN - FitConstants.LEGEND_RECORD_LINE_BOTTOM_PX_MARGIN +
474
+ g.lineTo(dataBox.maxX - textWidth - FitConstants.LEGEND_RECORD_LINE_RIGHT_PX_MARGIN,
475
+ dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN - FitConstants.LEGEND_RECORD_LINE_BOTTOM_PX_MARGIN +
476
476
  (showColumnLabel ? FitConstants.LEGEND_RECORD_PX_HEIGHT * (columnIdx + 1) : 0) +
477
477
  FitConstants.LEGEND_RECORD_PX_HEIGHT * drawnCurvesInLegend);
478
- const marker = series.markerType ? series.markerType as DG.MARKER_TYPE : DG.MARKER_TYPE.CIRCLE;
479
- DG.Paint.marker(g, marker, dataBox.maxX - textWidth - FitConstants.LEGEND_RECORD_LINE_RIGHT_PX_MARGIN
480
- - FitConstants.LEGEND_RECORD_LINE_PX_WIDTH / 2, dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN -
481
- FitConstants.LEGEND_RECORD_LINE_BOTTOM_PX_MARGIN + (showColumnLabel ? FitConstants.LEGEND_RECORD_PX_HEIGHT
482
- * (columnIdx + 1) : 0) + FitConstants.LEGEND_RECORD_PX_HEIGHT * drawnCurvesInLegend,
483
- pointColor, FitConstants.POINT_PX_SIZE * ratio);
484
- g.fillStyle = fitLineColor;
485
- g.fillText(series.name!, dataBox.maxX - textWidth,
486
- dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN + (showColumnLabel ?
478
+ const marker = series.markerType ? series.markerType as DG.MARKER_TYPE : DG.MARKER_TYPE.CIRCLE;
479
+ DG.Paint.marker(g, marker, dataBox.maxX - textWidth - FitConstants.LEGEND_RECORD_LINE_RIGHT_PX_MARGIN -
480
+ FitConstants.LEGEND_RECORD_LINE_PX_WIDTH / 2, dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN -
481
+ FitConstants.LEGEND_RECORD_LINE_BOTTOM_PX_MARGIN + (showColumnLabel ? FitConstants.LEGEND_RECORD_PX_HEIGHT *
482
+ (columnIdx + 1) : 0) + FitConstants.LEGEND_RECORD_PX_HEIGHT * drawnCurvesInLegend,
483
+ pointColor, FitConstants.POINT_PX_SIZE * ratio);
484
+ g.fillStyle = fitLineColor;
485
+ g.fillText(series.name!, dataBox.maxX - textWidth,
486
+ dataBox.y + FitConstants.LEGEND_TOP_PX_MARGIN + (showColumnLabel ?
487
487
  FitConstants.LEGEND_RECORD_PX_HEIGHT * (columnIdx + 1) : 0) + FitConstants.LEGEND_RECORD_PX_HEIGHT * drawnCurvesInLegend);
488
- g.stroke();
488
+ g.stroke();
489
489
  }