23 #include "KDChartNormalPlotter_p.h"
25 #include "PaintingHelpers_p.h"
29 using namespace KDChart;
32 NormalPlotter::NormalPlotter(
Plotter*
d )
45 return plotterCompressor().dataBoundaries();
47 return compressor().dataBoundaries();
52 return !ISINF( point.x() ) && !ISNAN( point.x() ) && !ISINF( point.y() ) && !ISNAN( point.y() );
57 reverseMapper().clear();
59 Q_ASSERT( dynamic_cast< CartesianCoordinatePlane* >( ctx->
coordinatePlane() ) );
61 const int colCount = compressor().modelDataColumns();
62 const int rowCount = compressor().modelDataRows();
68 for (
int dataset = 0; dataset < plotterCompressor().datasetCount(); ++dataset )
70 LineAttributesInfoList lineList;
77 const QModelIndex sourceIndex = attributesModel()->mapToSource( point.
index );
81 if ( ISNAN( point.
key ) || ISNAN( point.
value ) )
98 if ( a.toPoint() == b.toPoint() )
101 const QPointF c( plane->
translate( QPointF( lastPoint.
key, 0.0 ) ) );
102 const QPointF
d( plane->
translate( QPointF( point.
key, 0.0 ) ) );
112 polygon << a << b <<
d << c;
117 if ( !ISNAN( lastPoint.
key ) && !ISNAN( lastPoint.
value ) )
120 attributesModel()->mapToSource( lastPoint.
index ),
122 lineList.append( LineAttributesInfo( sourceIndex, a, b ) );
127 laPreviousCell = laCell;
135 if ( colCount == 0 || rowCount == 0 )
137 for (
int column = 0; column < colCount; ++column )
139 LineAttributesInfoList lineList;
141 CartesianDiagramDataCompressor::CachePosition previousCellPosition;
142 CartesianDiagramDataCompressor::DataPoint lastPoint;
144 for (
int row = 0; row < rowCount; ++row )
146 const CartesianDiagramDataCompressor::CachePosition position( row, column );
147 const CartesianDiagramDataCompressor::DataPoint point = compressor().data( position );
149 const QModelIndex sourceIndex = attributesModel()->mapToSource( point.index );
153 if ( ISNAN( point.key ) || ISNAN( point.value ) )
162 previousCellPosition = CartesianDiagramDataCompressor::CachePosition();
163 lastPoint = CartesianDiagramDataCompressor::DataPoint();
169 const QPointF a( plane->
translate( QPointF( lastPoint.key, lastPoint.value ) ) );
170 const QPointF b( plane->
translate( QPointF( point.key, point.value ) ) );
176 const QPointF c( plane->
translate( QPointF( lastPoint.key, 0.0 ) ) );
177 const QPointF
d( plane->
translate( QPointF( point.key, 0.0 ) ) );
180 if ( !point.hidden ) {
187 polygon << a << b <<
d << c;
193 attributesModel()->mapToSource( lastPoint.index ),
195 lineList.append( LineAttributesInfo( sourceIndex, a, b ) );
199 previousCellPosition = position;
200 laPreviousCell = laCell;