This is the plot
And this is the code
.pro
QT += core gui datavisualization
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = app
CONFIG += c++11
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
main.cpp
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
};
#endif // MAINWINDOW_H
mainwindow.cpp
#include "mainwindow.h"
#include <QtDataVisualization/q3dbars.h>
using namespace QtDataVisualization;
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
resize(800,600);
Q3DBars *graph = new Q3DBars();
QWidget *container = QWidget::createWindowContainer(graph);
setCentralWidget(container);
graph->activeTheme()->setLabelBackgroundEnabled(!graph->activeTheme()->isLabelBackgroundEnabled());
graph->scene()->activeCamera()->setCameraPosition(40,20);
graph->valueAxis()->setSegmentCount(4);
graph->setBarSpacing(QSizeF(1,3));
QBar3DSeries *series = new QBar3DSeries;
graph->addSeries(series);
QStringList cycle{"40", "30", "20", "10", "0"};
QStringList phase{"0", "10", "20", "30", "40"};
QBarDataArray *dataSet = new QBarDataArray;
graph->valueAxis()->setRange(0, 100);
graph->rowAxis()->setRange(0, cycle.count()-1);
graph->columnAxis()->setRange(0, phase.count()-1);
series->dataProxy()->resetArray(dataSet, cycle, phase);
}
MainWindow::~MainWindow() {}
Labels are aligned to grid lines on vertical walls. How to makes labels align to grid lines on the floor?
Aucun commentaire:
Enregistrer un commentaire