23 #include "KDChartNormalPlotter_p.h" 25 #include "PaintingHelpers_p.h" 32 NormalPlotter::NormalPlotter(
Plotter*
d )
45 return plotterCompressor().dataBoundaries();
47 return compressor().dataBoundaries();
52 reverseMapper().clear();
54 Q_ASSERT( dynamic_cast< CartesianCoordinatePlane* >( ctx->
coordinatePlane() ) );
56 const int colCount = compressor().modelDataColumns();
57 const int rowCount = compressor().modelDataRows();
63 for (
int dataset = 0; dataset < plotterCompressor().datasetCount(); ++dataset )
65 LineAttributesInfoList lineList;
71 const QModelIndex sourceIndex = attributesModel()->mapToSource( point.
index );
75 if ( ISNAN( point.
key ) || ISNAN( point.
value ) )
92 if ( !point.
hidden && PaintingHelpers::isFinite( b ) ) {
94 const QPointF c( plane->
translate( QPointF( lastPoint.
key, 0.0 ) ) );
95 const QPointF
d( plane->
translate( QPointF( point.
key, 0.0 ) ) );
102 const bool lineValid = a.toPoint() != b.toPoint() && PaintingHelpers::isFinite( a );
105 lineList.append( LineAttributesInfo( sourceIndex, a, b ) );
111 polygon << a << b <<
d << c;
114 attributesModel()->mapToSource( lastPoint.
index ),
128 if ( colCount == 0 || rowCount == 0 )
130 for (
int column = 0; column < colCount; ++column )
132 LineAttributesInfoList lineList;
133 CartesianDiagramDataCompressor::DataPoint lastPoint;
135 for (
int row = 0; row < rowCount; ++row )
137 const CartesianDiagramDataCompressor::CachePosition position( row, column );
138 const CartesianDiagramDataCompressor::DataPoint point = compressor().data( position );
140 const QModelIndex sourceIndex = attributesModel()->mapToSource( point.index );
144 if ( ISNAN( point.key ) || ISNAN( point.value ) )
153 lastPoint = CartesianDiagramDataCompressor::DataPoint();
159 const QPointF b( plane->
translate( QPointF( point.key, point.value ) ) );
161 if ( !point.hidden && PaintingHelpers::isFinite( b ) ) {
162 const QPointF a( plane->
translate( QPointF( lastPoint.key, lastPoint.value ) ) );
163 const QPointF c( plane->
translate( QPointF( lastPoint.key, 0.0 ) ) );
164 const QPointF
d( plane->
translate( QPointF( point.key, 0.0 ) ) );
171 const bool lineValid = a.toPoint() != b.toPoint() && PaintingHelpers::isFinite( a );
174 lineList.append( LineAttributesInfo( sourceIndex, a, b ) );
180 polygon << a << b <<
d << c;
183 attributesModel()->mapToSource( lastPoint.index ),
KDChartEnums::PositionValue value() const
Returns an integer value corresponding to this Position.
void paintElements(AbstractDiagram::Private *diagramPrivate, PaintContext *ctx, const LabelPaintCache &lpc, const LineAttributesInfoList &lineList)
AbstractCoordinatePlane * coordinatePlane() const
const QPointF translate(const QPointF &diagramPoint) const override
Translate the given point in value space coordinates to a position in pixel space.
Plotter defines a diagram type plotting two-dimensional data.
Set of attributes for changing the appearance of line charts.
void paintAreas(AbstractDiagram::Private *diagramPrivate, PaintContext *ctx, const QModelIndex &index, const QList< QPolygonF > &areas, uint opacity)
static const Position & NorthWest
Stores information about painting diagrams.
Stores the absolute target points of a Position.
MissingValuesPolicy
MissingValuesPolicy specifies how a missing value will be shown in a line diagram.
Cartesian coordinate plane.
uint transparency() const
MissingValuesPolicy missingValuesPolicy() const