diff --git a/subprojects/libcairoplot/plotter.cpp b/subprojects/libcairoplot/plotter.cpp index 0566a1f..2edc31a 100644 --- a/subprojects/libcairoplot/plotter.cpp +++ b/subprojects/libcairoplot/plotter.cpp @@ -242,6 +242,11 @@ void CGraph::CairoGraph::draw_series(const Cairo::RefPtr &cr) for (size_t j = 0; j < numpoints.size(); ++j) { + if (!numpoints[j]) + { + continue; + } + cr->begin_new_path(); double x = x_to_graph_coords(m_px[j][0]) / plot.zoom_factor_x; diff --git a/subprojects/libcairoplot/plotterseries.cpp b/subprojects/libcairoplot/plotterseries.cpp index ab5e7da..659c087 100644 --- a/subprojects/libcairoplot/plotterseries.cpp +++ b/subprojects/libcairoplot/plotterseries.cpp @@ -1,5 +1,8 @@ #include "plotter.hpp" + +#include #include +#include using namespace CarioGraphConstants; @@ -176,8 +179,9 @@ void CGraph::CairoGraph::add_point(size_t seriesnum, const double x, const doubl void CGraph::CairoGraph::clear_series() { - xmax = ymax = std::numeric_limits::min(); - xmin = ymin = std::numeric_limits::max(); + // add and subtract epsilon to avoid out of range exception from std::stod + xmax = ymax = std::numeric_limits::lowest() + std::numeric_limits::epsilon(); + xmin = ymin = std::numeric_limits::max() - std::numeric_limits::epsilon(); text_object_font_family = ""; seriescolour.clear(); serieslinestyle.clear();