Qt QChart 设置部分图例隐藏
作者:互联网
QChart 设置部分图例隐藏场景介绍
- 在我们绘制QChart图形中,如果需要绘制折线柱状等多种格式序列时,我们只想柱状图显示图例怎,折线图例隐藏怎么实现呢?
QChart 设置部分图例隐藏解决办法
- 关键词:
- 所有序列标记:QList<QLegendMarker *> QLegend::markers(QAbstractSeries *series = Q_NULLPTR) const
- 枚举值: enum QLegendMarker::LegendMarkerType
- The type of the legend marker object.This enum was introduced or modified in Qt 5.8.
Constant | Value | Description |
QLegendMarker::LegendMarkerTypeArea | 0 | A legend marker for an area series. |
QLegendMarker::LegendMarkerTypeBar | 1 | A legend marker for a bar set. |
QLegendMarker::LegendMarkerTypePie | 2 | A legend marker for a pie slice. |
QLegendMarker::LegendMarkerTypeXY | 3 | A legend marker for a line, spline, or scatter series. |
QLegendMarker::LegendMarkerTypeBoxPlot | 4 | A legend marker for a box plot series. |
QLegendMarker::LegendMarkerTypeCandlestick | 5 | A legend marker for a candlestick series. |
1 foreach (QLegendMarker* marker, chart->legend()->markers()) 2 { 3 if(marker->type() == QLegendMarker::LegendMarkerTypeXY) 4 { 5 marker->setVisible(false); 6 } 7 }
标签:Qt,QChart,图例,QLegendMarker,series,marker,legend 来源: https://www.cnblogs.com/ybqjymy/p/14311567.html