Is there a widget to draw a function ?
-
Hello,
i don't know of an existing component for your purposes, but you might check out this "thread":http://qt-project.org/forums/viewthread/8998 .
-
For a simple plot of a function a Canvas may suffice:
@Canvas {
width: 300
height: 200
onPaint: {
var numSamples = 300
var amplitude = 100var ctx = getContext("2d") ctx.beginPath() for (var i = 0; i < numSamples; ++i) ctx.lineTo(i, amplitude + Math.sin(2 * Math.PI * i / numSamples) * amplitude) ctx.stroke() } }
@
If you need complex scientific plots, have a look at Qwt. Using Qwt in a QQuickPaintedItem looks fairly straight forward. I googled and found an example "here":http://vadim-d.blogspot.no/2013/07/qml-qwt-android.html (the blog post is in russian, but the code is in english).