fix(OverviewSettingsChart): fix displaying month names
- gotta use `standaloneMonthName` if the date doesn't contain anything else (like day or year)
This commit is contained in:
parent
7ad4a917af
commit
559f94a706
|
@ -8,7 +8,6 @@ import StatusQ.Components 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
import StatusQ.Components 0.1
|
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
|
@ -49,7 +48,7 @@ StatusChartPanel {
|
||||||
readonly property var hoveredModelMetadata: modelMetadata[root.timeRangeTabBarIndex].modelItems[hoveredBarIndex]
|
readonly property var hoveredModelMetadata: modelMetadata[root.timeRangeTabBarIndex].modelItems[hoveredBarIndex]
|
||||||
readonly property var tooltipConfig: modelMetadata[root.timeRangeTabBarIndex].tooltipConfig
|
readonly property var tooltipConfig: modelMetadata[root.timeRangeTabBarIndex].tooltipConfig
|
||||||
readonly property var graphTabsModel: [{text: messagesLabel, enabled: true}]
|
readonly property var graphTabsModel: [{text: messagesLabel, enabled: true}]
|
||||||
property var now: Date.now()
|
property double now: Date.now()
|
||||||
property var lastRequestModelMetadata: null
|
property var lastRequestModelMetadata: null
|
||||||
|
|
||||||
readonly property var chartData: selectedTabInfo.modelItems.map(x => d.itemsCountInRange(root.model, x.start, x.end))
|
readonly property var chartData: selectedTabInfo.modelItems.map(x => d.itemsCountInRange(root.model, x.start, x.end))
|
||||||
|
@ -210,9 +209,8 @@ StatusChartPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
function monthStr(before = 0, timeReference = now, roundCurrentTime = true, shortFormat = true) {
|
function monthStr(before = 0, timeReference = now, roundCurrentTime = true, shortFormat = true) {
|
||||||
const format = shortFormat ? "MMM" : "MMMM"
|
|
||||||
const timeStamp = LocaleUtils.months(before, timeReference, roundCurrentTime)
|
const timeStamp = LocaleUtils.months(before, timeReference, roundCurrentTime)
|
||||||
return LocaleUtils.formatDate(timeStamp, format)
|
return Qt.locale().standaloneMonthName(new Date(timeStamp).getMonth(), shortFormat ? Locale.ShortFormat : Locale.LongFormat)
|
||||||
}
|
}
|
||||||
|
|
||||||
function yearsStr(before = 0, timeReference = now, roundCurrentTime = true) {
|
function yearsStr(before = 0, timeReference = now, roundCurrentTime = true) {
|
||||||
|
@ -254,7 +252,7 @@ StatusChartPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAdjustedTooltipPosition(event) {
|
function getAdjustedTooltipPosition(event) {
|
||||||
// By defaullt the popup is displayed on the right of the cursor
|
// By default the popup is displayed on the right of the cursor
|
||||||
// If there is not enough space on the right, display it on the left
|
// If there is not enough space on the right, display it on the left
|
||||||
const relativeMousePoint = event.target.mapToItem(toolTip.parent, event.x, event.y) // relative to tooltip parent
|
const relativeMousePoint = event.target.mapToItem(toolTip.parent, event.x, event.y) // relative to tooltip parent
|
||||||
const leftPositon = (toolTip.parent.width - (toolTip.width + toolTip.rightPadding + relativeMousePoint.x + 15)) < 0
|
const leftPositon = (toolTip.parent.width - (toolTip.width + toolTip.rightPadding + relativeMousePoint.x + 15)) < 0
|
||||||
|
@ -375,7 +373,6 @@ StatusChartPanel {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
elide: Qt.ElideRight
|
elide: Qt.ElideRight
|
||||||
font.pixelSize: Style.current.primaryTextFontSize
|
|
||||||
color: Theme.palette.baseColor1
|
color: Theme.palette.baseColor1
|
||||||
text: d.tooltipConfig.timeRangeString
|
text: d.tooltipConfig.timeRangeString
|
||||||
}
|
}
|
||||||
|
@ -385,8 +382,6 @@ StatusChartPanel {
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
elide: Qt.ElideRight
|
elide: Qt.ElideRight
|
||||||
font.pixelSize: Style.current.primaryTextFontSize
|
|
||||||
color: Theme.palette.directColor1
|
|
||||||
text: d.hoveredModelMetadata ? d.tooltipConfig.timeRangeFormatter(d.hoveredModelMetadata.start, d.hoveredModelMetadata.end)
|
text: d.hoveredModelMetadata ? d.tooltipConfig.timeRangeFormatter(d.hoveredModelMetadata.start, d.hoveredModelMetadata.end)
|
||||||
: ""
|
: ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue