Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlay series title is not rendered when no series use right price scale #926

Closed
SuperPenguin opened this issue Dec 3, 2021 · 1 comment · Fixed by #929
Closed

Overlay series title is not rendered when no series use right price scale #926

SuperPenguin opened this issue Dec 3, 2021 · 1 comment · Fixed by #929
Assignees
Labels
bug Unexpected problem or unintended behavior.
Milestone

Comments

@SuperPenguin
Copy link
Contributor

Lightweight Charts Version: 3.7.0

Steps/code to reproduce:

import { createChart, LineData, UTCTimestamp } from "lightweight-charts";

const chartRoot = document.getElementById("main-chart") as HTMLDivElement;
const chart = createChart(chartRoot, {
  width: 800,
  height: 600,
});

const line1 = chart.addLineSeries({
  priceScaleId: "overlay",
  color: "rgb(255, 0, 0)",
  title: "SIN",
});
const line2 = chart.addLineSeries({
  priceScaleId: "overlay",
  color: "rgb(0, 255, 0)",
  title: "COS",
});

const data1: LineData[] = [];
const data2: LineData[] = [];

const now = new Date();
function dateToUTC(date: Date): UTCTimestamp {
  return Math.floor(date.getTime() / 1000) as UTCTimestamp;
}

for (let i = 0; i < 90; i++) {
  data1.push({
    time: dateToUTC(now),
    value: Math.sin(i * 4 * Math.PI / 180),
  });

  data2.push({
    time: dateToUTC(now),
    value: Math.cos(i * 4 * Math.PI / 180),
  });

  now.setDate(now.getDate() + 1);
}

line1.setData(data1);
line2.setData(data2);

Actual behavior:

Series title is not rendered

Expected behavior:

Series title should rendered

When another series is added that use right priceScale, even though it's not used, will fixed issue above. However if it used only left priceScale, it won't render title properly again

const line3 = chart.addLineSeries();

Screenshots:

image

with line3 added
image

CodeSandbox/JSFiddle/etc link:

@timocov timocov added the bug Unexpected problem or unintended behavior. label Dec 3, 2021
@timocov timocov added this to the 3.8 milestone Dec 3, 2021
@timocov
Copy link
Contributor

timocov commented Dec 3, 2021

@SuperPenguin what's the reason to use empty visible price scale (right or left but without sources)? just to display values from overlay sources? it seems that it will be pretty much clear without anything on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected problem or unintended behavior.
Projects
None yet
3 participants