Skip to content

ISeriesPrimitiveAxisView doesn't prevent overlapping #1886

@mqklin

Description

@mqklin

Lightweight Charts™ Version: 5.0.6

Steps/code to reproduce:

import {
  type ISeriesPrimitive,
  type ISeriesPrimitiveAxisView,
  type Time,
} from 'lightweight-charts';

class VertLineTimeAxisView implements ISeriesPrimitiveAxisView {
  constructor(coordinate: number) {
    this._coordinate = coordinate;
  }
  coordinate() {
    return this._coordinate;
  }
  text() {
    return '123';
  }
  textColor() {
    return 'white';
  }
  backColor() {
    return 'black';
  }
}

class Label implements ISeriesPrimitive<Time> {
  constructor(coordinate: number) {
    this._coordinate = coordinate;
  }
  timeAxisViews() {
    return [new VertLineTimeAxisView(this._coordinate)];
  }
}

const label = new Label(0);
const label2 = new Label(40);
series.attachPrimitive(label);
series.attachPrimitive(label2);

Actual behavior:

Labels are overlapping

Expected behavior:

Labels should not overlap

Screenshots:

Image

CodeSandbox/JSFiddle/etc link:

Example of the bug that reproduces the screenshot above: https://github.com/tradingview/lightweight-charts/pull/1887/files

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions