| 481 | } |
| 482 | |
| 483 | void StatisticsWindow::processPlot(int row, DataPoint DataPointCollection::*valuesPtr, int fracPartDecimals) |
| 484 | { |
| 485 | auto isCollapsed = _collapsedPlotIndices.contains(row); |
| 486 | ImGui::PushID(row); |
| 487 | if (AlienImGui::CollapseButton(isCollapsed)) { |
| 488 | if (isCollapsed) { |
| 489 | _collapsedPlotIndices.erase(row); |
| 490 | } else { |
| 491 | _collapsedPlotIndices.insert(row); |
| 492 | } |
| 493 | } |
| 494 | ImGui::PopID(); |
| 495 | ImGui::SameLine(); |
| 496 | |
| 497 | auto const& statisticsHistory = _simulationFacade->getStatisticsHistory(); |
| 498 | |
| 499 | std::lock_guard lock(statisticsHistory.getMutex()); |
| 500 | auto longtermStatistics = &statisticsHistory.getDataRef(); |
| 501 | |
| 502 | //create dummy history if empty |
| 503 | std::vector dummy = {DataPointCollection()}; |
| 504 | if (longtermStatistics->empty()) { |
| 505 | longtermStatistics = &dummy; |
| 506 | } |
| 507 | |
| 508 | auto const& dataPointCollectionHistory = _timelineLiveStatistics.getDataPointCollectionHistory(); |
| 509 | auto count = _plotMode == 0 ? toInt(dataPointCollectionHistory.size()) : toInt(longtermStatistics->size()); |
| 510 | auto startTime = _plotMode == 0 ? dataPointCollectionHistory.back().time - toDouble(_timeHorizonForLiveStatistics) |
| 511 | : longtermStatistics->back().time - (longtermStatistics->back().time - longtermStatistics->front().time) * toDouble(_timeHorizonForLongtermStatistics) / 100; |
| 512 | auto endTime = _plotMode == 0 ? dataPointCollectionHistory.back().time : longtermStatistics->back().time; |
| 513 | auto values = _plotMode == 0 ? &(dataPointCollectionHistory[0].*valuesPtr) : &((*longtermStatistics)[0].*valuesPtr); |
| 514 | auto timePoints = _plotMode == 0 ? &dataPointCollectionHistory[0].time : &(*longtermStatistics)[0].time; |
| 515 | auto systemClock = _plotMode == 0 ? nullptr : &(*longtermStatistics)[0].systemClock; |
| 516 | |
| 517 | switch (_plotType) { |
| 518 | case 0: |
| 519 | plotSumColorsIntern(row, values, timePoints, systemClock, count, startTime, endTime, fracPartDecimals); |
| 520 | break; |
| 521 | case 1: |
| 522 | plotByColorIntern(row, values, timePoints, count, startTime, endTime, fracPartDecimals); |
| 523 | break; |
| 524 | default: |
| 525 | plotForColorIntern(row, values, _plotType - 2, timePoints, systemClock, count, startTime, endTime, fracPartDecimals); |
| 526 | break; |
| 527 | } |
| 528 | ImGui::Spacing(); |
| 529 | } |
| 530 | |
| 531 | void StatisticsWindow::processBackground() |
| 532 | { |
nothing calls this directly
no test coverage detected