make a curve
-
I would like to make a curve giving each time the values of x and y, I did a search on the internet but I did not find anything important you find attached my code
for (int i=0; i< scan.npoints; i++)
{
x=scan.points[i].rangecos(scan.points[i].angle);
y=scan.points[i].rangesin(scan.points[i].angle);
} -
I would like to make a curve giving each time the values of x and y, I did a search on the internet but I did not find anything important you find attached my code
for (int i=0; i< scan.npoints; i++)
{
x=scan.points[i].rangecos(scan.points[i].angle);
y=scan.points[i].rangesin(scan.points[i].angle);
} -
@julie546
I presume you are supposed to use QSplineSeries Class on aQChart
? -
@JonB thank you for your answer I did a search on this library but when I had it added
#include <QSplineSeries>
there is an error: QSplineSeries file not found@julie546 Well, you need https://doc.qt.io/qt-5/qtcharts-index.html and do what is shown in that link
-
@julie546 Well, you need https://doc.qt.io/qt-5/qtcharts-index.html and do what is shown in that link
-
@julie546 after the installation you have to add it to the project files as additional module
QT += charts
@J-Hilk @jsulm
I installed this library using "sudo apt install libqt5charts5-dev"
and i added QT += charts on(.pro)
on the .cpp
i added #include<QSplineSeries> the QT was able to identify it
but when i added QSplineSeries *series = new QSplineSeries();
i have this error : unknown type name QSplineSeries
i'm following this exemple https://doc.qt.io/qt-5/qtcharts-splinechart-example.html -
@J-Hilk @jsulm
I installed this library using "sudo apt install libqt5charts5-dev"
and i added QT += charts on(.pro)
on the .cpp
i added #include<QSplineSeries> the QT was able to identify it
but when i added QSplineSeries *series = new QSplineSeries();
i have this error : unknown type name QSplineSeries
i'm following this exemple https://doc.qt.io/qt-5/qtcharts-splinechart-example.html@julie546 said in make a curve:
I installed this library using "sudo apt install libqt5charts5-dev"
And you're also using Qt installed via apt?
Please show the code where you get the error.
And don't forget: after changing pro file always do a clean rebuild. -
@julie546 said in make a curve:
I installed this library using "sudo apt install libqt5charts5-dev"
And you're also using Qt installed via apt?
Please show the code where you get the error.
And don't forget: after changing pro file always do a clean rebuild.@jsulm I found this forum he recommended to use "sudo apt install libqt5charts5-dev"
https://forum.qt.io/topic/120196/qtcharts-installation-on-ubuntu/3
for the code i only did
#include<QSplineSeries>
{
ui->setupUi(this);QSplineSeries *series = new QSplineSeries(); series->setName("spline");
like this exemple https://doc.qt.io/qt-5/qtcharts-splinechart-example.html
i only wanna make a graph for the x and the y
for (int i=0; i< scan.npoints; i++)
{
x=scan.points[i].rangecos(scan.points[i].angle);
y=scan.points[i].rangesin(scan.points[i].angle);
}
-
@jsulm I found this forum he recommended to use "sudo apt install libqt5charts5-dev"
https://forum.qt.io/topic/120196/qtcharts-installation-on-ubuntu/3
for the code i only did
#include<QSplineSeries>
{
ui->setupUi(this);QSplineSeries *series = new QSplineSeries(); series->setName("spline");
like this exemple https://doc.qt.io/qt-5/qtcharts-splinechart-example.html
i only wanna make a graph for the x and the y
for (int i=0; i< scan.npoints; i++)
{
x=scan.points[i].rangecos(scan.points[i].angle);
y=scan.points[i].rangesin(scan.points[i].angle);
}
-
@julie546 You need to install QtCharts for Qt you are using. So, how did you install Qt? Did you install it using apt? Did you install it using Qt installer?
@jsulm for the installation i did that :
$ sudo rpi-update
$ sudo reboot
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install qt5-default
$ sudo apt-get install qtcreator
$ sudo apt-get install build-essential
$ sudo apt-get install libfontconfig1-dev libdbus-1-dev libfreetype6-dev libicu-dev libudev-dev libinput-dev libxkbcommon-dev libssl-dev libpng-dev libjpeg-dev libglib2.0-dev libraspberrypi-dev
sudo apt-get install -y build-essential libfontconfig1-dev libdbus-1-dev libfreetype6-dev libicu-dev libudev-dev libinput-dev libxkbcommon-dev libssl-dev libpng-dev libjpeg-dev libglib2.0-dev libraspberrypi-dev
sudo apt-get install -y bluez libbluetooth-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-dev gstreamer1.0-pulseaudio gstreamer1.0-tools gstreamer1.0-alsa
sudo apt-get install -y libasound2-dev pulseaudio libpulse-dev
sudo apt-get install -y libsqlite3-dev libpq-dev libmariadbclient-dev libmariadbclient-dev-compat
sudo apt-get install -y libcups2-dev
sudo apt-get install -y libx11-dev libxcb1-dev libxkbcommon-x11-dev libx11-xcb-dev libxext-dev
sudo apt-get install -y libatspi-dev
sudo apt-get install -y libwayland-devso yes i used the apt
-
@jsulm for the installation i did that :
$ sudo rpi-update
$ sudo reboot
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install qt5-default
$ sudo apt-get install qtcreator
$ sudo apt-get install build-essential
$ sudo apt-get install libfontconfig1-dev libdbus-1-dev libfreetype6-dev libicu-dev libudev-dev libinput-dev libxkbcommon-dev libssl-dev libpng-dev libjpeg-dev libglib2.0-dev libraspberrypi-dev
sudo apt-get install -y build-essential libfontconfig1-dev libdbus-1-dev libfreetype6-dev libicu-dev libudev-dev libinput-dev libxkbcommon-dev libssl-dev libpng-dev libjpeg-dev libglib2.0-dev libraspberrypi-dev
sudo apt-get install -y bluez libbluetooth-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-dev gstreamer1.0-pulseaudio gstreamer1.0-tools gstreamer1.0-alsa
sudo apt-get install -y libasound2-dev pulseaudio libpulse-dev
sudo apt-get install -y libsqlite3-dev libpq-dev libmariadbclient-dev libmariadbclient-dev-compat
sudo apt-get install -y libcups2-dev
sudo apt-get install -y libx11-dev libxcb1-dev libxkbcommon-x11-dev libx11-xcb-dev libxext-dev
sudo apt-get install -y libatspi-dev
sudo apt-get install -y libwayland-devso yes i used the apt
-
@julie546 So, you are developing for RPi? Why not mention that from the beginning?
Do you cross compile? Or do you build directly on RPi?
And you called "sudo apt install libqt5charts5-dev" also on RPi? -
@julie546 So, you are developing for RPi? Why not mention that from the beginning?
Do you cross compile? Or do you build directly on RPi?
And you called "sudo apt install libqt5charts5-dev" also on RPi? -
@julie546 Did you do a clean rebuild of your app (delete build folder, run qmake and build)?
@jsulm I solved this problem using #include <QtCharts>
using namespace QtCharts;
and I did this code but I couldn't make the graph
{
ui->setupUi(this);QSplineSeries *series = new QSplineSeries(); series->setName("spline");
.
.
.
.
.
}
void Lidar1(QSplineSeries *series)
{
.
.
.
.
for (int i=0; i< scan.npoints; i++)
{
x=scan.points[i].rangecos(scan.points[i].angle);
y=scan.points[i].rangesin(scan.points[i].angle);
series->append(x, y);}
} -
@jsulm I solved this problem using #include <QtCharts>
using namespace QtCharts;
and I did this code but I couldn't make the graph
{
ui->setupUi(this);QSplineSeries *series = new QSplineSeries(); series->setName("spline");
.
.
.
.
.
}
void Lidar1(QSplineSeries *series)
{
.
.
.
.
for (int i=0; i< scan.npoints; i++)
{
x=scan.points[i].rangecos(scan.points[i].angle);
y=scan.points[i].rangesin(scan.points[i].angle);
series->append(x, y);}
}Hi
after you put points in the Series
you need to call
chart->addSeries(series);chart being an instance of QChart
like they do here
https://doc.qt.io/qt-5/qtcharts-linechart-example.html