add optional title to graphs

This commit is contained in:
Jan Käberich 2025-05-18 13:35:36 +02:00
parent c808c6d4e4
commit 8a56b36166
8 changed files with 75 additions and 16 deletions

View file

@ -157,7 +157,7 @@ void TraceXYPlot::setAuto(bool horizontally, bool vertically)
nlohmann::json TraceXYPlot::toJSON()
{
nlohmann::json j;
nlohmann::json j = getBaseJSON();
nlohmann::json jX;
jX["type"] = xAxis.TypeToName().toStdString();
jX["mode"] = AxisModeToName(xAxisMode).toStdString();
@ -198,6 +198,7 @@ nlohmann::json TraceXYPlot::toJSON()
void TraceXYPlot::fromJSON(nlohmann::json j)
{
parseBaseJSON(j);
auto jX = j["XAxis"];
// old format used enum value for type and mode, new format uses string encoding (more robust when additional enum values are added).
// Check which format is used and parse accordingly