tradingview / lightweight-charts

Performant financial charts built with HTML5 canvas
https://www.tradingview.com/lightweight-charts/
Apache License 2.0
9.33k stars 1.61k forks source link

still showing price line label after removing it #1021

Closed shaohlalnyd closed 2 years ago

shaohlalnyd commented 2 years ago

Hi I have 3 price line in my chart .and update them after stream received When new data received from socket , first I remove the previous price line and then add new. Every thing is okay, but when user de active the page (Like go to another tab) price line removed but the label of that price line still showing WhatsApp Image 2022-02-16 at 8 04 38 PM

the above photo its what heppening.

i coding in react . if (priceLineSerie) candleSerie.removePriceLine(priceLineSerie); if (tp1LineSerie) candleSerie.removePriceLine(tp1LineSerie); if (slLineSerie) candleSerie.removePriceLine(slLineSerie); if (candleSerie) candleSerie.setMarkers([]);

the above code when run a new event received and remove the price lines.

` //entry price line

const priceLine = candleSerie.createPriceLine({
  price: chartData.entryPrice,
  color: "#0000ff",
  lineWidth: 2,
  // lineStyle: 'Solid',
  axisLabelVisible: true,
  title: "Price",
});

setPriceLineSerie(priceLine);

candleSerie.createPriceLine(priceLine);

//tp1 line

const tp1Line = candleSerie.createPriceLine({
  price: chartData.tp1,
  color: "#00ff00",
  lineWidth: 2,
  // lineStyle: 'Solid',
  axisLabelVisible: true,
  title: "TP",
});

setTp1LineSerie(tp1Line);

candleSerie.createPriceLine(tp1Line);

//sl line

const slLine = candleSerie.createPriceLine({
  price: chartData.sl,
  color: "#ff0000",
  lineWidth: 2,
  // lineStyle: 'Solid',
  axisLabelVisible: true,
  title: "SL",
});

setSlLineSerie(slLine);

candleSerie.createPriceLine(slLine);`

above code , add price line to candle serie.

Please help me how to fix it

timocov commented 2 years ago

Duplicate of #1020

timocov commented 2 years ago

Please don't create the same issues

timocov commented 2 years ago

If you have any additional information for a ticket, just post it there, no need to create the same ticket with a bit different information.

shaohlalnyd commented 2 years ago

If you have any additional information for a ticket, just post it there, no need to create the same ticket with a bit different information.

all tickets is still close . please open one of these issues