【发布时间】:2021-05-22 14:02:18
【问题描述】:
我想用来自自定义类的数据填充CandlestickSeries。
我以为我会像往常一样使用Repeater,但它似乎不起作用:
ChartView {
title: "Candlestick Series"
width: 400
height: 300
CandlestickSeries {
name: "Acme Ltd."
increasingColor: "green"
decreasingColor: "red"
/*
CandlestickSet { timestamp: 1435708800000; open: 690; high: 694; low: 599; close: 660 }
CandlestickSet { timestamp: 1435795200000; open: 669; high: 669; low: 669; close: 669 }
CandlestickSet { timestamp: 1436140800000; open: 485; high: 623; low: 485; close: 600 }
CandlestickSet { timestamp: 1436227200000; open: 589; high: 615; low: 377; close: 569 }
CandlestickSet { timestamp: 1436313600000; open: 464; high: 464; low: 254; close: 254 }
*/
Repeater {
model: 100
delegate: CandlestickSet {
timestamp: 1000 * 60 * index + 1436313600000
open: 400; high: 500; low: 300; close: 380
}
}
}
}
注释掉的部分(直接取自documentation)工作正常。
基于Repeater 的代码不产生数据点。
如何动态填充 CandlestickSeries?
注意:我也试过an alternative approach using JS,但也失败了。
【问题讨论】: