Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Candlestick is not showing without data
Forum Updated to NodeBB v4.3 + New Features

Candlestick is not showing without data

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 395 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tuai
    wrote on last edited by
    #1

    Hello i am new to using Qt5,
    I'm trying to make a candlestick chart but can't get my data on the chart, can someone tell me what I'm doing wrong?

    Dataset:
    Date,Open,High,Low,Close,Adj Close,Volume
    2020-01-01,7194.892090,7254.330566,7174.944336,7200.174316,7200.174316,18565664997
    more data ...

    def create_candle_chart(self, symbol):
            series = QtCharts.QCandlestickSeries()
            series.setIncreasingColor(Qt.green)
            series.setDecreasingColor(Qt.red)
    
            with open('ETH-USD-29_SEP_2021-10_NOV_2021.csv', 'r') as csvFile:
                csvReader = csv.reader(csvFile, delimiter=",")
                horizontal_list = list()
                for row in csvReader:
                    set = QtCharts.QCandlestickSet()
                    horizontal_list.append(row[0])
                    set.open = float(row[1])
                    set.high = float(row[2])
                    set.low = float(row[3])
                    set.close = float(row[4])
                    series.append(set)
    
                candleChart = QtCharts.QChart()
                candleChart.addSeries(series)
                candleChart.createDefaultAxes()
                candleChart.setTitle('Candlestick')
                candleChart.setAnimationOptions(QtCharts.QChart.AllAnimations)
                candleChart.setTheme(QtCharts.QChart.ChartThemeDark)
                candleChart.axisX(series).setCategories(horizontal_list)
    
                candleChart.setVisible(True)
    
                chart_view = QtCharts.QChartView(candleChart)
    
                self.ui.candleChart.addWidget(chart_view)
    

    this is what i get:
    3d346566-e1ec-4ae5-8d90-8536c6928158-2021-12-17 (2).png

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What happens if you use the setter of each property ?

      On a side note, set is a Python keyword, you should either use a more relevant variable name or use set_ to avoid replacing the original set type.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved