[Interest] How to populate ChartView CandlestickSeries from JS?

Federico Ferri federico.ferri.it at gmail.com
Fri Feb 19 16:30:55 CET 2021


Has anybody a solution to this?

Tried two different approaches:

https://stackoverflow.com/questions/66279947/qml-qtcharts-candlestickseries-repeater
https://stackoverflow.com/questions/66280361/qml-qtcharts-candlestickseries-append-returns-false

Both failed.




On Sat, Jan 30, 2021 at 1:27 AM Federico Ferri <federico.ferri.it at gmail.com>
wrote:

> 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/20210219/f761191b/attachment.html>


More information about the Interest mailing list