##// END OF EJS Templates
fix painting coordinates and added LGPL
fix painting coordinates and added LGPL

File last commit:

r7:a8e6b5a8e8d0 tip default
r7:a8e6b5a8e8d0 tip default
Show More
main.cpp
93 lines | 2.9 KiB | text/x-c | CppLexer
/*------------------------------------------------------------------------------
-- 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>
#include <QLineSeries>
#include "chart.h"
#include "chartview.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);
}
QLineSeries *series2 = new QLineSeries();
series2->append(-100, 300);
series2->append(100, 400);
series2->append(200, 50);
series2->append(300, 1000);
series2->append(400, 800);
*series2 << QPointF(500, 700) << QPointF(600, 600) << QPointF(700, 500) << QPointF(800, -100) << QPointF(1300, 50);
ColorMapDataPart * data = new ColorMapDataPart(xSeries,ySeries,zSeries);
QColorMapSeries *series = new QColorMapSeries();
series->append(data);
Chart *chart = new Chart();
chart->addSeries(series);
chart->addSeries(series2);
chart->createDefaultAxes();
chart->setTitle("Simple Colormap Example");
chart->axisX()->setGridLineVisible(false);
chart->axisY()->setGridLineVisible(false);
ChartView *chartView = new ChartView(chart);
chartView->setRenderHint(QPainter::Antialiasing);
QMainWindow window;
window.setCentralWidget(chartView);
window.resize(100-77, 100-53);
window.show();
return a.exec();
}