ChartView buggy when specifying `plotArea`
-
ChartView is very buggy by nature, but when you speficy
plotArea
attribute the buggyness gets over the charts.Exemple code:
import QtQuick 2.15 import QtCharts 2.15 import QtGraphicalEffects 1.15 import QtQuick.Controls 2.15 Rectangle { width: 500 height: 300 ChartView{ id: chart_component anchors.fill: parent backgroundColor: "#000044" plotArea: Qt.rect(40, 40, chart_component.width-60, chart_component.height-60) // X Axis ValueAxis { id: valueAxisX titleVisible: false visible : true min: 0 max: 10 tickCount: 10 labelFormat: "%.2f" } // Y Axis ValueAxis { id: valueAxisY min: 0.0 max: 10.0 tickCount: 5 labelFormat: "%.2f" } LineSeries { id: defaultSeries name: "default" color: "green" axisX: valueAxisX axisY: valueAxisY XYPoint { x: 0; y: 0 } XYPoint { x: 1.1; y: 2.1 } XYPoint { x: 1.9; y: 3.3 } XYPoint { x: 2.1; y: 2.1 } XYPoint { x: 2.9; y: 4.9 } XYPoint { x: 3.4; y: 3.0 } XYPoint { x: 4.1; y: 3.3 } } Button { id: button x: 382 y: 18 text: qsTr("ZOOM") onClicked: { chart_component.zoomIn() } } } } /*##^## Designer { D{i:0;formeditorZoom:2}D{i:2}D{i:3}D{i:4}D{i:12}D{i:1} } ##^##*/
As you can see, the
backgroundColor: "#000044"
is not being rendered, instead it shows the background from theRectangle
, which is white:As a side effect, on every re-render, the last frame is not earased. In this case, if I zoom into the Graph by clicking on the button, everything gets blended:
Any ideas how to solve this?