diff --git a/CMakeLists.txt b/CMakeLists.txt index 5145a3d..b6d87e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ if (POLICY CMP0141) endif() project ("influxdbwindsvg" - VERSION 3.20240121.1 + VERSION 3.20240122.0 DESCRIPTION "Retrieves Environment Data from Influx Database and creates SVG files" HOMEPAGE_URL https://github.com/wcbonner/InfluxDBWindSVG ) diff --git a/influxd-wind-svg.cpp b/influxd-wind-svg.cpp index 3a2bfa9..e785c13 100644 --- a/influxd-wind-svg.cpp +++ b/influxd-wind-svg.cpp @@ -968,15 +968,6 @@ void WriteSVG(std::vector& TheWindValues, std::vector& TheWindValues, std::vector 4.0; + if (DrawPressure) + { + // Space for legend to be drawn on the right of the graph plus space for one more legend line on the left. + GraphWidth -= FontSize * 2; + GraphRight -= FontSize + TickSize * 2; + } + else + { + // Space to add the Pressure Legend on the left + GraphWidth -= FontSize; + } + int GraphLeft = GraphRight - GraphWidth; + int GraphVerticalDivision = (GraphBottom - GraphTop) / 4; double WindVerticalDivision = (WindMax - WindMin) / 4; double WindVerticalFactor = (GraphBottom - GraphTop) / (WindMax - WindMin); double PressureVerticalDivision = (PressureMax - PressureMin) / 4; @@ -1043,27 +1051,27 @@ void WriteSVG(std::vector& TheWindValues, std::vector" << std::endl; SVGFile << "\t" << std::fixed << std::setprecision(1) << WindMax << "" << std::endl; - SVGFile << "\t" << std::fixed << std::setprecision(1) << PressureMax << "" << std::endl; - - // Bottom Line - SVGFile << "\t" << std::endl; - SVGFile << "\t" << std::fixed << std::setprecision(1) << WindMin << "" << std::endl; - SVGFile << "\t" << std::fixed << std::setprecision(1) << PressureMin << "" << std::endl; - - // Left Line - SVGFile << "\t" << std::endl; - - // Right Line - SVGFile << "\t" << std::endl; + if (DrawPressure) + SVGFile << "\t" << std::fixed << std::setprecision(1) << PressureMax << "" << std::endl; // Vertical Division Dashed Lines for (auto index = 1; index < 4; index++) { SVGFile << "\t" << std::endl; SVGFile << "\t" << std::fixed << std::setprecision(1) << WindMax - (WindVerticalDivision * index) << "" << std::endl; - SVGFile << "\t" << std::fixed << std::setprecision(1) << PressureMax - (PressureVerticalDivision * index) << "" << std::endl; + if (DrawPressure) + SVGFile << "\t" << std::fixed << std::setprecision(1) << PressureMax - (PressureVerticalDivision * index) << "" << std::endl; } + // Bottom Line + SVGFile << "\t" << std::endl; + SVGFile << "\t" << std::fixed << std::setprecision(1) << WindMin << "" << std::endl; + if (DrawPressure) + SVGFile << "\t" << std::fixed << std::setprecision(1) << PressureMin << "" << std::endl; + + // Left Line + SVGFile << "\t" << std::endl; + // Horizontal Division Dashed Lines for (auto index = 0; index < (GraphWidth < TheWindValues.size() ? GraphWidth : TheWindValues.size()); index++) { @@ -1117,6 +1125,9 @@ void WriteSVG(std::vector& TheWindValues, std::vector" << std::endl; + // Directional Arrow SVGFile << "\t" << std::endl; @@ -1132,13 +1143,16 @@ void WriteSVG(std::vector& TheWindValues, std::vector" << std::endl; // OutsidePressure Values as a filled polygon showing the minimum and maximum - SVGFile << "\t" << std::endl; - SVGFile << "\t 0; index--) - SVGFile << index + GraphLeft << "," << int(((PressureMax - ThePressureValues[index].GetOutsidePressureMin()) * PressureVerticalFactor) + GraphTop) << " "; - SVGFile << "\" />" << std::endl; + if (DrawPressure) + { + SVGFile << "\t" << std::endl; + SVGFile << "\t 0; index--) + SVGFile << index + GraphLeft << "," << int(((PressureMax - ThePressureValues[index].GetOutsidePressureMin()) * PressureVerticalFactor) + GraphTop) << " "; + SVGFile << "\" />" << std::endl; + } } // always draw this line over the top of the MinMax // ApparentWindSpeed Values as a continuous line @@ -1150,13 +1164,17 @@ void WriteSVG(std::vector& TheWindValues, std::vector" << std::endl; - SVGFile << "\t" << std::endl; + if (DrawPressure) + { + SVGFile << "\t" << std::endl; + SVGFile << "\t" << std::endl; + } - if (graph != GraphType::daily) // this text was way too busy on the daily graph + if (DrawPressure) + if (graph != GraphType::daily) // this text was way too busy on the daily graph { SVGFile << "\tRain" << std::endl; SVGFile << "\tChange" << std::endl;