Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Mouse Hover QChart show points Candlestick Series



  • Hello,

    Anyone know how to show the values of a Candlestick series on a Qchart with a mouse hover?

    Specifically I'm trying to show the Open, high, low, and close of the bar value.

    I have 4 Labels that would accept the values, bar_open, bar_high, bar_low, and bar_close.

    code_text
    ```def call_sym_data(self):
            self.chartlayout.removeWidget(self.chartviewer)
            sym = self.sym_input.text()
            sym_raw = quandl.get("EOD/"+sym, start_date = str(self.start_date.text()), end_date = str(self.end_date.text()))
            can_data = pd.DataFrame( columns = ['Adj_Open','Adj_High','Adj_Low','Adj_Close'])
            can_data['Adj_Open'] = sym_raw['Adj_Open']
            can_data['Adj_High'] = sym_raw['Adj_High']
            can_data['Adj_Low'] = sym_raw['Adj_Low']
            can_data['Adj_Close'] = sym_raw['Adj_Close']
            
            print(can_data)
            sym_date = sym_raw.index
            
            series = QCandlestickSeries()
            series.setDecreasingColor(Qt.red)
            series.setIncreasingColor(Qt.green)
            
            
            for  index, row in can_data.iterrows():
                series.append(QCandlestickSet(row['Adj_Open'], row['Adj_High'], row['Adj_Low'], row['Adj_Close']))
                
               
            
            self.sym_chart = QChart()
            
            self.sym_chart.addSeries(series)
            
            self.sym_chart.setAnimationOptions(QChart.SeriesAnimations)
            self.sym_chart.createDefaultAxes()
            self.sym_chart.legend().hide()
            
            self.sym_chart.axisX(series).setCategories(sym_date.strftime("%Y-%m-%d"))
            
            
            self.chartviewer = QChartView(self.sym_chart)
            self.chartlayout.addWidget(self.chartviewer)

Log in to reply