Extending script plot() function
This commit is contained in:
+4
-24
@@ -14,6 +14,7 @@
|
||||
#include <QChartView>
|
||||
#include <QLineSeries>
|
||||
#include "scriptengine.h"
|
||||
#include "chartgraph.h"
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <QCloseEvent>
|
||||
@@ -271,31 +272,10 @@ QJSValue BatchProcessing::getItem(const QStringList &items, const QString &label
|
||||
return ok ? ret : QJSValue();
|
||||
}
|
||||
|
||||
void BatchProcessing::plot(const QVector<QPointF> &points)
|
||||
void BatchProcessing::plot(const QVariant &graph)
|
||||
{
|
||||
QDialog *diag = new QDialog(this);
|
||||
diag->setAttribute(Qt::WA_DeleteOnClose);
|
||||
diag->setModal(false);
|
||||
diag->setWindowTitle(tr("Chart"));
|
||||
|
||||
QChartView *chartView = new QChartView(diag);
|
||||
diag->setLayout(new QVBoxLayout);
|
||||
diag->layout()->addWidget(chartView);
|
||||
|
||||
QChart *chart = new QChart;
|
||||
chart->setParent(chartView);
|
||||
|
||||
auto series = new QLineSeries(chartView);
|
||||
series->append(points);
|
||||
chart->addSeries(series);
|
||||
chart->createDefaultAxes();
|
||||
chart->setTitle("Simple line graph");
|
||||
chart->legend()->hide();
|
||||
|
||||
chartView->setChart(chart);
|
||||
chartView->setRenderHint(QPainter::Antialiasing);
|
||||
diag->resize(640, 480);
|
||||
diag->show();
|
||||
ChartGraph *chart = new ChartGraph(this);
|
||||
chart->plot(graph);
|
||||
}
|
||||
|
||||
void openDir(const QString &path)
|
||||
|
||||
Reference in New Issue
Block a user