We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When I set chart.precision(5) I expect a 5 digits number be shown in the line legend
chart.precision(5)
Even when I set the precision I always see a 2 digits number instead.
I've made a temporal fix by changing: this.legendItemFormat(s.value,t.precision) by this.legendItemFormat(s.value,this.handler.precision)
this.legendItemFormat(s.value,t.precision)
this.legendItemFormat(s.value,this.handler.precision)
But I'm not sure if this is the "right" fix and this fix also depends on this PR to me merged #500
import pandas as pd from lightweight_charts import Chart def calculate_sma(df, period: int = 50): return pd.DataFrame({ 'time': df['date'], f'SMA {period}': df['close'].rolling(window=period).mean() }).dropna() if __name__ == '__main__': chart = Chart() line = chart.create_line(name='SMA 50') df = pd.read_csv('ohlcv.csv') sma_df = calculate_sma(df, period=50) chart.precision(5) chart.legend(visible=True) chart.set(df) line.set(sma_df) chart.show(block=True)
- OS: Windows and Mac - Library: 2.1
The text was updated successfully, but these errors were encountered:
I should have called line.precision(5) and the code works.
line.precision(5)
Maybe it will be a good idea to use the chart's precision when the line is created by for example calling: self.precision(chart.num_decimals)
self.precision(chart.num_decimals)
Sorry, something went wrong.
No branches or pull requests
Expected Behavior
When I set
chart.precision(5)
I expect a 5 digits number be shown in the line legendCurrent Behaviour
Even when I set the precision I always see a 2 digits number instead.
I've made a temporal fix by changing:
this.legendItemFormat(s.value,t.precision)
by
this.legendItemFormat(s.value,this.handler.precision)
But I'm not sure if this is the "right" fix and this fix also depends on this PR to me merged #500
Reproducible Example
Environment
The text was updated successfully, but these errors were encountered: