Warning, /plasma/plasma-systemmonitor/src/table/LineChartCellDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 import QtQuick 2.12
0008 import QtQuick.Controls 2.12
0009 import QtQuick.Layouts 1.12
0010 import QtQml.Models 2.12
0011 
0012 import org.kde.kirigami 2.2 as Kirigami
0013 import org.kde.quickcharts 1.0 as Charts
0014 
0015 BaseCellDelegate {
0016     id: delegate
0017 
0018     property string text: model.display != undefined ? model.display : ""
0019     property real maximum: 100
0020     property alias valueSources: chart.valueSources
0021 
0022     property int _row: model.row
0023     property int _column: model.column
0024 
0025     contentItem: Item {
0026         anchors.fill: parent
0027         Charts.LineChart {
0028             id: chart
0029             anchors.fill: parent
0030 
0031             xRange {
0032                 from: 0
0033                 to: 10
0034                 automatic: false
0035             }
0036 
0037             yRange {
0038                 from: 0
0039                 to: delegate.maximum
0040                 automatic: delegate.maximum <= 0
0041             }
0042 
0043             direction: Charts.XYChart.ZeroAtEnd
0044 
0045             opacity: 0.5
0046             fillOpacity: 1
0047             lineWidth: 0
0048 
0049             colorSource: Charts.SingleValueSource { value: delegate.background.selected ? Kirigami.Theme.highlightedTextColor :  Kirigami.Theme.highlightColor }
0050         }
0051 
0052         Label {
0053             id: label
0054 
0055             anchors.centerIn: parent
0056 
0057             padding: Kirigami.Units.smallSpacing
0058 
0059             text: delegate.text
0060             horizontalAlignment: Text.AlignLeft
0061             elide: Text.ElideRight
0062         }
0063     }
0064 
0065     ToolTip.text: delegate.text
0066     ToolTip.delay: Kirigami.Units.toolTipDelay
0067     ToolTip.visible: delegate.hovered && label.truncated
0068 }
0069