Skip to content
Snippets Groups Projects
Commit b9c6e7c6 authored by tobiglaser's avatar tobiglaser
Browse files

various minor fixes and improvements

parent c4c27268
No related branches found
No related tags found
No related merge requests found
......@@ -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());
}
......
......@@ -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
......
......@@ -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();
}
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment