【Qt Quick】————ChartView
程序员文章站
2024-01-05 16:57:22
...
使用报错
范例
Item{
id:view_Item
anchors.top: quit_Item.bottom
width: parent.width
height: parent.height - 30
ChartView{
id:tgp_Chart
x: 130
y: 40
anchors.fill: parent
//主题:图标主题黑暗
theme:ChartView.ChartThemeDark
//抗锯齿
antialiasing: true
//动画选项:网格轴动画
animationOptions:ChartView.GridAxisAnimations
ValueAxis{
id:axisx
max:100;
min:0;
}
ValueAxis{
id:axisy
max:100;
min:0;
}
SplineSeries{
id:flight_Altitude_SS
color: "red"
name:"飞行高度"
axisX: axisx
axisY: axisy
XYPoint{x:0;y:0}
XYPoint{x:10;y:20}
XYPoint{x:15;y:30}
XYPoint{x:20;y:10}
XYPoint{x:25;y:25}
XYPoint{x:30;y:15}
XYPoint{x:35;y:10}
}
SplineSeries{
id:angle_SS
color: "blue"
name:"偏航角"
axisX: axisx
axisY: axisy
XYPoint{x:0;y:0}
XYPoint{x:10;y:20}
XYPoint{x:25;y:30}
XYPoint{x:30;y:60}
XYPoint{x:45;y:75}
XYPoint{x:50;y:85}
XYPoint{x:65;y:10}
}
}
Button{
anchors.left: parent.left
anchors.bottom: parent.bottom
width: 100
height: 30
text: "添加曲线"
onClicked: {
//动态新增曲线
//var newLine = tgp_Chart.createSeries(ChartView.SplineSeries,"新增折线");
angle_SS.append(i,i);//向线条加点
}
}
}