diff --git a/src/EasyApp/Gui/Charts/Plotly1dBarPlot.qml b/src/EasyApp/Gui/Charts/Plotly1dBarPlot.qml new file mode 100644 index 0000000..73f4b7f --- /dev/null +++ b/src/EasyApp/Gui/Charts/Plotly1dBarPlot.qml @@ -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)})`) + } + +} diff --git a/src/EasyApp/Gui/Charts/Plotly1dLine.qml b/src/EasyApp/Gui/Charts/Plotly1dLine.qml index a3371d8..e437cc0 100644 --- a/src/EasyApp/Gui/Charts/Plotly1dLine.qml +++ b/src/EasyApp/Gui/Charts/Plotly1dLine.qml @@ -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 @@ -48,7 +44,7 @@ WebEngineView { } } - onXyDataChanged: { + onPlotDataChanged: { if (loadSucceededStatus) { setXyData() redrawPlot() @@ -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)})`) } - } diff --git a/src/EasyApp/Gui/Charts/Plotly2dHeatmap.qml b/src/EasyApp/Gui/Charts/Plotly2dHeatmap.qml index 80545db..7bb754d 100644 --- a/src/EasyApp/Gui/Charts/Plotly2dHeatmap.qml +++ b/src/EasyApp/Gui/Charts/Plotly2dHeatmap.qml @@ -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() } } @@ -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() } } @@ -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)})`) } } diff --git a/src/EasyApp/Gui/Charts/Plotly2dPolarHeatmap.qml b/src/EasyApp/Gui/Charts/Plotly2dPolarHeatmap.qml new file mode 100644 index 0000000..fd61850 --- /dev/null +++ b/src/EasyApp/Gui/Charts/Plotly2dPolarHeatmap.qml @@ -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)})`) + } + +} diff --git a/src/EasyApp/Gui/Charts/Plotly3dSurface.qml b/src/EasyApp/Gui/Charts/Plotly3dSurface.qml index 1d0cc34..19ea946 100644 --- a/src/EasyApp/Gui/Charts/Plotly3dSurface.qml +++ b/src/EasyApp/Gui/Charts/Plotly3dSurface.qml @@ -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 @@ -17,9 +20,6 @@ WebEngineView { onLoadSucceededStatusChanged: { if (loadSucceededStatus) { - setXAxisTitle(xAxisTitle) - setYAxisTitle(yAxisTitle) - setZAxisTitle(zAxisTitle) redrawPlot() } } @@ -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() } } @@ -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)})`) } } diff --git a/src/EasyApp/Gui/Charts/qmldir b/src/EasyApp/Gui/Charts/qmldir index dacfe70..3253e6d 100644 --- a/src/EasyApp/Gui/Charts/qmldir +++ b/src/EasyApp/Gui/Charts/qmldir @@ -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 diff --git a/src/EasyApp/Gui/Components/TableViewLabelControl.qml b/src/EasyApp/Gui/Components/TableViewLabelControl.qml index 01030ad..3846e41 100644 --- a/src/EasyApp/Gui/Components/TableViewLabelControl.qml +++ b/src/EasyApp/Gui/Components/TableViewLabelControl.qml @@ -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 diff --git a/src/EasyApp/Gui/Html/Plotly1dBarPlot.html b/src/EasyApp/Gui/Html/Plotly1dBarPlot.html new file mode 100644 index 0000000..7cae1eb --- /dev/null +++ b/src/EasyApp/Gui/Html/Plotly1dBarPlot.html @@ -0,0 +1,148 @@ + + + +
+ + + + + + + + + + + +diff --git a/src/EasyApp/Gui/Html/Plotly2dPolarHeatmap.html b/src/EasyApp/Gui/Html/Plotly2dPolarHeatmap.html new file mode 100644 index 0000000..cc363dd --- /dev/null +++ b/src/EasyApp/Gui/Html/Plotly2dPolarHeatmap.html @@ -0,0 +1,158 @@ + + + +
+ + + + + + + + + +
+ +