Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
Description
Currently,
- ValueAxis.tickInterval means "difference in value between 2 adjacent ticks" (OK)
- DateTimeAxis.tickInterval means "Number of divisions shown in GraphsView.plotArea between DateTimeAxis.min and DateTimeAxis.max" (Not OK)
This meaning of DateTimeAxis.tickInterval is unintuitive and doesn't match our documentation (see https://doc.qt.io/qt-6/qml-qtgraphs-datetimeaxis.html#tickInterval-prop)
Test Code
import QtQuick import QtQuick.Layouts import QtQuick.Controls.Basic import QtGraphs ApplicationWindow { width: 800 height: 600 visible: true header: GridLayout { columns: 2 Label { text: `Tick Interval (${tickSlider.value})`} Slider { id: tickSlider from: 1 value: 5 to: 10 stepSize: 1 Layout.fillWidth: true } Label { text: `X Range (${xSlider.value})` } Slider { id: xSlider from: 1 value: 5 to: 10 stepSize: 1 Layout.fillWidth: true } } GraphsView { id: valueGraph anchors.fill: parent anchors.bottomMargin: parent.height/2 property real startX: 0 property real finalX: xSlider.value axisY: ValueAxis { min: 0; max: 10 } axisX: ValueAxis { min: valueGraph.startX max: valueGraph.finalX tickInterval: tickSlider.value } } GraphsView { id: dateGraph anchors.fill: parent anchors.topMargin: parent.height/2 property date startX: new Date("2000-01-01T00:00:00Z") property date finalX: { let d = startX d.setDate(d.getDate() + xSlider.value) console.log(d) return d } axisY: ValueAxis { min: 0; max: 10 } axisX: DateTimeAxis { labelsAngle: 45 labelFormat: "yyyy-MM-dd" min: dateGraph.startX max: dateGraph.finalX tickInterval: tickSlider.value } } }
Suggestions
- The current functionality provided by DateTimeAxis.tickInterval should be transferred to a new property (DateTimeAxis.divisionsInPlotArea?)
- ValueAxis could get the same property too, along with a way to select between the new property or tickInterval
- DateTimeAxis.tickInterval in its current form should be deprecated
- DateTimeAxis should get a new property that behaves like ValueAxis.tickInterval. Its datatype should be something like std::chrono::duration or Temporal.Duration (requires QTBUG-134787)