Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions src/EasyApp/Gui/Charts/Plotly1dBarPlot.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import QtQuick
import QtQuick.Controls
import QtWebEngine

import EasyApp.Gui.Style as EaStyle
import Gui.Globals as Globals

WebEngineView {
id: chartView

property bool loadSucceededStatus: false
property string xAxisTitle: ''
property string yAxisTitle: ''

property var plotData: ({})

width: parent.width
height: parent.height

url: Qt.resolvedUrl('../Html/Plotly1dBarPlot.html')

onLoadSucceededStatusChanged: {
if (loadSucceededStatus) {
redrawPlot()
}
}

onLoadingChanged: {
// Bug 'loadRequest' is not declared - https://bugreports.qt.io/browse/QTBUG-84746
//if (loadRequest.status === WebEngineView.LoadSucceededStatus) {
if (loadProgress === 100) {
loadSucceededStatus = true
}
}

onXAxisTitleChanged: {
if (loadSucceededStatus) {
setXAxisTitle()
redrawPlot()
}
}

onYAxisTitleChanged: {
if (loadSucceededStatus) {
setYAxisTitle()
redrawPlot()
}
}

onPlotDataChanged: {
if (loadSucceededStatus) {
setXyData()
redrawPlot()
}
}

// Logic

function redrawPlot() {
chartView.runJavaScript(`redrawPlot()`)
}

function setXAxisTitle() {
runJavaScript(`setXAxisTitle(${JSON.stringify(xAxisTitle)})`)
}

function setYAxisTitle() {
runJavaScript(`setYAxisTitle(${JSON.stringify(yAxisTitle)})`)
}

function setXyData() {
runJavaScript(`setXyData(${JSON.stringify(plotData)})`)
}

function redrawPlotWithAnimation() {
runJavaScript(`redrawPlotWithAnimation(${JSON.stringify(plotData)})`)
}

}
19 changes: 6 additions & 13 deletions src/EasyApp/Gui/Charts/Plotly1dLine.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,24 @@ WebEngineView {
id: chartView

property bool loadSucceededStatus: false

property string xAxisTitle: ''
property string yAxisTitle: ''

property var xyData: ({})
property var plotData: ({})

width: parent.width
height: parent.height

url: Qt.resolvedUrl("Plotly1dLine.html")
url: Qt.resolvedUrl('../Html/Plotly1dLine.html')

onLoadSucceededStatusChanged: {
if (loadSucceededStatus) {
setXAxisTitle()
setYAxisTitle()
setXyData()
redrawPlot()
}
}

onLoadingChanged: {
// Bug "loadRequest" is not declared - https://bugreports.qt.io/browse/QTBUG-84746
// Bug 'loadRequest' is not declared - https://bugreports.qt.io/browse/QTBUG-84746
//if (loadRequest.status === WebEngineView.LoadSucceededStatus) {
if (loadProgress === 100) {
loadSucceededStatus = true
Expand All @@ -48,7 +44,7 @@ WebEngineView {
}
}

onXyDataChanged: {
onPlotDataChanged: {
if (loadSucceededStatus) {
setXyData()
redrawPlot()
Expand All @@ -70,13 +66,10 @@ WebEngineView {
}

function setXyData() {
//runJavaScript(`setXyData(${JSON.stringify(xyData)})`, function(result) { console.log(JSON.stringify(result)); })
runJavaScript(`setXyData(${JSON.stringify(xyData)})`)
runJavaScript(`setXyData(${JSON.stringify(plotData)})`)
}

function redrawPlotWithAnimation() {
runJavaScript(`redrawPlotWithAnimation(${JSON.stringify(xyData)})`)

runJavaScript(`redrawPlotWithAnimation(${JSON.stringify(plotData)})`)
}

}
46 changes: 37 additions & 9 deletions src/EasyApp/Gui/Charts/Plotly2dHeatmap.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ WebEngineView {
property bool loadSucceededStatus: false
property string xAxisTitle: ''
property string yAxisTitle: ''
property string colorbarTitle: ''

property var plotData: ({})
property var shapes: ([{}])

width: parent.width
height: parent.height

url: Qt.resolvedUrl('../Html/Plotly2dHeatmap.html')
url: Qt.resolvedUrl('../Html/Plotly2dHeatmap.html')

onLoadSucceededStatusChanged: {
if (loadSucceededStatus) {
setXAxisTitle(xAxisTitle)
setYAxisTitle(yAxisTitle)
redrawPlot()
}
}
Expand All @@ -32,14 +34,28 @@ WebEngineView {

onXAxisTitleChanged: {
if (loadSucceededStatus) {
setXAxisTitle(newTitle)
setXAxisTitle()
redrawPlot()
}
}

onYAxisTitleChanged: {
if (loadSucceededStatus) {
setYAxisTitle(newTitle)
setYAxisTitle()
redrawPlot()
}
}

onPlotDataChanged: {
if (loadSucceededStatus) {
setXyzData()
redrawPlot()
}
}

onShapesChanged: {
if (loadSucceededStatus) {
setShape()
redrawPlot()
}
}
Expand All @@ -50,12 +66,24 @@ WebEngineView {
chartView.runJavaScript(`redrawPlot()`)
}

function setXAxisTitle(newTitle) {
runJavaScript(`setXAxisTitle(${JSON.stringify(newTitle)})`)
function setXAxisTitle() {
runJavaScript(`setXAxisTitle(${JSON.stringify(xAxisTitle)})`)
}

function setYAxisTitle() {
runJavaScript(`setYAxisTitle(${JSON.stringify(yAxisTitle)})`)
}

function setShape() {
runJavaScript(`setShape(${JSON.stringify(shapes)})`)
}

function setColorbarTitle() {
runJavaScript(`setColorbarTitle(${JSON.stringify(colorbarTitle)})`)
}

function setYAxisTitle(newTitle) {
runJavaScript(`setYAxisTitle(${JSON.stringify(newTitle)})`)
function setXyzData() {
runJavaScript(`setXyzData(${JSON.stringify(plotData)})`)
}

}
62 changes: 62 additions & 0 deletions src/EasyApp/Gui/Charts/Plotly2dPolarHeatmap.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import QtQuick
import QtQuick.Controls
import QtWebEngine

import Gui.Globals as Globals

WebEngineView {
id: chartView

property bool loadSucceededStatus: false
property string colorbarTitle: ''

property var plotData: ({})

width: parent.width
height: parent.height

url: Qt.resolvedUrl('../Html/Plotly2dPolarHeatmap.html')

onLoadSucceededStatusChanged: {
if (loadSucceededStatus) {
redrawPlot()
}
}

onLoadingChanged: {
// Bug "loadRequest" is not declared - https://bugreports.qt.io/browse/QTBUG-84746
//if (loadRequest.status === WebEngineView.LoadSucceededStatus) {
if (loadProgress === 100) {
loadSucceededStatus = true
}
}

onColorbarTitleChanged: {
if (loadSucceededStatus) {
setColorbarTitle()
redrawPlot()
}
}

onPlotDataChanged: {
if (loadSucceededStatus) {
setXyzData()
redrawPlot()
}
}

// Logic

function redrawPlot() {
chartView.runJavaScript(`redrawPlot()`)
}

function setColorbarTitle() {
runJavaScript(`setColorbarTitle(${JSON.stringify(colorbarTitle)})`)
}

function setXyzData() {
runJavaScript(`setXyzData(${JSON.stringify(plotData)})`)
}

}
47 changes: 29 additions & 18 deletions src/EasyApp/Gui/Charts/Plotly3dSurface.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ WebEngineView {
id: chartView

property bool loadSucceededStatus: false
property string xAxisTitle: ''
property string yAxisTitle: ''
property string zAxisTitle: ''
property string colorbarTitle: ''

property var scene: ({})

property var plotData: ({})
property var patchData: ({})

width: parent.width
height: parent.height
Expand All @@ -17,9 +20,6 @@ WebEngineView {

onLoadSucceededStatusChanged: {
if (loadSucceededStatus) {
setXAxisTitle(xAxisTitle)
setYAxisTitle(yAxisTitle)
setZAxisTitle(zAxisTitle)
redrawPlot()
}
}
Expand All @@ -32,23 +32,30 @@ WebEngineView {
}
}

onXAxisTitleChanged: {
onColorbarTitleChanged: {
if (loadSucceededStatus) {
setXAxisTitle(newTitle)
setColorbarTitle()
redrawPlot()
}
}

onYAxisTitleChanged: {
onSceneChanged: {
if (loadSucceededStatus) {
setYAxisTitle(newTitle)
setScene()
redrawPlot()
}
}

onZAxisTitleChanged: {
onPlotDataChanged: {
if (loadSucceededStatus) {
setZAxisTitle(newTitle)
setXyzData()
redrawPlot()
}
}

onPatchDataChanged: {
if (loadSucceededStatus) {
setPatchData()
redrawPlot()
}
}
Expand All @@ -59,16 +66,20 @@ WebEngineView {
chartView.runJavaScript(`redrawPlot()`)
}

function setXAxisTitle(newTitle) {
runJavaScript(`setXAxisTitle(${JSON.stringify(newTitle)})`)
function setColorbarTitle() {
runJavaScript(`setColorbarTitle(${JSON.stringify(colorbarTitle)})`)
}

function setScene() {
runJavaScript(`setScene(${JSON.stringify(scene)})`)
}

function setYAxisTitle(newTitle) {
runJavaScript(`setYAxisTitle(${JSON.stringify(newTitle)})`)
function setXyzData() {
runJavaScript(`setXyzData(${JSON.stringify(plotData)})`)
}

function setZAxisTitle(newTitle) {
runJavaScript(`setZAxisTitle(${JSON.stringify(newTitle)})`)
function setPatchData() {
runJavaScript(`setPatchData(${JSON.stringify(patchData)})`)
}

}
2 changes: 2 additions & 0 deletions src/EasyApp/Gui/Charts/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ QtCharts1dValueAxis QtCharts1dValueAxis.qml
QtCharts1dBase QtCharts1dBase.qml
QtCharts1dMeasVsCalc QtCharts1dMeasVsCalc.qml

Plotly1dBarPlot Plotly1dBarPlot.qml
Plotly1dLine Plotly1dLine.qml
Plotly1dMeasVsCalc Plotly1dMeasVsCalc.qml

Plotly2dHeatmap Plotly2dHeatmap.qml
Plotly2dPolarHeatmap Plotly2dPolarHeatmap.qml

Plotly3dScatter Plotly3dScatter.qml
Plotly3dSurface Plotly3dSurface.qml
2 changes: 1 addition & 1 deletion src/EasyApp/Gui/Components/TableViewLabelControl.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ T.Button {
// ToolTip
EaElements.ToolTip {
text: control.ToolTip.text
visible: label.truncated && control.hovered && EaGlobals.Variables.showToolTips && text !== ""
visible: label.truncated && control.hovered && EaGlobals.Vars.showToolTips && text !== ""
}

// Text label
Expand Down
Loading
Loading