如何在QtChart中添加独立的垂直线?
QtChart双Y轴图表添加独立垂直线的问题
我有一个包含两个Y轴的QtChart图表,需要在特定位置添加垂直线。这些垂直线需从y=0处起始,延伸至图表区域的最大值(超出图表区域也无妨)。但当我使用QLineSeries绘制这些点时,所有点会被连接起来,无法得到独立的垂直线效果。我尝试通过添加QPointF(NAN, NAN)来设置点之间的间隔,但没有效果。
尝试过的代码:
PhaseSeries->append(curRec.Second, 0); PhaseSeries->append(curRec.Second, 500);//maxValue for the phase to reach the upper side of the graph PhaseSeries->append(QPointF(NAN, NAN));
临时解决方案
我找到了一个在当前场景中可行的方法,但写法不够优雅:
PhaseSeries->append(curRec.Second, -500); PhaseSeries->append(curRec.Second, 500);//maxValue for the phase to reach the upper side of the graph PhaseSeries->append(curRec.Second, -500);
内容的提问来源于stack exchange,提问作者Salvatore Villani
相关产品推荐
相关产品推荐

