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

Custom price lines should be atop of the series #684

Closed christose closed 2 years ago

christose commented 3 years ago

Lightweight Charts Version:

Steps/code to reproduce: By setting a custom price line in the series, it gets override from the series graph.

var priceLine = {
      price: 1.21781,
      color: "#ffffff",
      lineWidth: 1,
      lineStyle: LineStyle.Solid,
      axisLabelVisible: true,
    } as PriceLineOptions;

if (this.PriceLine == null) {
        this.PriceLine = this.ChartSeries.createPriceLine(priceLine);
      }
      else {
        this.PriceLine.applyOptions(priceLine);
      }

Actual behavior:

Expected behavior: The expected behavior is the price line to be on top of any series elements like a candlestick or a line, area etc.

Screenshots: image image

CodeSandbox/JSFiddle/etc link:

timocov commented 3 years ago

Related to https://github.com/tradingview/lightweight-charts/discussions/681

It seems that it's intended right now, but I think it's strange and we have to change that.

gkrasulya commented 3 years ago

Hi. Could you please point out what place in code should be fixed? I may try to create pull request

timocov commented 3 years ago

All should be done here is move this code after res.push(this._priceLineView); line. I think that's it. But please keep in mind that since it's breaking change we cannot merge it in the following 3.4 release so it will wait for 4.0 (which we're planning right after 3.4 if nothing is changed).