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

Add NaN/0.f value support, independant QBars3DSeries and hasSeries() support.

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.7.0, 5.8.0 RC
    • Fix Version/s: None
    • Component/s: Data Visualization
    • Labels:
      None

      Description

      Add support for NaN and 0 values in QBars3D:

      While 0.f it is a valid QBars3DSerie value, 0.f is not rendered with a 3D bar (generating confusion with “no value” or “NaN”). In bars3drenderer_p.h, there is an internal property ‘bool m_noZeroInRange’, would it be possible to expose it to the user to allow drawing 0.f values?

      Eventually, the following interface would be very useful:

      const auto series1 = new QBar3DSeries{};
      const auto data1 = new QBarDataRow{};
      *data1 << std::numeric_limits<double>::signaling_NaN() << 4.f << 8.f << 16.f << 32.f;
      

      Or something equivalent with Qt NaN API.

      Add support for ‘independent’ QBars3DSerie:

      Actually the only way to allow the user to select a specific color for a row is to generate a QBars3DSerie with empty rows but one at the index where user data should be displayed, and then to call QBars3DSeries::setBaseColor().

      It works perfectly (even if it’s a lot of user code just to change a color), but even when rows are totally independent (ie, there is never multiple bars per cell), Bars3D reserves some space left for hidden rows resulting in an “alignment offset” that is hard to interpret for final users.

      The use case is probably very common, for example if you are working with value over time data, where datetime are columns and data series are rows (which is the case of most demonstration samples).

      Would it be possible to add an ‘independent’ property to QBars3DSeries, so that the renderer could avoid drawing that kind of artifacts ?

      Example: Values for three series with independent rows not aligned in row axis, space for 2 undrawn bar is left in all cells (in red):

      (artifact highlighted in red)

      Add an hasSeries() Q_INVOKABLE method to Bars3D interface:

      In Bars3D interface, there is Q_INVOKABLE methods to add / insert / remove QBar3DSeries, but nothing to actually check if a series is already registered.

      Current workaround code (without private header inclusion and wild casts) is very inefficient with a lot of virtual and Q_INVOKE calls (while internally it could be a simple and fast container.contains() call):

      bool    XXX::bars3DHasSeries(QBar3DSeries* series)
      {
          bool hasSeries{false};
          if ( series != nullptr &&
      	 getBars3D() != nullptr ) {
              QQmlProperty seriesListQmlProperty(getBars3D(), "seriesList");
              if ( seriesListQmlProperty.isValid() ) {
                  QQmlListReference seriesList = qvariant_cast<QQmlListReference>( seriesListQmlProperty.read() );
                  if (seriesList.isValid())
                      for ( int s = 0; s < seriesList.count(); s++ )
                          if ( seriesList.at(s) == series ) {
                              hasSeries = true;
                              break;
                          }
              }
          }
          return hasSeries;
      } 
      

      Sink behavior for QBar3DSeries argument of add/insert methods also is not clear in the documentation.

        Attachments

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

          Activity

            People

            Assignee:
            oulu_hillbilly Sami Varanka
            Reporter:
            cneben2 Autheman Benoit
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes