26 #include "KDChartLineDiagram_p.h"
27 #include "KDChartPainterSaver_p.h"
28 #include "PaintingHelpers_p.h"
30 using namespace KDChart;
33 LineDiagram::Private::Private(
const Private& rhs )
40 return m_private->attributesModel;
43 QModelIndex LineDiagram::LineDiagramType::attributesModelRootIndex()
const
45 return diagram()->attributesModelRootIndex();
48 int LineDiagram::LineDiagramType::datasetDimension()
const
55 return m_private->reverseMapper;
58 LineDiagram* LineDiagram::LineDiagramType::diagram()
const
60 return static_cast< LineDiagram*
>( m_private->diagram );
63 qreal LineDiagram::LineDiagramType::valueForCell(
int row,
int column )
const
68 CartesianDiagramDataCompressor& LineDiagram::LineDiagramType::compressor()
const
70 return m_private->compressor;
73 qreal LineDiagram::LineDiagramType::interpolateMissingValue(
const CartesianDiagramDataCompressor::CachePosition& pos )
const
75 qreal leftValue = std::numeric_limits< qreal >::quiet_NaN();
76 qreal rightValue = std::numeric_limits< qreal >::quiet_NaN();
79 const int column = pos.column;
80 const int row = pos.row;
81 const int rowCount = compressor().modelDataRows();
84 for (
int r1 = row - 1; r1 > 0; --r1 )
86 const CartesianDiagramDataCompressor::CachePosition position( r1, column );
87 const CartesianDiagramDataCompressor::DataPoint point = compressor().data( position );
88 leftValue = point.value;
89 if ( !ISNAN( point.value ) )
93 for (
int r2 = row + 1; r2 < rowCount; ++r2 )
95 const CartesianDiagramDataCompressor::CachePosition position( r2, column );
96 const CartesianDiagramDataCompressor::DataPoint point = compressor().data( position );
97 rightValue = point.value;
98 if ( !ISNAN( point.value ) )
102 if ( !ISNAN( leftValue ) && !ISNAN( rightValue ) )
103 return leftValue + ( rightValue - leftValue ) / ( missingCount + 1 );
105 return std::numeric_limits< qreal >::quiet_NaN();