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

Subchart functionality cannot be implemented in pyside6 #522

Open
yumianhuli1 opened this issue Feb 27, 2025 · 0 comments
Open

Subchart functionality cannot be implemented in pyside6 #522

yumianhuli1 opened this issue Feb 27, 2025 · 0 comments

Comments

@yumianhuli1
Copy link

yumianhuli1 commented Feb 27, 2025

import sys
import pandas as pd
import pandas_ta
from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget
from lightweight_charts.widgets import QtChart
import importlib.metadata

class MainWindow(QWidget):
def init(self):
super().init()
self.setWindowTitle('Lightweight Charts Example')
self.resize(800, 600)

    layout = QVBoxLayout()
    self.setLayout(layout)

    chart = QtChart(self)
    chart.legend(visible=True)

    df = pd.read_csv('ohlcv.csv')
    df.date = pd.to_datetime(df.date, format='%Y-%m-%d')
    df = df['date open high low close volume'.split()]
    df = df.set_index('date')

    df[['macd', 'hist', 'signal']] = pandas_ta.macd(df.close, slow=14, fast=7, signal=2)
    df = df.dropna()
    chart.set(df)

    subplot = chart.create_subchart(height=0.4, width=1)
    subplot.legend(visible=True)
    hist = subplot.create_histogram(name='hist')
    hist.set(df[['hist']])

    hist.delete()  # DELETE SHOULD REMOVE LEGEND

    hist2 = subplot.create_histogram(name='hist')
    hist2.set(df[['hist']])

    chart.topbar.textbox('version', f'v{importlib.metadata.version("lightweight_charts")}')

    layout.addWidget(chart.get_webview())

if name == 'main':
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())

Image

@yumianhuli1 yumianhuli1 changed the title Volume subchart have its own Y-axis Volume subchart have its own Y-axis by PySide6 Feb 28, 2025
@yumianhuli1 yumianhuli1 changed the title Volume subchart have its own Y-axis by PySide6 Subchart functionality cannot be implemented in pyside6 Feb 28, 2025
@yumianhuli1 yumianhuli1 changed the title Subchart functionality cannot be implemented in pyside6 Subchart functionality cannot be implemented in pyQT Feb 28, 2025
@yumianhuli1 yumianhuli1 changed the title Subchart functionality cannot be implemented in pyQT Subchart functionality cannot be implemented in pyqt5 Feb 28, 2025
@yumianhuli1 yumianhuli1 changed the title Subchart functionality cannot be implemented in pyqt5 Subchart functionality cannot be implemented in pyside6 Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant