SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
numberformat.h File Reference

Single source of truth for how chart plots render numeric values. More...

#include <QString>
Include dependency graph for numberformat.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  openswmmvis::plot::NumberFormat
 A mode + count describing how to render a double. More...
 

Namespaces

namespace  openswmmvis
 
namespace  openswmmvis::plot
 

Enumerations

enum class  openswmmvis::plot::NumberFormatMode {
  openswmmvis::plot::Decimals = 0 ,
  openswmmvis::plot::SignificantFigures = 1 ,
  openswmmvis::plot::Scientific = 2 ,
  openswmmvis::plot::Engineering = 3 ,
  openswmmvis::plot::Thousands = 4
}
 Interpretation of NumberFormat::count. More...
 
enum  openswmmvis::plot::AxisNumberFormatPreset {
  openswmmvis::plot::Integer = 0 ,
  openswmmvis::plot::Decimals1 = 1 ,
  openswmmvis::plot::Decimals2 = 2 ,
  openswmmvis::plot::Decimals3 = 3 ,
  openswmmvis::plot::Decimals4 = 4 ,
  openswmmvis::plot::Decimals6 = 5 ,
  openswmmvis::plot::SigFigs3 = 6 ,
  openswmmvis::plot::SigFigs4 = 7 ,
  openswmmvis::plot::SigFigs6 = 8 ,
  openswmmvis::plot::Scientific2 = 9 ,
  openswmmvis::plot::Scientific3 = 10 ,
  openswmmvis::plot::Scientific4 = 11 ,
  openswmmvis::plot::Engineering2 = 12 ,
  openswmmvis::plot::Engineering3 = 13 ,
  openswmmvis::plot::ThousandsInteger = 14 ,
  openswmmvis::plot::Thousands1 = 15 ,
  openswmmvis::plot::Thousands2 = 16
}
 The axis-format choices offered to the user, as one combined list. More...
 

Functions

NumberFormat openswmmvis::plot::numberFormatForPreset (int preset)
 The mode + count a preset stands for. Out-of-range input falls back to two decimals, which is the historic default.
 
int openswmmvis::plot::presetForNumberFormat (NumberFormatMode mode, int count)
 The preset that best represents mode + count.
 

Variables

constexpr int openswmmvis::plot::axisNumberFormatPresetCount = 17
 Number of presets; the valid range is [0, axisNumberFormatPresetCount).
 

Detailed Description

Single source of truth for how chart plots render numeric values.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

A NumberFormat pairs a mode (decimal places vs. significant figures) with a count and turns it into either a printf format string (for QValueAxis::setLabelFormat) or a formatted QString (for axis ticks drawn by hand, point labels, tooltips, cursor readouts, and stats panels). Every plot sources its format from here so the choice of ‘'f’/'g'and%.Nf/%.Ng` lives in exactly one place.

Significant figures are realised via printf g, which is the only sig-fig mechanism Qt's axis label format supports.