Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Formatting axisX of box plot as date time type
QtWS25 Last Chance

Formatting axisX of box plot as date time type

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 737 Views
  • 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.
  • V Offline
    V Offline
    vorlket
    wrote on last edited by
    #1

    followed the example http://doc.qt.io/qt-5/qtcharts-boxplotchart-example.html, to generate box plot and trying to figure out how to add date time axisX.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      you can use http://doc.qt.io/qt-5/qdatetimeaxis.html

      QDateTimeAxis *axisX = new QDateTimeAxis;
      axisX->setFormat("dd-MM-yyyy");
      chart->setAxisX(axisX, boxWhiskSeries);
      

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • V Offline
        V Offline
        vorlket
        wrote on last edited by vorlket
        #3

        Yep. How do you append x axis values to the QBoxSet / QBoxPlotSeries though? I don't see it in the example (http://doc.qt.io/qt-5/qtcharts-boxplotchart-example.html). I should retitle the question as adding and formatting.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vorlket
          wrote on last edited by
          #4

          It seems I have to use QBarCategoryAxis, which doesn't have setFormat method. The underlying data is box and whiskers time series, so it's a bit unnatural to convert datetime value to category string for display. Wonder if there's a better workaround.

          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