Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-96191

Add QCategoryAxis as a time axis for QCandlestickSeries

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.2.0 Beta3
    • Charts
    • None
    • All

    Description

      I'm using an approach similar to TradingView's Lightweight Charts for drawing nice numbers for time values. It has one so-called logical axis, a float axis whose round values correspond to the indices of a data set and indicate current zoom and pan levels. I compute a tick interval and a tick anchor and attach category labels (with time values) where I need to draw them. And I can skip weekends and non-trading hours as well as opposed to QDateTimeAxis. I've attached the screenshot, how it looks.

      All is needed from you is to add one line

      case QAbstractAxis::AxisTypeCategory:

      here:
      https://code.qt.io/cgit/qt/qtcharts.git/tree/src/charts/candlestickchart/candlestick.cpp?h=v6.2.0-beta3#n239

      Currently I'm using an ugly hack, I've created a QCategoryAxis subclass and overridden the type() method, where I just determine with __builtin_return_address(0) and dladdr the calling function and if it is the Candlestick::updateGeometry I return AxisTypeValue, otherwise the behaviour is default. Technically it works but it depends on the private code changes.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            e0348803 Miikka Heikkinen
            mishurov Alexander Mishirov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes