|
|
/*------------------------------------------------------------------------------
|
|
|
-- This file is a part of the ColorMapChart API
|
|
|
-- Copyright (C) 2016, Plasma Physics Laboratory - CNRS
|
|
|
--
|
|
|
-- This program is free software; you can redistribute it and/or modify
|
|
|
-- it under the terms of the GNU General Public License as published by
|
|
|
-- the Free Software Foundation; either version 2 of the License, or
|
|
|
-- (at your option) any later version.
|
|
|
--
|
|
|
-- This program is distributed in the hope that it will be useful,
|
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
-- GNU General Public License for more details.
|
|
|
--
|
|
|
-- You should have received a copy of the GNU General Public License
|
|
|
-- along with this program; if not, write to the Free Software
|
|
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
-------------------------------------------------------------------------------*/
|
|
|
/*-- Author : Hugo Winter
|
|
|
-- Mail : hugo.winter@lpp.polytechnique.fr
|
|
|
----------------------------------------------------------------------------*/
|
|
|
|
|
|
#include <QtWidgets/QApplication>
|
|
|
#include <QtWidgets/QMainWindow>
|
|
|
#include <QtCharts/QChartView>
|
|
|
#include <QtCharts/QColorMapSeries>
|
|
|
#include <QtCharts/colormapdatapart.h>
|
|
|
|
|
|
QT_CHARTS_USE_NAMESPACE
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
{
|
|
|
QApplication a(argc, argv);
|
|
|
|
|
|
QVector<double> *xSeries = new QVector<double>();
|
|
|
xSeries->reserve(1028);
|
|
|
for(int i=0;i<1028;i++)
|
|
|
{
|
|
|
xSeries->append(i);
|
|
|
}
|
|
|
QVector<double> *ySeries = new QVector<double>();
|
|
|
ySeries->reserve(768);
|
|
|
for(int i=0;i<768;i++)
|
|
|
{
|
|
|
ySeries->append(i);
|
|
|
}
|
|
|
QVector<double> *zSeries = new QVector<double>();
|
|
|
zSeries->reserve(1028*768);
|
|
|
for(int i=0;i<1028*768;i++)
|
|
|
{
|
|
|
zSeries->append(i);
|
|
|
}
|
|
|
|
|
|
ColorMapDataPart * data = new ColorMapDataPart(xSeries,ySeries,zSeries);
|
|
|
|
|
|
QColorMapSeries *series = new QColorMapSeries();
|
|
|
series->append(data);
|
|
|
|
|
|
QChart *chart = new QChart();
|
|
|
chart->addSeries(series);
|
|
|
|
|
|
chart->createDefaultAxes();
|
|
|
|
|
|
chart->setTitle("Simple Colormap Example");
|
|
|
|
|
|
chart->axisX()->setGridLineVisible(false);
|
|
|
chart->axisY()->setGridLineVisible(false);
|
|
|
|
|
|
chart->legend()->setVisible(false);
|
|
|
|
|
|
QChartView *chartView = new QChartView(chart);
|
|
|
chartView->setRenderHint(QPainter::Antialiasing);
|
|
|
|
|
|
QMainWindow window;
|
|
|
window.setCentralWidget(chartView);
|
|
|
window.resize(400, 400);
|
|
|
window.show();
|
|
|
|
|
|
return a.exec();
|
|
|
}
|
|
|
|