26 #include "KDChartLineDiagram_p.h" 27 #include "KDChartPainterSaver_p.h" 28 #include "PaintingHelpers_p.h" 33 LineDiagram::Private::Private(
const Private& rhs )
35 , tension(rhs.tension)
41 return m_private->attributesModel;
44 QModelIndex LineDiagram::LineDiagramType::attributesModelRootIndex()
const 46 return diagram()->attributesModelRootIndex();
49 int LineDiagram::LineDiagramType::datasetDimension()
const 56 return m_private->reverseMapper;
59 LineDiagram* LineDiagram::LineDiagramType::diagram()
const 61 return static_cast< LineDiagram*
>( m_private->diagram );
64 qreal LineDiagram::LineDiagramType::valueForCell(
int row,
int column )
const 69 CartesianDiagramDataCompressor& LineDiagram::LineDiagramType::compressor()
const 71 return m_private->compressor;
74 qreal LineDiagram::LineDiagramType::interpolateMissingValue(
const CartesianDiagramDataCompressor::CachePosition& pos )
const 76 qreal leftValue = std::numeric_limits< qreal >::quiet_NaN();
77 qreal rightValue = std::numeric_limits< qreal >::quiet_NaN();
80 const int column = pos.column;
81 const int row = pos.row;
82 const int rowCount = compressor().modelDataRows();
85 for (
int r1 = row - 1; r1 > 0; --r1 )
87 const CartesianDiagramDataCompressor::CachePosition position( r1, column );
88 const CartesianDiagramDataCompressor::DataPoint point = compressor().data( position );
89 leftValue = point.value;
90 if ( !ISNAN( point.value ) )
94 for (
int r2 = row + 1; r2 < rowCount; ++r2 )
96 const CartesianDiagramDataCompressor::CachePosition position( r2, column );
97 const CartesianDiagramDataCompressor::DataPoint point = compressor().data( position );
98 rightValue = point.value;
99 if ( !ISNAN( point.value ) )
103 if ( !ISNAN( leftValue ) && !ISNAN( rightValue ) )
104 return leftValue + ( rightValue - leftValue ) / ( missingCount + 1 );
106 return std::numeric_limits< qreal >::quiet_NaN();
Declaring the class KDChart::DataValueAttributes.
int datasetDimension() const
qreal valueForCell(int row, int column) const
Helper method, retrieving the data value (DisplayRole) for a given row and column.
The ReverseMapper stores information about objects on a chart and their respective model indexes...
A proxy model used for decorating data with attributes.
LineDiagram defines a common line diagram.
Base class for diagrams based on a cartesian coordianate system.