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

QBarCategoryAxis::setCategories only works once.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.10.0 FF
    • 6.8.2
    • Graphs: 2D
    • None
    • Linux/Wayland
    • ca638618c (dev)

    Description

      If you create a simple bar graph and set the X axis with a QBarCategoryAxis instance, you can only exactly once set categories and get them to be updated on screen.

      All later updates are ignored, thereby defying the entire point of using QMLs core idea of property bindings.
      It aint a property if you can't change it...

      Example code:

      import QtQuick
      import QtQuick.Controls
      import QtGraphs
      
      Item {
          id: mainView
          width: 1280
          height: 720
      
          GraphsView {
              anchors.fill: parent
              axisX: BarCategoryAxis {
                  id: categories
                  categories: [ "1", "2", "3" ]
                  gridVisible: false
                  subGridVisible: false
              }        
              axisY: ValueAxis {
                  min: 20
                  max: 100
                  tickInterval: 10
                  subTickCount: 9
              }        
              BarSeries {
                  BarSet {
                      values: [ "70" ]
                  }
              }
          }    
          Button {
              text: "change"
              onClicked: {
                  if (categories.categories[0] === "1")
                      categories.categories = [ "foo", "bar"]
                  else
                      categories.categories = [ "1", "2", "3" ]
              }
          }
      }

      I expect the updating of the property to have the effect of updating the values displayed.

      Notice that I tried updating the GraphsView.axisX itself with a new instantiated QBarCategoryAxis instance, populated with new data. This also had no effect. So very likely the issue isn't directly in QBarCategoryAxis, it sounds likely to be in the GraphView framework.

      I would rate this very high priority as static graphs are really not all too useful, being able to respond to data is definitely a requirement of basic functionality before you can release it.
      The usecase here is to switch between historical graphs over different timespans. A week, a month etc. For that I need to have different values on the x axis.

      Attachments

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

        Activity

          People

            oulu_hillbilly Sami Varanka
            tomz Tom Zander
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes