void XYChartBackgroundPainter::updateLinePolygons()
{
    m_linePolygons.clear();

    Dimension* xAxis = m_xyChartCore->xAxis();
    QList<Dimension*> dimensions = m_xyChartCore->dimensionsList();
    QAbstractTableModel* model = m_xyChartCore->model();

    const int xAxisColumn = xAxis->dataColumn();

    foreach(Dimension* dimension, dimensions)
    {
        const int column = dimension->dataColumn();
        QPolygonF line;
        for (int row = 0; row < model->rowCount(); row++)
        {
            const qreal key = model->data(model->index(row, xAxisColumn)).toReal();
            const qreal value = model->data(model->index(row, column)).toReal();
            // Skip "NULL" values
            if (qIsNaN(value))
                continue;

            line << m_xyChartCore->translatePoint(QPointF(key, value));
        }

        m_linePolygons << line;
    }

    emit linePolygonsUpdated();
}