filcuc / nimqml

Qt Qml bindings for the Nim programming language
Other
164 stars 20 forks source link

Need help/advice with QtCharts #14

Closed R3D9477 closed 6 years ago

R3D9477 commented 6 years ago

Hi. I have a simple project in QML with one Char and LineSeries: main.qml

import QtQuick 2.2
import QtQuick.Window 2.1
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.2

import QtCharts 2.2

ApplicationWindow {
    width: 400
    height: 300
    title: "Hello World"
    Component.onCompleted: visible = true

    ChartView {
        title: "Oscil"
        id: chartView
        antialiasing: true
        anchors.fill: parent
        LineSeries {
            name: "LineSeries"
            useOpenGL: true
        }
    }

    Timer {
        id: refreshTimer
        interval: 1 / 60 * 1000 // 60 Hz
        running: true
        repeat: true
        onTriggered: {
            //chartView.series(0).
            //dataSource.update(chartView.series(0));
        }
    }
}

So, can I feel this "LineSeries" directly from Nim? I must do something like in this example of C++ code:

...
const auto arrLen = std::extent<declype(arrX)>::value;
Q_ASSERT(std::extent<declype(arrY)>::value == arrLen);
/* QXYSeries*  LineSeries; <- in header and created on the heap*/
for(decltype(awrrLen) i=0;i<arrLen;++i)
LineSeries->append(arrX[i],arrY[i]);
...

In fact, I need to call method LineSeries->append(arrX[i],arrY[i]); directly from Nim. Is it possible?

Thanks.

filcuc commented 6 years ago

@r3d9u11 I futher improved the example by showing you how to add dynamic points 570027c23121a1c965a7e8c7a665b7b6a7347e47

R3D9477 commented 6 years ago

@filcuc many thanks, it's very useful!

filcuc commented 6 years ago

@r3d9u11 Fixed the issue with table models

R3D9477 commented 6 years ago

@filcuc thanks! does library with latest changes available in nimble?

filcuc commented 6 years ago

Yes published latest version

Il 03 Mar 2018 5:32 PM, "r3d9u11" notifications@github.com ha scritto:

@filcuc https://github.com/filcuc thanks! does library with latest changes available in nimble?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/filcuc/nimqml/issues/14#issuecomment-370160776, or mute the thread https://github.com/notifications/unsubscribe-auth/AG07ow06ATmUzO9eF965Z6bMrJkIJzC5ks5tasW2gaJpZM4SZywV .