Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to set Value Axis Label Format on QML from milliseconds to mm:ss?
Qt 6.11 is out! See what's new in the release blog

How to set Value Axis Label Format on QML from milliseconds to mm:ss?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 879 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.
  • E Offline
    E Offline
    emmericatto
    wrote on last edited by emmericatto
    #1

    Background

    I am using QtCreator and I have a file called myScopeView.qml, which represents a scope view similar to the example provided here.

    In myScopeView.qml, there is a ChartView that is updated every second with a timer so the plot changes values on X axis and Y axis.

    X axis represents time expressed in milliseconds (integer values), because of the data acquisition, and Y axis represents voltage values (characterized as integer values).

    Problem

    The plot shows X axis values as integer, i.e. 123456789, but I would like to visualize the corresponding mm:ss value, i.e. 20:34. I think I have to modify the value of labelFormat.

    ValueAxis{
        id: axisX
        min: 0
        max: 0
        tickCount: 5
        labelFormat: // I don't know what I have to set here
        }
    

    Question

    Is it possible to set a specific value in labelFormat in order to have mm:ss visualized?

    Notes

    Instead of the modification of labelFormat I tried to use a Javascript function for the conversion but this solution does not work because the conversion is achieved before the visualization and so the plot shows nothing because there is no Y values associated to new X values. That's why I am asking for a labelFormat command, but I will appreciate also a Javascript hint.

    I know that QML QtCharts has QDateTimeAxis which provides mm:ss format but I would like to convert data only for the visualization and not for other purposes.

    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