PolarChartView QML Type
以极坐标图显示数据。更多
Import Statement: | import QtCharts 2.9 |
Inherits: |
详细描述
极坐标图以圆形图表的形式显示数据,数据的位置取决于与图表中心(极点)的角度和距离。
极坐标图是ChartView 类型的特化。它支持折线图、样条图、面积图和散点图系列,以及它们所支持的所有坐标轴类型。每个轴都可以用作径向轴或角度轴。
角度ValueAxis 上的第一个和最后一个刻度线呈 0/360 度角。
如果系列中两个连续点之间的角度距离超过 180 度,则连接这两个点的任何直线都将失去意义,不会绘制。相反,将绘制一条往返于图表中心的直线。因此,在显示直线、样条线或面积序列时,必须相应地选择坐标轴范围。
极坐标图在同一位置绘制同一方向的所有坐标轴,因此使用同一方向的多个坐标轴可能会造成混乱,除非额外的坐标轴仅用于自定义网格。例如,您可以使用辅助阴影CategoryAxis 显示突出显示的范围,或使用具有隐藏标签的辅助ValueAxis 提供无标签的子标点。
下面的 QML 代码展示了如何创建带有样条线和散点系列以及两个值轴的极坐标图:
PolarChartView { title: "Two Series, Common Axes" anchors.fill: parent legend.visible: false antialiasing: true ValueAxis { id: axisAngular min: 0 max: 20 tickCount: 9 } ValueAxis { id: axisRadial min: -0.5 max: 1.5 } SplineSeries { id: series1 axisAngular: axisAngular axisRadial: axisRadial pointsVisible: true } ScatterSeries { id: series2 axisAngular: axisAngular axisRadial: axisRadial markerSize: 10 } // Add data dynamically to the series Component.onCompleted: { for (var i = 0; i <= 20; i++) { series1.append(i, Math.random()); series2.append(i, Math.random()); } } }
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.