mdas-jsview-sdk 1.0.10-uat.0 → 1.0.11-uat.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/dist/mdas-sdk.esm.js +154 -72
- package/dist/mdas-sdk.esm.js.map +1 -1
- package/dist/mdas-sdk.js +154 -72
- package/dist/mdas-sdk.js.map +1 -1
- package/dist/mdas-sdk.min.js +9 -9
- package/dist/mdas-sdk.min.js.map +1 -1
- package/package.json +1 -1
package/dist/mdas-sdk.js
CHANGED
|
@@ -38195,16 +38195,28 @@ ${SharedStyles}
|
|
|
38195
38195
|
|
|
38196
38196
|
if (this.chartType === 'candlestick') {
|
|
38197
38197
|
// Prepare OHLC data for candlestick chart
|
|
38198
|
-
|
|
38199
|
-
x
|
|
38200
|
-
|
|
38201
|
-
|
|
38202
|
-
|
|
38203
|
-
|
|
38204
|
-
|
|
38205
|
-
|
|
38206
|
-
|
|
38207
|
-
}
|
|
38198
|
+
if (this.rangeBack > 0) {
|
|
38199
|
+
// For multi-day charts, use index as x-value (linear scale)
|
|
38200
|
+
chartDataPoints = validDataPoints.map((point, index) => ({
|
|
38201
|
+
x: index,
|
|
38202
|
+
o: point.open,
|
|
38203
|
+
h: point.high,
|
|
38204
|
+
l: point.low,
|
|
38205
|
+
c: point.close
|
|
38206
|
+
}));
|
|
38207
|
+
} else {
|
|
38208
|
+
// For single-day charts, use timestamps (time scale)
|
|
38209
|
+
chartDataPoints = validDataPoints.map(point => ({
|
|
38210
|
+
x: this.parseTimestamp(point.time).getTime(),
|
|
38211
|
+
o: point.open,
|
|
38212
|
+
h: point.high,
|
|
38213
|
+
l: point.low,
|
|
38214
|
+
c: point.close
|
|
38215
|
+
})).filter(point => {
|
|
38216
|
+
// Filter out invalid timestamps
|
|
38217
|
+
return !isNaN(point.x) && point.x > 0;
|
|
38218
|
+
});
|
|
38219
|
+
}
|
|
38208
38220
|
if (chartDataPoints.length === 0) {
|
|
38209
38221
|
console.error('[IntradayChartWidget] No valid candlestick data points after date parsing');
|
|
38210
38222
|
this.showError('Unable to parse chart data timestamps');
|
|
@@ -38226,14 +38238,23 @@ ${SharedStyles}
|
|
|
38226
38238
|
};
|
|
38227
38239
|
} else {
|
|
38228
38240
|
// Prepare data with timestamps for line/area chart
|
|
38229
|
-
|
|
38230
|
-
x
|
|
38231
|
-
|
|
38232
|
-
|
|
38233
|
-
|
|
38234
|
-
|
|
38235
|
-
|
|
38236
|
-
|
|
38241
|
+
if (this.rangeBack > 0) {
|
|
38242
|
+
// For multi-day charts, use index as x-value (linear scale)
|
|
38243
|
+
chartDataPoints = validDataPoints.map((point, index) => ({
|
|
38244
|
+
x: index,
|
|
38245
|
+
y: point.close
|
|
38246
|
+
}));
|
|
38247
|
+
} else {
|
|
38248
|
+
// For single-day charts, use timestamps (time scale)
|
|
38249
|
+
chartDataPoints = validDataPoints.map(point => ({
|
|
38250
|
+
x: this.parseTimestamp(point.time),
|
|
38251
|
+
y: point.close
|
|
38252
|
+
})).filter(point => {
|
|
38253
|
+
// Filter out invalid dates
|
|
38254
|
+
const timestamp = point.x.getTime();
|
|
38255
|
+
return !isNaN(timestamp) && timestamp > 0;
|
|
38256
|
+
});
|
|
38257
|
+
}
|
|
38237
38258
|
if (chartDataPoints.length === 0) {
|
|
38238
38259
|
console.error('[IntradayChartWidget] No valid chart data points after date parsing');
|
|
38239
38260
|
this.showError('Unable to parse chart data timestamps');
|
|
@@ -38268,16 +38289,23 @@ ${SharedStyles}
|
|
|
38268
38289
|
console.log('[IntradayChartWidget] Last data point - Source time:', validDataPoints[validDataPoints.length - 1].time);
|
|
38269
38290
|
console.log('[IntradayChartWidget] Last chart point:', chartDataPoints[chartDataPoints.length - 1]);
|
|
38270
38291
|
|
|
38271
|
-
// Calculate explicit min/max for x-axis
|
|
38272
|
-
|
|
38273
|
-
|
|
38274
|
-
|
|
38275
|
-
|
|
38276
|
-
min
|
|
38277
|
-
max
|
|
38278
|
-
|
|
38279
|
-
|
|
38280
|
-
|
|
38292
|
+
// Calculate explicit min/max for x-axis (only for time scale, not linear)
|
|
38293
|
+
let minTimestamp, maxTimestamp;
|
|
38294
|
+
if (this.rangeBack === 0) {
|
|
38295
|
+
// For time scale, calculate timestamp bounds
|
|
38296
|
+
const timestamps = chartDataPoints.map(p => this.chartType === 'candlestick' ? p.x : p.x.getTime());
|
|
38297
|
+
minTimestamp = Math.min(...timestamps);
|
|
38298
|
+
maxTimestamp = Math.max(...timestamps);
|
|
38299
|
+
console.log('[IntradayChartWidget] X-axis bounds:', {
|
|
38300
|
+
min: minTimestamp,
|
|
38301
|
+
max: maxTimestamp,
|
|
38302
|
+
minDate: new Date(minTimestamp),
|
|
38303
|
+
maxDate: new Date(maxTimestamp)
|
|
38304
|
+
});
|
|
38305
|
+
} else {
|
|
38306
|
+
// For linear scale, bounds are just indices
|
|
38307
|
+
console.log('[IntradayChartWidget] Using linear scale with', chartDataPoints.length, 'data points');
|
|
38308
|
+
}
|
|
38281
38309
|
const config = {
|
|
38282
38310
|
type: this.chartType === 'candlestick' ? 'candlestick' : 'line',
|
|
38283
38311
|
data: {
|
|
@@ -38315,10 +38343,9 @@ ${SharedStyles}
|
|
|
38315
38343
|
const index = context[0].dataIndex;
|
|
38316
38344
|
const point = validDataPoints[index];
|
|
38317
38345
|
if (point) {
|
|
38318
|
-
//
|
|
38346
|
+
// Display timestamp as-is from the data, without timezone conversion
|
|
38319
38347
|
const date = new Date(point.time);
|
|
38320
38348
|
return date.toLocaleString('en-US', {
|
|
38321
|
-
timeZone: 'America/New_York',
|
|
38322
38349
|
month: '2-digit',
|
|
38323
38350
|
day: '2-digit',
|
|
38324
38351
|
year: 'numeric',
|
|
@@ -38369,62 +38396,60 @@ ${SharedStyles}
|
|
|
38369
38396
|
}
|
|
38370
38397
|
},
|
|
38371
38398
|
annotation: {
|
|
38372
|
-
annotations:
|
|
38373
|
-
livePriceLine: {
|
|
38374
|
-
type: 'line',
|
|
38375
|
-
scaleID: 'y',
|
|
38376
|
-
value: this.livePrice || stats.close,
|
|
38377
|
-
borderColor: '#667eea',
|
|
38378
|
-
borderWidth: 2,
|
|
38379
|
-
borderDash: [5, 5],
|
|
38380
|
-
label: {
|
|
38381
|
-
display: true,
|
|
38382
|
-
content: this.livePrice ? `$${this.livePrice.toFixed(2)}` : `$${stats.close.toFixed(2)}`,
|
|
38383
|
-
enabled: true,
|
|
38384
|
-
position: 'end',
|
|
38385
|
-
backgroundColor: 'rgb(102, 126, 234)',
|
|
38386
|
-
color: '#ffffff',
|
|
38387
|
-
font: {
|
|
38388
|
-
size: 12,
|
|
38389
|
-
weight: 'bold',
|
|
38390
|
-
family: 'system-ui, -apple-system, sans-serif'
|
|
38391
|
-
},
|
|
38392
|
-
padding: {
|
|
38393
|
-
top: 4,
|
|
38394
|
-
bottom: 4,
|
|
38395
|
-
left: 8,
|
|
38396
|
-
right: 8
|
|
38397
|
-
},
|
|
38398
|
-
borderRadius: 4,
|
|
38399
|
-
xAdjust: -10,
|
|
38400
|
-
yAdjust: 0
|
|
38401
|
-
}
|
|
38402
|
-
}
|
|
38403
|
-
}
|
|
38399
|
+
annotations: this.createAnnotations(validDataPoints, stats)
|
|
38404
38400
|
}
|
|
38405
38401
|
},
|
|
38406
38402
|
scales: {
|
|
38407
38403
|
x: {
|
|
38408
|
-
type: 'time',
|
|
38409
|
-
min: minTimestamp,
|
|
38410
|
-
max: maxTimestamp,
|
|
38411
|
-
time: {
|
|
38412
|
-
unit:
|
|
38404
|
+
type: this.rangeBack === 0 ? 'time' : 'linear',
|
|
38405
|
+
min: this.rangeBack === 0 ? minTimestamp : undefined,
|
|
38406
|
+
max: this.rangeBack === 0 ? maxTimestamp : undefined,
|
|
38407
|
+
time: this.rangeBack === 0 ? {
|
|
38408
|
+
unit: 'hour',
|
|
38409
|
+
stepSize: 1,
|
|
38413
38410
|
displayFormats: {
|
|
38414
|
-
|
|
38415
|
-
hour: 'MMM d, ha'
|
|
38411
|
+
hour: 'h:mm a'
|
|
38416
38412
|
},
|
|
38417
38413
|
tooltipFormat: 'MMM d, h:mm a'
|
|
38418
|
-
},
|
|
38414
|
+
} : undefined,
|
|
38419
38415
|
grid: {
|
|
38420
38416
|
display: false
|
|
38421
38417
|
},
|
|
38422
38418
|
ticks: {
|
|
38423
|
-
maxTicksLimit: 10,
|
|
38419
|
+
maxTicksLimit: this.rangeBack === 0 ? 10 : 8,
|
|
38424
38420
|
color: '#6b7280',
|
|
38425
38421
|
autoSkip: true,
|
|
38426
38422
|
maxRotation: 0,
|
|
38427
|
-
minRotation: 0
|
|
38423
|
+
minRotation: 0,
|
|
38424
|
+
callback: (value, index) => {
|
|
38425
|
+
if (this.rangeBack > 0) {
|
|
38426
|
+
// For multi-day charts with linear scale, show actual time from data point
|
|
38427
|
+
const point = validDataPoints[index];
|
|
38428
|
+
if (point) {
|
|
38429
|
+
const date = new Date(point.time);
|
|
38430
|
+
return date.toLocaleString('en-US', {
|
|
38431
|
+
month: 'short',
|
|
38432
|
+
day: 'numeric',
|
|
38433
|
+
hour: 'numeric',
|
|
38434
|
+
minute: '2-digit',
|
|
38435
|
+
hour12: true
|
|
38436
|
+
});
|
|
38437
|
+
}
|
|
38438
|
+
return '';
|
|
38439
|
+
}
|
|
38440
|
+
// For single-day time scale, provide fallback formatting
|
|
38441
|
+
// If value is a number (timestamp), format it
|
|
38442
|
+
if (typeof value === 'number') {
|
|
38443
|
+
const date = new Date(value);
|
|
38444
|
+
return date.toLocaleString('en-US', {
|
|
38445
|
+
hour: 'numeric',
|
|
38446
|
+
minute: '2-digit',
|
|
38447
|
+
hour12: true
|
|
38448
|
+
});
|
|
38449
|
+
}
|
|
38450
|
+
// Otherwise let Chart.js handle it (if date adapter is working)
|
|
38451
|
+
return value;
|
|
38452
|
+
}
|
|
38428
38453
|
}
|
|
38429
38454
|
},
|
|
38430
38455
|
y: {
|
|
@@ -38470,6 +38495,63 @@ ${SharedStyles}
|
|
|
38470
38495
|
// Add reset zoom button listener
|
|
38471
38496
|
this.setupZoomReset();
|
|
38472
38497
|
}
|
|
38498
|
+
createAnnotations(dataPoints, stats) {
|
|
38499
|
+
const annotations = {
|
|
38500
|
+
livePriceLine: {
|
|
38501
|
+
type: 'line',
|
|
38502
|
+
scaleID: 'y',
|
|
38503
|
+
value: this.livePrice || stats.close,
|
|
38504
|
+
borderColor: '#667eea',
|
|
38505
|
+
borderWidth: 2,
|
|
38506
|
+
borderDash: [5, 5],
|
|
38507
|
+
label: {
|
|
38508
|
+
display: true,
|
|
38509
|
+
content: this.livePrice ? `$${this.livePrice.toFixed(2)}` : `$${stats.close.toFixed(2)}`,
|
|
38510
|
+
enabled: true,
|
|
38511
|
+
position: 'end',
|
|
38512
|
+
backgroundColor: 'rgb(102, 126, 234)',
|
|
38513
|
+
color: '#ffffff',
|
|
38514
|
+
font: {
|
|
38515
|
+
size: 12,
|
|
38516
|
+
weight: 'bold',
|
|
38517
|
+
family: 'system-ui, -apple-system, sans-serif'
|
|
38518
|
+
},
|
|
38519
|
+
padding: {
|
|
38520
|
+
top: 4,
|
|
38521
|
+
bottom: 4,
|
|
38522
|
+
left: 8,
|
|
38523
|
+
right: 8
|
|
38524
|
+
},
|
|
38525
|
+
borderRadius: 4,
|
|
38526
|
+
xAdjust: -10,
|
|
38527
|
+
yAdjust: 0
|
|
38528
|
+
}
|
|
38529
|
+
}
|
|
38530
|
+
};
|
|
38531
|
+
|
|
38532
|
+
// Add day separators for multi-day charts (5D, etc.)
|
|
38533
|
+
if (this.rangeBack > 0 && dataPoints.length > 0) {
|
|
38534
|
+
let currentDay = null;
|
|
38535
|
+
dataPoints.forEach((point, index) => {
|
|
38536
|
+
const pointDate = new Date(point.time);
|
|
38537
|
+
const day = pointDate.toDateString();
|
|
38538
|
+
|
|
38539
|
+
// Add vertical line at the start of each new day
|
|
38540
|
+
if (currentDay !== day && currentDay !== null) {
|
|
38541
|
+
annotations[`daySeparator${index}`] = {
|
|
38542
|
+
type: 'line',
|
|
38543
|
+
scaleID: 'x',
|
|
38544
|
+
value: index,
|
|
38545
|
+
borderColor: 'rgba(0, 0, 0, 0.1)',
|
|
38546
|
+
borderWidth: 1,
|
|
38547
|
+
borderDash: [3, 3]
|
|
38548
|
+
};
|
|
38549
|
+
}
|
|
38550
|
+
currentDay = day;
|
|
38551
|
+
});
|
|
38552
|
+
}
|
|
38553
|
+
return annotations;
|
|
38554
|
+
}
|
|
38473
38555
|
setupZoomReset() {
|
|
38474
38556
|
const resetBtn = this.container.querySelector('.zoom-reset-btn');
|
|
38475
38557
|
if (resetBtn) {
|