[Interest] How to populate ChartView CandlestickSeries from JS?

Federico Ferri federico.ferri.it at gmail.com
Sat Jan 30 01:27:59 CET 2021


I need to populate a CandlestickSeries inside a ChartView:

        ChartView {
            id: chartView
            width: 600
            height: 400
            CandlestickSeries {
                id: series
                name: "test"
            }
        }

tried the following code, but nothing is added to the chart:

        for(var i = 0; i < data.length; i++) {
            var x = data[i]
            var css = Qt.createQmlObject('import QtCharts 2.15;
CandlestickSet {}', dataProvider, "dynamicSnippet1")
            css.timestamp = x.timestamp * 1000
            css.open = x.open
            css.high = x.high
            css.low = x.low
            css.close = x.close
            series.append(css)
            console.log(x.timestamp, x.open, x.high, x.low, x.close)
        }

it seems the append() method of CandlestickSeries doesn't take raw values
just like XYSeries
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210130/80c57a16/attachment.html>


More information about the Interest mailing list