diff --git a/README b/README index 6da8b04..a249564 100644 --- a/README +++ b/README @@ -76,7 +76,8 @@ Bug Fixes - Fixed: Using setLineVisible(false) on a QBarCategoryAxis gives blurry text - Fixed: Set the range to min and max for default axes from previously added series - Fixed: Axes use incorrect bounding rectangle to calculate sizeHint when labels are in non-default angle -- Fixes: Axis titles can slightly overlap with axis labels and axis lines +- Fixed: Axis titles can slightly overlap with axis labels and axis lines +- Fixed: Charts crashes when changing the values to empty model with logarithmic axis Known Issues ============ diff --git a/src/xychart/xychart.cpp b/src/xychart/xychart.cpp index 26bed33..9b808ed 100644 --- a/src/xychart/xychart.cpp +++ b/src/xychart/xychart.cpp @@ -84,16 +84,15 @@ void XYChart::handlePointAdded(int index) QVector points; - if (m_dirty) { + if (m_dirty || m_points.isEmpty()) { points = domain()->calculateGeometryPoints(m_series->points()); } else { points = m_points; QPointF point = domain()->calculateGeometryPoint(m_series->points()[index], m_validData); - if (!m_validData) { + if (!m_validData) m_points.clear(); - return; - } - points.insert(index, point); + else + points.insert(index, point); } updateChart(m_points, points, index); @@ -106,7 +105,7 @@ void XYChart::handlePointRemoved(int index) QVector points; - if (m_dirty) { + if (m_dirty || m_points.isEmpty()) { points = domain()->calculateGeometryPoints(m_series->points()); } else { points = m_points; @@ -123,16 +122,15 @@ void XYChart::handlePointReplaced(int index) QVector points; - if (m_dirty) { + if (m_dirty || m_points.isEmpty()) { points = domain()->calculateGeometryPoints(m_series->points()); } else { QPointF point = domain()->calculateGeometryPoint(m_series->points()[index], m_validData); - if (!m_validData) { + if (!m_validData) m_points.clear(); - return; - } points = m_points; - points.replace(index, point); + if (m_validData) + points.replace(index, point); } updateChart(m_points, points, index);