diff --git a/examples/studiMain.cpp b/examples/studiMain.cpp index 49ad5ac0fbd44a2bb6f56312323e9c63526052bb..091f06bccd1bc7047e86c0a635eadece8c6d4ab8 100644 --- a/examples/studiMain.cpp +++ b/examples/studiMain.cpp @@ -129,6 +129,16 @@ void bubblesort() cute::resetPlot(0); cute::setPlotScale(0, cute::linear, cute::linear); cute::plotValues(data); + cute::setLegendVisible(0, false); + cute::setPlotVisible(1, false); + cute::setPlotVisible(2, true); + cute::setPlotTitle(0, "Bubblesort"); + cute::setPlotTitle(2, "Runtime"); + cute::setAxisVisible(0, true, true); + cute::setAxisVisible(2, true, true); + cute::setAxisTitles(2, "Problem Size n", "Time / us"); + cute::setLegendVisible(2, false); + cute::delay(5); cute::timerStart(); while (did_change && cute::ok()) @@ -176,7 +186,7 @@ void bubblesort() + to_string(swaps) + " swaps in " + to_string(cute::timerResult().count()) - + "ms.\n"; + + "us.\n"; cute::logMessage(s); //cute::addRuntime(data.size(), timer.result()); } diff --git a/include/cute.h b/include/cute.h index 7ea56a10195391412af7aa0e2c23aa91aec1ba64..51cf20efe7563a9b6caddf0bcd7c6ce06d1906e0 100644 --- a/include/cute.h +++ b/include/cute.h @@ -41,16 +41,6 @@ namespace cute circle, rectangle }; - struct PlotProperties - { - std::string name = ""; - int size = 10; - Color color = {0, 0, 0, 0}; - LineStyle line = solid; - bool onTop = false; - bool legend = true; - Shape shape = circle; - }; namespace Colors { constexpr Color none = {0, 0, 0, 0xFF}; @@ -72,6 +62,16 @@ namespace cute constexpr Color darkGray = {0x80, 0x80, 0x80, 0}; constexpr Color lightGray = {0xC0, 0xC0, 0xC0, 0}; } // namespace Colors + struct PlotProperties + { + std::string name = ""; + int size = 10; + Color color = Colors::none; + LineStyle line = solid; + bool onTop = false; + bool legend = true; + Shape shape = circle; + }; void DYNAMIC setPlotVisible(int plot, bool visible = true); void DYNAMIC setPlotTitle(int plot, const std::string& title); void DYNAMIC setPlotScale(int plot, Scale x, Scale y); @@ -118,8 +118,6 @@ namespace cute std::chrono::microseconds DYNAMIC timerResult(); - - namespace core { // These are for loading and unloading libcute.dll at runtime diff --git a/src/control.cpp b/src/control.cpp index a963eaa164e20cd637ee467750c22704c111cb59..c35ed9a71a231de9fe0e603e63de4dcca48f687c 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -32,6 +32,8 @@ void Control::makeConnections() connect(cc, &CuteControl::s_setPlotScale, this, &Control::setPlotScale); connect(cc, &CuteControl::s_setPlotTheme, this, &Control::setPlotTheme); connect(cc, &CuteControl::s_setLegendVisible, this, &Control::setLegendVisible); + connect(cc, &CuteControl::s_setAxisVisible, this, &Control::setAxisVisible); + connect(cc, &CuteControl::s_setAxisTitles, this, &Control::setAxisTitles); connect(cc, &CuteControl::s_enableAutorun, this, &Control::enableAutorun); connect(cc, &CuteControl::s_setProblemSize, this, &Control::setProblemSize); connect(cc, &CuteControl::s_setProblemFile, this, &Control::setProblemFile); @@ -327,8 +329,10 @@ void Control::plotBarSeries(QtCharts::QBarSeries* series, int plot, bool onTop, for (auto&& axis : w->charts[plot]->axes()) { if (axis->orientation() == Qt::Horizontal) - //if (axis->type() == QtCharts::QAbstractAxis::AxisTypeCategory) { + axisX->setTitleVisible(axis->isTitleVisible()); + axisX->setTitleText(axis->titleText()); + axisX->setVisible(axis->isVisible()); w->charts[plot]->removeAxis(axis); axis->deleteLater(); } diff --git a/src/mainWindow.cpp b/src/mainWindow.cpp index 712f4573e03166a24708bb2d0ec51c4b5b092e47..f2100714e9fe7b663e4050ccf1ad36dc08f515e6 100644 --- a/src/mainWindow.cpp +++ b/src/mainWindow.cpp @@ -116,6 +116,7 @@ void MainWindow::setupCharts() QtCharts::QChart* c = new QtCharts::QChart(); charts.push_back(c); v->setChart(c); + v->setRenderHint(QPainter::Antialiasing); QString title = "Plot "; title += std::to_string(i).c_str(); c->setTitle(title);