@devexperts/dxcharts-lite 2.7.3 → 2.7.5
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.
|
@@ -367,11 +367,14 @@ export class CanvasBoundsContainer {
|
|
|
367
367
|
*/
|
|
368
368
|
getXAxisBounds(nMap, canvas) {
|
|
369
369
|
const xAxis = this.getBounds(CanvasElement.X_AXIS);
|
|
370
|
+
const isSingleYAxis = this.yAxisWidths.left.length + this.yAxisWidths.right.length === 1;
|
|
371
|
+
const leftOffset = isSingleYAxis ? 0 : this.yAxisWidths.left.reduce((acc, width) => (acc += width), 0);
|
|
372
|
+
const rightOffset = isSingleYAxis ? 0 : this.yAxisWidths.right.reduce((acc, width) => (acc += width), 0);
|
|
370
373
|
if (this.config.components.xAxis.visible) {
|
|
371
374
|
const xAxisHeight = this.getXAxisHeight();
|
|
372
|
-
xAxis.x =
|
|
375
|
+
xAxis.x = leftOffset;
|
|
373
376
|
xAxis.y = canvas.height - xAxisHeight - nMap.height;
|
|
374
|
-
xAxis.width = canvas.width;
|
|
377
|
+
xAxis.width = canvas.width - rightOffset;
|
|
375
378
|
xAxis.height = xAxisHeight;
|
|
376
379
|
}
|
|
377
380
|
else {
|
|
@@ -61,6 +61,9 @@ export class XAxisTimeLabelsDrawer {
|
|
|
61
61
|
ctx.fillStyle = color;
|
|
62
62
|
for (const label of labels) {
|
|
63
63
|
const x = this.viewportModel.toX(label.value) - calculateTextWidth(label.text, ctx, font) / 2;
|
|
64
|
+
if (x < bounds.x || x > bounds.width) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
64
67
|
const y = bounds.y + fontHeight - 1 + offsetTop; // -1 for font drawing inconsistency
|
|
65
68
|
const labelText = label.text;
|
|
66
69
|
ctx.font = font;
|