TechfaneTechnologies / pytvlwcharts

An Experimental Python Wrapper For Tradingview's Lightweight-Charts To Be Used In Notebook Environments (Google Colab).
https://techfanetechnologies.github.io/pytvlwcharts/README.md
Apache License 2.0
335 stars 75 forks source link

Price Line and Set marker #6

Closed tabatabaei closed 1 year ago

tabatabaei commented 2 years ago

I found this code on the Jinja template which creates the price lines and sets the markers in the chart but I could not find any related function. How can I use this ability in this library?

   chart_series.setMarkers(
     {{ series.markers }}
   );
   {% for price_line in series.price_lines %}
   chart_series.createPriceLine({{ price_line }});
   chart.subscribeCrosshairMove(param => {
       if (param.time) console.log(param.seriesPrices.get(chart_series))
    });
   {% endfor %}
MooneDrJune commented 1 year ago

I found this code on the Jinja template which creates the price lines and sets the markers in the chart but I could not find any related function. How can I use this ability in this library?

   chart_series.setMarkers(
     {{ series.markers }}
   );
   {% for price_line in series.price_lines %}
   chart_series.createPriceLine({{ price_line }});
   chart.subscribeCrosshairMove(param => {
       if (param.time) console.log(param.seriesPrices.get(chart_series))
    });
   {% endfor %}

Do These.. %pip install --quiet -U git+https://github.com/TechfaneTechnologies/pytvlwcharts.git image

from pytvlwcharts import *
import pandas as pd

have your data ready in a dataframe image

Then Do This

chart = Chart(
    width = 1360,
    height = 400,
    time_scale=TimeScaleOptions(
        seconds_visible=True,
        time_visible=True)
    )
chart.mark_line(data=df, title='Banknifty', color='#2962FF', lineWidth=LineWidth.LINEWIDTH_3, lineType=0, lineStyle=LineStyle.LINESTYLE_0, lastPriceAnimation=True)

It will plot the line series like this image