Multiline labels or word wrap for BarCategoryAxis labels
Solved
QML and Qt Quick
-
I need to display a bar chart with QML. Everything works fine, but my categories labels are elided and not readable as in the image below
Is there a way to force showing full, not elided text for them? Or maybe enable word wrapping, or making labels multi-line. I have tried to put '\n' character inside label text but this does not work.
My code below
import QtQuick 2.0 import QtCharts 2.0 ChartView { width: 380 height:200 margins {top: 0; bottom: 0; left: 0; right: 0} backgroundColor: "#eeeeec" legend.alignment: Qt.AlignRight antialiasing: true ValueAxis{ id: valueAxisY min: 0 max: 100 } BarSeries { id: mySeries axisY: valueAxisY axisX: BarCategoryAxis {categories: ["Productivity", "Land cover", "Soil organic carbon"] } BarSet { label: "Degraded"; values: [15, 30, 22] } BarSet { label: "Improved"; values: [4, 21, 50] } BarSet { label: "Stable"; values: [31, 5, 67] } } }