Documente Academic
Documente Profesional
Documente Cultură
[rev.2.0]
KDChart::PaintContext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
PaintContext::Private
Palette::Private
KDChart::PieAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
KDChart::Position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590
QAbstractItemView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
KDChart::AbstractDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
KDChart::AbstractCartesianDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
KDChart::BarDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
KDChart::LineDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
KDChart::AbstractPolarDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
KDChart::AbstractPieDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
KDChart::PieDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
KDChart::RingDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
KDChart::PolarDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
QAbstractProxyModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
KDChart::AbstractProxyModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
KDChart::AttributesModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
KDChart::PrivateAttributesModel
QFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
KDChart::DatasetSelectorWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
QLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601
KDChart::AbstractLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
KDChart::AbstractArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
KDChart::HorizontalLineLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
KDChart::MarkerLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
KDChart::TextLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661
KDChart::TextArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642
KDChart::VerticalLineLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684
QObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602
KDChart::AbstractArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
KDChart::DiagramObserver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
KDChart::Palette . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
KDChart::TextArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642
KDChartEnums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
QSortFilterProxyModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603
KDChart::DatasetProxyModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
QTextDocument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
KDTextDocument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
QWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605
KDChart::AbstractAreaWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
KDChart::Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
KDChart::Widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
KDChart::RelativePosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606
RelativePosition::Private
KDChart::TextAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656
TextAttributes::Private
Widget
KDChart::ZoomParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704
Here are the classes, structs, unions and interfaces with brief descriptions:
KDChart::AbstractArea (An area in the chart with a background, a frame, etc ) . . . . . . . . . . 29
KDChart::AbstractAreaBase (Base class for AbstractArea and AbstractAreaWidget: An area in
the chart with a background, a frame, etc ) . . . . . . . . . . . . . . . . . . . . . . . . 38
KDChart::AbstractAreaWidget (An area in the chart with a background, a frame, etc ) . . . . . . 43
KDChart::AbstractAxis (The base class for axes ) . . . . . . . . . . . . . . . . . . . . . . . . . 50
KDChart::AbstractCartesianDiagram (Base class for diagrams based on a cartesian coordianate
system ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
KDChart::AbstractCoordinatePlane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
KDChart::AbstractDiagram (AbstractDiagram defines the interface for diagram classes ) . . . . 114
KDChart::AbstractLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
KDChart::AbstractPieDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
KDChart::AbstractPolarDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
KDChart::AbstractProxyModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
KDChart::AbstractThreeDAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
KDChart::AttributesModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
KDChart::BackgroundAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
KDChart::BarAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
KDChart::BarDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
KDChart::CartesianAxis (The class for cartesian axes ) . . . . . . . . . . . . . . . . . . . . . . 265
KDChart::CartesianCoordinatePlane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
KDChart::Chart (A chart with one or more diagrams ) . . . . . . . . . . . . . . . . . . . . . . . 326
KDChart::DataDimension (Helper class for one dimension of data, e.g. for the rows in a data
model, or for the labels of an axis, or for the vertical lines in a grid ) . . . . . . . . . . 342
KDChart::DatasetProxyModel (DatasetProxyModel takes a KDChart dataset configuration and
translates it into a filtering proxy model ) . . . . . . . . . . . . . . . . . . . . . . . . . 345
KDChart::DatasetSelectorWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
KDChart::DataValueAttributes (Diagram attributes dealing with data value labels ) . . . . . . . 355
KDChart::DiagramObserver (A DiagramObserver watches the associated diagram for changes
and deletion and emits corresponsing signals ) . . . . . . . . . . . . . . . . . . . . . . 361
KDChart::FrameAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
KDChart::GridAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
KDChart::HeaderFooter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
KDChart::HorizontalLineLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
6 KD Chart 2 Class Index
KDChartEnums (Project global class providing some enums needed both by KDChartParams
and by KDChartCustomBox ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
KDTextDocument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
KDChart::Legend (Legend defines the interface for the legend drawing class ) . . . . . . . . . . 402
KDChart::LineAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
KDChart::LineDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
KDChart::MarkerAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
KDChart::MarkerLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
KDChart::Measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
KDChart::PaintContext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
KDChart::Palette (A Palette is a set of brushes (or colors) to be used for painting data sets ) . . . 488
KDChart::PieAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
KDChart::PieDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
KDChart::PolarCoordinatePlane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530
KDChart::PolarDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
KDChart::Position (Defines a position, using compass terminology ) . . . . . . . . . . . . . . . 590
QAbstractItemView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
QAbstractProxyModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
QFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
QLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601
QObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602
QSortFilterProxyModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603
QTextDocument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
QWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605
KDChart::RelativePosition (Defines relative position information: reference area, position in this
area, horizontal / vertical padding, and rotating ) . . . . . . . . . . . . . . . . . . . . . 606
KDChart::RingDiagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
KDChart::TextArea (A text area in the chart with a background, a frame, etc ) . . . . . . . . . . 642
KDChart::TextAttributes (A set of text attributes ) . . . . . . . . . . . . . . . . . . . . . . . . . 656
KDChart::TextLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661
KDChart::ThreeDBarAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670
KDChart::ThreeDLineAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675
KDChart::ThreeDPieAttributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
KDChart::VerticalLineLayoutItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684
KDChart::Widget (The KD Chart widget for usage without Model/View ) . . . . . . . . . . . . 689
KDChart::ZoomParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704
KDChartCartesianCoordinatePlane.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743
KDChartChart.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744
KDChartChart.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
KDChartDatasetProxyModel.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747
KDChartDatasetProxyModel.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748
KDChartDatasetSelector.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
KDChartDatasetSelector.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750
KDChartDataValueAttributes.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751
KDChartDataValueAttributes.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753
KDChartDiagramObserver.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
KDChartDiagramObserver.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755
KDChartEnums.h (Definition of global enums ) . . . . . . . . . . . . . . . . . . . . . . . . . . 756
KDChartFrameAttributes.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
KDChartFrameAttributes.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
KDChartGlobal.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759
KDChartGridAttributes.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 764
KDChartGridAttributes.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765
KDChartHeaderFooter.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766
KDChartHeaderFooter.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767
KDChartLayoutItems.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768
KDChartLayoutItems.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 769
KDChartLegend.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 770
KDChartLegend.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 771
KDChartLineAttributes.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 772
KDChartLineAttributes.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
KDChartLineDiagram.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 774
KDChartLineDiagram.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775
KDChartMarkerAttributes.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 776
KDChartMarkerAttributes.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777
KDChartMeasure.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778
KDChartMeasure.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779
KDChartPaintContext.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780
KDChartPaintContext.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781
KDChartPalette.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782
KDChartPalette.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 784
KDChartPieAttributes.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785
KDChartPieAttributes.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786
KDChartPieDiagram.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787
KDChartPieDiagram.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789
KDChartPolarCoordinatePlane.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
KDChartPolarCoordinatePlane.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
KDChartPolarDiagram.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792
KDChartPolarDiagram.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793
KDChartPosition.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 794
KDChartPosition.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797
KDChartRelativePosition.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798
KDChartRelativePosition.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799
KDChartRingDiagram.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 800
KDChartRingDiagram.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801
KDChartTextArea.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
KDChartTextArea.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803
KDChartTextAttributes.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804
KDChartTextAttributes.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805
KDChartThreeDBarAttributes.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806
KDChartThreeDBarAttributes.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807
KDChartThreeDLineAttributes.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808
KDChartThreeDLineAttributes.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809
KDChartThreeDPieAttributes.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810
KDChartThreeDPieAttributes.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811
KDChartWidget.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 812
KDChartWidget.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 814
KDChartZoomParameters.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815
KDTextDocument.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 816
KDTextDocument.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817
Classes
• class AbstractArea
An area in the chart with a background, a frame, etc.
• class AbstractAreaBase
Base class for AbstractArea and AbstractAreaWidget: An area in the chart with a background, a frame, etc.
• class AbstractAreaWidget
An area in the chart with a background, a frame, etc.
• class AbstractAxis
The base class for axes.
• class AbstractCartesianDiagram
Base class for diagrams based on a cartesian coordianate system.
• class AbstractCoordinatePlane
• class AbstractDiagram
AbstractDiagram defines the interface for diagram classes.
• class AbstractLayoutItem
• class AbstractPieDiagram
• class AbstractPolarDiagram
• class AbstractProxyModel
• class AbstractThreeDAttributes
• class AttributesModel
• class BackgroundAttributes
• class BarAttributes
• class BarDiagram
• class CartesianAxis
The class for cartesian axes.
• class CartesianCoordinatePlane
• class Chart
A chart with one or more diagrams.
• class DataDimension
Helper class for one dimension of data, e.g. for the rows in a data model, or for the labels of an axis, or for
the vertical lines in a grid.
• class DatasetProxyModel
DatasetProxyModel takes a KDChart dataset configuration and translates it into a filtering proxy model.
• class DatasetSelectorWidget
• class DataValueAttributes
Diagram attributes dealing with data value labels.
• class DiagramObserver
A DiagramObserver watches the associated diagram for changes and deletion and emits corresponsing
signals.
• class FrameAttributes
• class GridAttributes
• class HeaderFooter
• class HorizontalLineLayoutItem
• class Legend
Legend defines the interface for the legend drawing class.
• class LineAttributes
• class LineDiagram
• class MarkerAttributes
• class MarkerLayoutItem
• class Measure
• class PaintContext
• class Palette
A Palette is a set of brushes (or colors) to be used for painting data sets.
• class PieAttributes
• class PieDiagram
• class PolarCoordinatePlane
• class PolarDiagram
• class Position
Defines a position, using compass terminology.
• class RelativePosition
Defines relative position information: reference area, position in this area, horizontal / vertical padding,
and rotating.
• class RingDiagram
• class TextArea
A text area in the chart with a background, a frame, etc.
• class TextAttributes
A set of text attributes.
• class TextLayoutItem
• class ThreeDBarAttributes
• class ThreeDLineAttributes
• class ThreeDPieAttributes
• class VerticalLineLayoutItem
• class Widget
The KD Chart widget for usage without Model/View.
• class ZoomParameters
Typedefs
Enumerations
• enum DisplayRoles {
DatasetPenRole = 0x0A79EF95,
DatasetBrushRole,
DataValueLabelAttributesRole,
ThreeDAttributesRole,
LineAttributesRole,
ThreeDLineAttributesRole,
BarAttributesRole,
ThreeDBarAttributesRole,
PieAttributesRole,
ThreeDPieAttributesRole }
Enumeration values:
DatasetPenRole
DatasetBrushRole
DataValueLabelAttributesRole
ThreeDAttributesRole
LineAttributesRole
ThreeDLineAttributesRole
BarAttributesRole
ThreeDBarAttributesRole
PieAttributesRole
ThreeDPieAttributesRole
244 {
245 DatasetPenRole = 0x0A79EF95,
246 DatasetBrushRole,
247 DataValueLabelAttributesRole,
248 ThreeDAttributesRole,
249 LineAttributesRole,
250 ThreeDLineAttributesRole,
251 BarAttributesRole,
252 ThreeDBarAttributesRole,
253 PieAttributesRole,
254 ThreeDPieAttributesRole
255 };
Note:
This class inherits from AbstractAreaBase, AbstractLayoutItem, QObject. The reason for this tripple
inheritance is that neither AbstractAreaBase nor AbstractLayoutItem are QObject.
• void removeFromParentLayout ()
• void setBackgroundAttributes (const BackgroundAttributes &a)
• void setFrameAttributes (const FrameAttributes &a)
• void setParentLayout (QLayout ∗lay)
• virtual void setParentWidget (QWidget ∗widget)
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
• virtual ∼AbstractArea ()
Protected Attributes
• Q_SIGNALS __pad0__: void positionChanged( AbstractArea ∗ )
• QWidget ∗ mParent
• QLayout ∗ mParentLayout
61 {
62 // this bloc left empty intentionally
63 }
53 : QObject()
54 , KDChart::AbstractAreaBase()
55 , KDChart::AbstractLayoutItem()
56 {
57 // this bloc left empty intentionally
58 }
76 {
77 Q_UNUSED( position );
78 // PENDING(kalle) FIXME
79 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosi
80 }
Implements KDChart::AbstractAreaBase.
Definition at line 105 of file KDChartAbstractArea.cpp.
Referenced by KDChart::CartesianCoordinatePlane::drawingArea(), KDChart::PolarCoordinate-
Plane::layoutDiagrams(), KDChart::CartesianAxis::paint(), paintAll(), and KDChart::Cartesian-
Axis::paintCtx().
106 {
107 return geometry();
108 }
98 {
99 return d->backgroundAttributes;
100 }
88 {
89 return d->frameAttributes;
90 }
176 {
177 Q_ASSERT_X ( d != 0, "AbstractAreaBase::innerRect()",
178 "Private class was not initialized!" );
179
180 const int padding
181 = d->frameAttributes.isVisible()
182 ? qMax( d->frameAttributes.padding(), 0 ) : 0;
183 return
184 QRect( QPoint(0,0), areaGeometry().size() )
185 .adjusted( padding, padding, -padding, -padding );
186 }
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked
automatically.
Definition at line 83 of file KDChartAbstractArea.cpp.
References areaGeometry(), KDChart::AbstractAreaBase::innerRect(), KDChart::AbstractLayout-
Item::paint(), KDChart::AbstractAreaBase::paintBackground(), and KDChart::AbstractAreaBase::paint-
Frame().
Referenced by KDChart::Chart::paint(), and paintIntoRect().
84 {
85 // Paint the background and frame
86 paintBackground( painter, geometry() );
87 paintFrame( painter, geometry() );
88
89 // temporarily adjust the widget size, to be sure all content gets calculated
90 // to fit into the inner rectangle
91 const QRect oldGeometry( areaGeometry() );
92 QRect inner( innerRect() );
93 inner.moveTo(
94 oldGeometry.left() + inner.left(),
95 oldGeometry.top() + inner.top() );
96 const bool needAdjustGeometry = oldGeometry != inner;
97 if( needAdjustGeometry )
98 setGeometry( inner );
99 paint( &painter );
100 if( needAdjustGeometry )
101 setGeometry( oldGeometry );
6.1.3.8 void AbstractAreaBase::paintBackground (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
104 {
105 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
106 "Private class was not initialized!" );
107
108 #define attributes d->backgroundAttributes
109
110 if( !attributes.isVisible() ) return;
111
112 /* first draw the brush (may contain a pixmap)*/
113 if( Qt::NoBrush != attributes.brush().style() ) {
114 KDChart::PainterSaver painterSaver( &painter );
115 painter.setPen( Qt::NoPen );
116 const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
117 painter.setBrushOrigin( newTopLeft );
118 painter.setBrush( attributes.brush() );
119 painter.drawRect( rect );
120 }
121 /* next draw the backPixmap over the brush */
122 if( !attributes.pixmap().isNull() &&
123 attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) {
124 QPointF ol = rect.topLeft();
125 if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() )
126 {
127 ol.setX( rect.center().x() - attributes.pixmap().width() / 2 );
128 ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 );
129 painter.drawPixmap( ol, attributes.pixmap() );
130 } else {
131 QMatrix m;
132 double zW = (double)rect.width() / (double)attributes.pixmap().width();
133 double zH = (double)rect.height() / (double)attributes.pixmap().height();
134 switch( attributes.pixmapMode() ) {
135 case BackgroundAttributes::BackgroundPixmapModeScaled:
136 {
137 double z;
138 z = qMin( zW, zH );
139 m.scale( z, z );
140 }
141 break;
142 case BackgroundAttributes::BackgroundPixmapModeStretched:
143 m.scale( zW, zH );
144 break;
145 default:
146 ; // Cannot happen, previously checked
147 }
148 QPixmap pm = attributes.pixmap().transformed( m );
149 ol.setX( rect.center().x() - pm.width() / 2 );
150 ol.setY( rect.center().y() - pm.height()/ 2 );
151 painter.drawPixmap( ol, pm );
152 }
153 }
154 #undef attributes
155 }
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
6.1.3.10 void AbstractAreaBase::paintFrame (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
159 {
160 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
161 "Private class was not initialized!" );
162
163 #define attributes d->frameAttributes
164
165 if( !attributes.isVisible() ) return;
166
167 const QPen oldPen( painter.pen() );
168 painter.setPen( attributes.pen() );
169 painter.drawRect( rect );
170 painter.setPen( oldPen );
171 #undef attributes
172 }
6.1.3.11 void AbstractArea::paintIntoRect (QPainter & painter, const QRect & rect)
[virtual]
72 {
73 const QRect oldGeometry( geometry() );
74 if( oldGeometry != rect )
75 setGeometry( rect );
76 painter.translate( rect.left(), rect.top() );
77 paintAll( painter );
78 painter.translate( -rect.left(), -rect.top() );
111 {
112 emit positionChanged( this );
113 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
93 {
94 d->backgroundAttributes = a;
95 }
83 {
84 d->frameAttributes = a;
85 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
Reimplemented in KDChart::AbstractCoordinatePlane.
Definition at line 86 of file KDChartAbstractArea.h.
• KDChartAbstractArea.h
• KDChartAbstractArea.cpp
Base class for AbstractArea and AbstractAreaWidget: An area in the chart with a background, a frame, etc.
AbstractAreaBase is the base class for all chart elements that have a set of background attributes and frame
attributes, such as legends or axes.
Note:
Normally you should not use AbstractAreaBase directly, but derive your classes from AbstractArea or
AbstractAreaWidget.
This classis not a QObject, so it is easier to inherit from it, if your are inheriting from a QObject too
like AbstractAreaWidget does it.
See also:
AbstractArea, AbstractAreaWidget
57 :
58 _d( new Private() )
59 {
60 }
63 {
64 delete _d; _d = 0;
65 }
76 {
77 Q_UNUSED( position );
78 // PENDING(kalle) FIXME
79 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosi
80 }
98 {
99 return d->backgroundAttributes;
100 }
88 {
89 return d->frameAttributes;
90 }
176 {
177 Q_ASSERT_X ( d != 0, "AbstractAreaBase::innerRect()",
178 "Private class was not initialized!" );
179
180 const int padding
181 = d->frameAttributes.isVisible()
182 ? qMax( d->frameAttributes.padding(), 0 ) : 0;
183 return
184 QRect( QPoint(0,0), areaGeometry().size() )
185 .adjusted( padding, padding, -padding, -padding );
186 }
6.2.3.6 void AbstractAreaBase::paintBackground (QPainter & painter, const QRect & rectangle)
[virtual]
104 {
105 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
106 "Private class was not initialized!" );
107
108 #define attributes d->backgroundAttributes
109
110 if( !attributes.isVisible() ) return;
111
112 /* first draw the brush (may contain a pixmap)*/
113 if( Qt::NoBrush != attributes.brush().style() ) {
114 KDChart::PainterSaver painterSaver( &painter );
115 painter.setPen( Qt::NoPen );
116 const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
117 painter.setBrushOrigin( newTopLeft );
118 painter.setBrush( attributes.brush() );
119 painter.drawRect( rect );
120 }
121 /* next draw the backPixmap over the brush */
122 if( !attributes.pixmap().isNull() &&
123 attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) {
124 QPointF ol = rect.topLeft();
125 if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() )
126 {
127 ol.setX( rect.center().x() - attributes.pixmap().width() / 2 );
128 ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 );
129 painter.drawPixmap( ol, attributes.pixmap() );
130 } else {
131 QMatrix m;
132 double zW = (double)rect.width() / (double)attributes.pixmap().width();
133 double zH = (double)rect.height() / (double)attributes.pixmap().height();
134 switch( attributes.pixmapMode() ) {
135 case BackgroundAttributes::BackgroundPixmapModeScaled:
136 {
137 double z;
138 z = qMin( zW, zH );
139 m.scale( z, z );
140 }
141 break;
142 case BackgroundAttributes::BackgroundPixmapModeStretched:
143 m.scale( zW, zH );
144 break;
145 default:
146 ; // Cannot happen, previously checked
147 }
148 QPixmap pm = attributes.pixmap().transformed( m );
149 ol.setX( rect.center().x() - pm.width() / 2 );
150 ol.setY( rect.center().y() - pm.height()/ 2 );
151 painter.drawPixmap( ol, pm );
152 }
153 }
154 #undef attributes
155 }
6.2.3.7 void AbstractAreaBase::paintFrame (QPainter & painter, const QRect & rectangle)
[virtual]
159 {
160 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
161 "Private class was not initialized!" );
162
163 #define attributes d->frameAttributes
164
165 if( !attributes.isVisible() ) return;
166
167 const QPen oldPen( painter.pen() );
168 painter.setPen( attributes.pen() );
169 painter.drawRect( rect );
170 painter.setPen( oldPen );
171 #undef attributes
172 }
189 {
190 // this bloc left empty intentionally
191 }
References d.
93 {
94 d->backgroundAttributes = a;
95 }
83 {
84 d->frameAttributes = a;
85 }
The documentation for this class was generated from the following files:
• KDChartAbstractAreaBase.h
• KDChartAbstractAreaBase.cpp
Public Attributes
• Q_SIGNALS __pad0__: void positionChanged( AbstractAreaWidget ∗ )
47 : QWidget( parent )
48 , AbstractAreaBase( new Private() )
49 {
50 init();
51 }
54 {
55 // this bloc left empty intentionally
56 }
76 {
77 Q_UNUSED( position );
78 // PENDING(kalle) FIXME
79 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosi
80 }
Implements KDChart::AbstractAreaBase.
Definition at line 116 of file KDChartAbstractAreaWidget.cpp.
Referenced by KDChart::Legend::buildLegend(), KDChart::Legend::paint(), and paintAll().
117 {
118 return geometry();
119 }
98 {
99 return d->backgroundAttributes;
100 }
Reimplemented in KDChart::Legend.
Definition at line 84 of file KDChartAbstractAreaWidget.cpp.
85 {
86 //bloc left empty intentionally
87 }
88 {
89 return d->frameAttributes;
90 }
176 {
177 Q_ASSERT_X ( d != 0, "AbstractAreaBase::innerRect()",
178 "Private class was not initialized!" );
179
180 const int padding
181 = d->frameAttributes.isVisible()
182 ? qMax( d->frameAttributes.padding(), 0 ) : 0;
183 return
184 QRect( QPoint(0,0), areaGeometry().size() )
185 .adjusted( padding, padding, -padding, -padding );
186 }
Note:
When overriding this method, please let your widget draw itself at the top/left corner of the painter.
You should call rect() (or width(), height(), resp.) to find the drawable area’s size: While the paint()
method is being executed the frame of the widget is outside of its rect(), so you can use all of rect() for
your custom drawing!
See also:
paint, paintIntoRect
Implemented in KDChart::Legend.
Referenced by paintAll().
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked
automatically.
Definition at line 89 of file KDChartAbstractAreaWidget.cpp.
References areaGeometry(), KDChart::AbstractAreaBase::innerRect(), paint(), KDChart::AbstractArea-
Base::paintBackground(), and KDChart::AbstractAreaBase::paintFrame().
Referenced by paintEvent(), and paintIntoRect().
90 {
91 //qDebug() << "AbstractAreaWidget::paintAll() called";
92 // Paint the background and frame
93 paintBackground( painter, rect() );
94 paintFrame( painter, rect().adjusted(0,0,-1,-1) );
95
96 // adjust the widget’s content margins,
97 // to be sure all content gets calculated
98 // to fit into the inner rectangle
99 const QRect oldGeometry( areaGeometry() );
100 const QRect inner( innerRect() );
101 //qDebug() << "areaGeometry():" << oldGeometry
102 // << " contentsRect():" << contentsRect() << " inner:" << inner;
103 if( contentsRect() != inner ){
104 //qDebug() << "old contentsRect():" << contentsRect() << " new innerRect:" << inner;
105 setContentsMargins(
106 inner.left(),
107 inner.top(),
108 oldGeometry.width() -inner.width()-1,
109 oldGeometry.height()-inner.height()-1 );
110 //forceRebuild();
111 }
112 paint( &painter );
113 //qDebug() << "AbstractAreaWidget::paintAll() done.";
114 }
6.3.3.9 void AbstractAreaBase::paintBackground (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
104 {
105 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
106 "Private class was not initialized!" );
107
108 #define attributes d->backgroundAttributes
109
110 if( !attributes.isVisible() ) return;
111
112 /* first draw the brush (may contain a pixmap)*/
113 if( Qt::NoBrush != attributes.brush().style() ) {
114 KDChart::PainterSaver painterSaver( &painter );
See also:
paint
66 {
67 Q_UNUSED( event );
68 QPainter painter( this );
69 paintAll( painter );
70 }
6.3.3.11 void AbstractAreaBase::paintFrame (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
159 {
160 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
161 "Private class was not initialized!" );
162
163 #define attributes d->frameAttributes
164
165 if( !attributes.isVisible() ) return;
166
167 const QPen oldPen( painter.pen() );
168 painter.setPen( attributes.pen() );
169 painter.drawRect( rect );
170 painter.setPen( oldPen );
171 #undef attributes
172 }
6.3.3.12 void AbstractAreaWidget::paintIntoRect (QPainter & painter, const QRect & rect)
[virtual]
73 {
74 const QRect oldGeometry( geometry() );
75 if( oldGeometry != rect )
76 setGeometry( rect );
77 painter.translate( rect.left(), rect.top() );
78 paintAll( painter );
79 painter.translate( -rect.left(), -rect.top() );
80 if( oldGeometry != rect )
81 setGeometry( oldGeometry );
82 }
122 {
123 emit positionChanged( this );
124 }
93 {
94 d->backgroundAttributes = a;
95 }
83 {
84 d->frameAttributes = a;
85 }
Reimplemented in KDChart::Legend.
Definition at line 108 of file KDChartAbstractAreaWidget.h.
The documentation for this class was generated from the following files:
• KDChartAbstractAreaWidget.h
• KDChartAbstractAreaWidget.cpp
See also:
PolarAxis, AbstractCartesianDiagram
• void removeFromParentLayout ()
• void setBackgroundAttributes (const BackgroundAttributes &a)
• void setFrameAttributes (const FrameAttributes &a)
• virtual void setGeometry (const QRect &rect)=0
• void setLabels (const QStringList &list)
Use this to specify your own set of strings, to be used as axis labels.
• virtual ∼AbstractAxis ()
Public Attributes
Protected Attributes
122 {
123 d->mDiagram = 0;
124 d->secondaryDiagrams.clear();
125 }
76 {
77 Q_UNUSED( position );
78 // PENDING(kalle) FIXME
79 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosi
80 }
Implements KDChart::AbstractAreaBase.
Definition at line 105 of file KDChartAbstractArea.cpp.
Referenced by KDChart::CartesianCoordinatePlane::drawingArea(), KDChart::PolarCoordinate-
Plane::layoutDiagrams(), KDChart::CartesianAxis::paint(), KDChart::AbstractArea::paintAll(), and
KDChart::CartesianAxis::paintCtx().
106 {
107 return geometry();
108 }
98 {
99 return d->backgroundAttributes;
100 }
See also:
AbstractCartesianDiagram::addAxis()
193 {
194 if( d->observer ){
195 connect( d->observer, SIGNAL( diagramDataChanged( AbstractDiagram *) ),
196 this, SLOT( update() ) );
197 }
198 }
Convenience function, returns the coordinate plane, in which this axis is used.
If the axis is not used in a coordinate plane, the return value is Zero.
Definition at line 293 of file KDChartAbstractAxis.cpp.
References d.
294 {
295 if( d->diagram() )
296 return d->diagram()->coordinatePlane();
297 return 0;
298 }
159 {
160 if( d->setDiagram( diagram, this ) )
161 connectSignals();
162 }
175 {
176 d->unsetDiagram( diagram, this );
177 }
301 {
302 return d->diagram();
303 }
88 {
89 return d->frameAttributes;
90 }
Implemented in KDChart::CartesianAxis.
176 {
177 Q_ASSERT_X ( d != 0, "AbstractAreaBase::innerRect()",
178 "Private class was not initialized!" );
179
180 const int padding
181 = d->frameAttributes.isVisible()
182 ? qMax( d->frameAttributes.padding(), 0 ) : 0;
183 return
184 QRect( QPoint(0,0), areaGeometry().size() )
185 .adjusted( padding, padding, -padding, -padding );
186 }
Returns a list of strings, that are used as axis labels, as set via setLabels.
See also:
setLabels
255 {
256 return d->hardLabels;
257 }
306 {
307 return d->hasDiagram( diagram );
308 }
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked
automatically.
Definition at line 83 of file KDChartAbstractArea.cpp.
References KDChart::AbstractArea::areaGeometry(), KDChart::AbstractAreaBase::innerRect(),
KDChart::AbstractLayoutItem::paint(), KDChart::AbstractAreaBase::paintBackground(), and
KDChart::AbstractAreaBase::paintFrame().
Referenced by KDChart::Chart::paint(), and KDChart::AbstractArea::paintIntoRect().
84 {
85 // Paint the background and frame
86 paintBackground( painter, geometry() );
87 paintFrame( painter, geometry() );
88
89 // temporarily adjust the widget size, to be sure all content gets calculated
90 // to fit into the inner rectangle
91 const QRect oldGeometry( areaGeometry() );
92 QRect inner( innerRect() );
93 inner.moveTo(
94 oldGeometry.left() + inner.left(),
95 oldGeometry.top() + inner.top() );
96 const bool needAdjustGeometry = oldGeometry != inner;
97 if( needAdjustGeometry )
98 setGeometry( inner );
99 paint( &painter );
100 if( needAdjustGeometry )
101 setGeometry( oldGeometry );
102 //qDebug() << "AbstractAreaWidget::paintAll() done.";
103 }
6.4.3.16 void AbstractAreaBase::paintBackground (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
104 {
105 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
106 "Private class was not initialized!" );
107
108 #define attributes d->backgroundAttributes
109
110 if( !attributes.isVisible() ) return;
111
112 /* first draw the brush (may contain a pixmap)*/
113 if( Qt::NoBrush != attributes.brush().style() ) {
114 KDChart::PainterSaver painterSaver( &painter );
115 painter.setPen( Qt::NoPen );
116 const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
117 painter.setBrushOrigin( newTopLeft );
118 painter.setBrush( attributes.brush() );
119 painter.drawRect( rect );
120 }
121 /* next draw the backPixmap over the brush */
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
6.4.3.18 void AbstractAreaBase::paintFrame (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
159 {
160 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
161 "Private class was not initialized!" );
162
163 #define attributes d->frameAttributes
164
165 if( !attributes.isVisible() ) return;
166
167 const QPen oldPen( painter.pen() );
168 painter.setPen( attributes.pen() );
169 painter.drawRect( rect );
170 painter.setPen( oldPen );
171 #undef attributes
172 }
6.4.3.19 void AbstractArea::paintIntoRect (QPainter & painter, const QRect & rect)
[virtual, inherited]
72 {
73 const QRect oldGeometry( geometry() );
74 if( oldGeometry != rect )
75 setGeometry( rect );
76 painter.translate( rect.left(), rect.top() );
77 paintAll( painter );
78 painter.translate( -rect.left(), -rect.top() );
79 if( oldGeometry != rect )
80 setGeometry( oldGeometry );
81 }
111 {
112 emit positionChanged( this );
113 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
93 {
94 d->backgroundAttributes = a;
95 }
83 {
84 d->frameAttributes = a;
85 }
Implemented in KDChart::CartesianAxis.
Use this to specify your own set of strings, to be used as axis labels.
Labels specified via setLabels take precedence: If a non-empty list is passed, KD Chart will use these
strings as axis labels, instead of calculating them.
If you a smaller number of strings than the number od labels drawn at this axis, KD Chart will iterate over
the list, repeating the strings, until all labels are drawn. As an example you could specify the seven days of
the week as abscissa labels, which would be repeatedly used then.
By passing an empty QStringList you can reset the default behaviour.
See also:
labels, setShortLabels
245 {
246 d->hardLabels = list;
247 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
Use this to specify your own set of strings, to be used as axis labels, in case the normal labels are too long.
Note:
Setting done via setShortLabels will be ignored, if you did not pass a non-empty string list via set-
Labels too!
See also:
shortLabels, setLabels
271 {
272 d->hardShortLabels = list;
273 }
Use this to specify the text attributes to be used for axis labels.
By default, the reference area will be set at painting time. It will be the then-valid coordinate plane’s
parent widget, so normally, it will be the KDChart::Chart. Thus the labels of all of your axes in all of your
diagrams within that Chart will be drawn in same font size, by default.
See also:
textAttributes, setLabels
213 {
214 d->textAttributes = a;
215 }
Returns a list of strings, that are used as axis labels, as set via setShortLabels.
Note:
Setting done via setShortLabels will be ignored, if you did not pass a non-empty string list via set-
Labels too!
See also:
setShortLabels
284 {
285 return d->hardShortLabels;
286 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
See also:
setTextAttributes
223 {
224 return d->textAttributes;
225 }
Reimplemented in KDChart::AbstractCoordinatePlane.
Definition at line 86 of file KDChartAbstractArea.h.
• KDChartAbstractAxis.h
• KDChartAbstractAxis.cpp
The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to
have.
• void useRainbowColors ()
Set the palette to be used, for painting datasets to the rainbow palette.
• void useSubduedColors ()
Set the palette to be used, for painting datasets to the subdued palette.
• virtual ∼AbstractCartesianDiagram ()
Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context.
• void paintDataValueText (QPainter ∗painter, const QModelIndex &index, const QPointF &pos, dou-
ble value)
• virtual void paintDataValueTexts (QPainter ∗painter)
• void paintMarker (QPainter ∗painter, const QModelIndex &index, const QPointF &pos)
• virtual void paintMarkers (QPainter ∗painter)
• void propertiesChanged ()
Emitted upon change of a property of the Diagram.
Protected Attributes
• Q_SIGNALS __pad0__: void layoutChanged( AbstractDiagram∗ )
59 {
60 Q_FOREACH( CartesianAxis* axis, d->axesList ) {
61 axis->deleteObserver( this );
62 }
63 d->axesList.clear();
64 }
The diagram takes ownership of the axis and will delete it.
To gain back ownership (e.g. for assigning the axis to another diagram) use the takeAxis method, before
calling addAxis on the other diagram.
See also:
takeAxis
67 {
68 if ( !d->axesList.contains( axis ) ) {
69 d->axesList.append( axis );
70 axis->createObserver( this );
71 layoutPlanes();
72 }
73 }
Returns:
Whether data value labels are allowed to overlap.
295 {
Returns:
Whether anti-aliasing is to be used for rendering this diagram.
306 {
Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel
181 {
182 return d->attributesModel;
183 }
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram.
Definition at line 204 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::LineDiagram::calculateDataBoundaries(), KDChart::BarDiagram::calculate-
DataBoundaries(), KDChart::LineDiagram::numberOfAbscissaSegments(), KDChart::Bar-
Diagram::numberOfAbscissaSegments(), KDChart::LineDiagram::numberOfOrdinateSegments(),
KDChart::BarDiagram::numberOfOrdinateSegments(), KDChart::LineDiagram::paint(), KDChart::Bar-
Diagram::paint(), and KDChart::AbstractDiagram::valueForCell().
210 {
86 {
87 return d->axesList;
88 }
Retrieve the brush to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The brush to use for painting.
638 :
QRect AbstractDiagram::visualRect(const QModelIndex &) const
Parameters:
dataset The dataset to retrieve the brush for.
Returns:
The brush to use for painting.
631 {
Returns:
The brush to use for painting.
623 {
746 {
747 Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
748 "There is no usable model set, for the diagram." );
749
750 Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
751 "There is no usable coordinate plane set, for the diagram." );
752 }
753 return model() && coordinatePlane();
754 }
755
756 int AbstractDiagram::datasetDimension( ) const
217 {
Returns:
The coordinate plane associated with the diagram.
126 {
127 return d->plane;
128 }
Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these
values).
This method returns a chached result of calculations done by calculateDataBoundaries. Classes derived
from AbstractDiagram must implement the calculateDataBoundaries function, to specify their own way of
calculating the data boundaries. If derived classes want to force recalculation of the data boundaries, they
can call setDataBoundariesDirty()
Returned value is in diagram coordinates.
131 {
132 if( d->databoundariesDirty ){
133 d->databoundaries = calculateDataBoundaries ();
134 d->databoundariesDirty = false;
135 }
136 return d->databoundaries;
137 }
[reimplemented]
Definition at line 232 of file KDChartAbstractDiagram.cpp.
References d.
232 {
233 // We are still too dumb to do intelligent updates...
234 d->databoundariesDirty = true;
235 scheduleDelayedItemsLayout();
236 }
237
238 void AbstractDiagram::setDataValueAttributes( const QModelIndex & index,
The set of dataset brushes currently used, for use in legends, etc.
Note:
Cell-level override brushes, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the brush, that is used for a single cell.
Returns:
The current set of dataset brushes.
712 {
713 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( i, Qt::Vertical, DatasetB
714 ret << brush;
715 }
716
717 return ret;
718 }
719
720 QList<QPen> AbstractDiagram::datasetPens() const
The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to
have.
For each dimension it will expect one column of values in the model. If the dimensionality is 1, automatic
values will be used for the abscissa.
For example a diagram with the default dimension of 1, will have one column per datapoint (the y values)
and will use automatic values for the x axis (1, 2, 3, ... n). If the dimension is 2, the diagram will use the
first, (and the third, fifth, etc) columns as X values, and the second, (and the fourth, sixth, etc) column as Y
values.
Returns:
The dataset dimension of the diagram.
762 {
The set of dataset labels currently displayed, for use in legends, etc.
Returns:
The set of dataset labels currently displayed.
The set of dataset markers currently used, for use in legends, etc.
Note:
Cell-level override markers, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the marker, that is shown for a single cell.
Returns:
The current set of dataset brushes.
735 {
736 DataValueAttributes a =
737 qVariantValue<DataValueAttributes>( attributesModel()->headerData( i, Qt::Vertical, DataVa
738 const MarkerAttributes &ma = a.markerAttributes();
739 ret << ma;
740 }
741 return ret;
742 }
743
744 bool AbstractDiagram::checkInvariants( bool justReturnTheStatus ) const
The set of dataset pens currently used, for use in legends, etc.
Note:
Cell-level override pens, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the pens, that is used for a single cell.
Returns:
The current set of dataset pens.
724 {
725 QPen pen = qVariantValue<QPen>( attributesModel()->headerData( i, Qt::Vertical, DatasetPenRole
726 ret << pen;
727 }
728 return ret;
729 }
730
731 QList<MarkerAttributes> AbstractDiagram::datasetMarkers() const
Parameters:
index The datapoint to retrieve the attributes for.
Returns:
The DataValueAttributes for the given index.
278 {
Parameters:
dataset The dataset to retrieve the attributes for.
Returns:
The DataValueAttributes for the given dataset.
271 {
Returns:
The global DataValueAttributes.
264 {
[reimplemented]
Definition at line 223 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::update().
223 {
224 d->plane->layoutDiagrams();
225 update();
226 }
227 QAbstractItemView::doItemsLayout();
228 }
229
230 void AbstractDiagram::dataChanged( const QModelIndex &topLeft,
[reimplemented]
Definition at line 655 of file KDChartAbstractDiagram.cpp.
657 { return 0; }
[reimplemented]
Definition at line 649 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 661 of file KDChartAbstractDiagram.cpp.
663 {}
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Returns:
The set of item row labels currently displayed.
91 {
92 //qDebug() << "KDChart::AbstractCartesianDiagram::layoutPlanes()";
93 AbstractCoordinatePlane* plane = coordinatePlane();
94 if( plane ){
95 plane->layoutPlanes();
96 //qDebug() << "KDChart::AbstractCartesianDiagram::layoutPlanes() OK";
97 }
98 }
This signal is emitted, when either the model or the AttributesModel is replaced.
Referenced by KDChart::AbstractDiagram::setAttributesModel(), and KDChart::AbstractDiagram::set-
Model().
[reimplemented]
Definition at line 652 of file KDChartAbstractDiagram.cpp.
654 { return 0; }
Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context.
Parameters:
paintContext All information needed for painting.
320 {
321 // paint one data series
322 DataValueAttributes a = dataValueAttributes(index);
323 if ( !a.isVisible() ) return;
324
325 // handle decimal digits
326 int decimalDigits = a.decimalDigits();
327 int decimalPos = QString::number( value ).indexOf( QLatin1Char( ’.’ ) );
328 QString roundedValue;
329 if ( a.dataLabel().isNull() ) {
330 if ( decimalPos > 0 && value != 0 )
331 roundedValue = roundValues ( value, decimalPos, decimalDigits );
332 else
333 roundedValue = QString::number( value );
334 } else
335 roundedValue = a.dataLabel();
336 // handle prefix and suffix
337 if ( !a.prefix().isNull() )
338 roundedValue.prepend( a.prefix() );
339
340 if ( !a.suffix().isNull() )
341 roundedValue.append( a.suffix() );
342
343 PainterSaver painterSaver( painter );
344 // FIXME draw the non-text bits, background, etc
345 const TextAttributes &ta = a.textAttributes();
346 if ( ta.isVisible() ) {
347 painter->setPen( ta.pen() );
348 painter->setFont( ta.font() );
349 painter->translate( pos );
350 painter->rotate( ta.rotation() );
351 painter->drawText( QPointF(0, 0), roundedValue );
352 }
353 }
354
355 QString AbstractDiagram::roundValues( double value,
385 {
386 for ( int j=0; j< rowCount; ++j ) {
387 const QModelIndex index = model()->index( j, i, rootIndex() );
388 double value = model()->data( index ).toDouble();
389 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
390 paintDataValueText( painter, index, pos, value );
391 }
392 }
393 }
394
395
399 {
400
401 if ( !checkInvariants() ) return;
402 DataValueAttributes a = dataValueAttributes(index);
403 if ( !a.isVisible() ) return;
404 const MarkerAttributes &ma = a.markerAttributes();
405 if ( !ma.isVisible() ) return;
406
407 PainterSaver painterSaver( painter );
408 QSizeF maSize( ma.markerSize() );
409 QBrush indexBrush( brush( index ) );
410 QPen indexPen( ma.pen() );
411 if ( ma.markerColor().isValid() )
412 indexBrush.setColor( ma.markerColor() );
413
414 paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
415 }
416
417
424 {
425 PainterSaver painterSaver( painter );
426 painter->setBrush( brush );
427 painter->setPen( pen );
428 painter->setRenderHint ( QPainter::Antialiasing );
429 painter->translate( pos );
430 switch ( markerAttributes.markerStyle() ) {
431 case MarkerAttributes::MarkerCircle:
432 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
433 maSize.height(), maSize.width()) );
434 break;
435 case MarkerAttributes::MarkerSquare:
436 {
437 QRectF rect( 0 - maSize.height()/2, 0 - maSize.width()/2,
438 maSize.height(), maSize.width() );
439 painter->drawRect( rect );
440 painter->fillRect( rect, painter->brush() );
441 break;
442 }
535 {
536 for ( int j=0; j< rowCount; ++j ) {
537 const QModelIndex index = model()->index( j, i, rootIndex() );
538 double value = model()->data( index ).toDouble();
539 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
540 paintMarker( painter, index, pos );
541 }
542 }
543 }
544
545
Retrieve the pen to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The pen to use for painting.
593 {
Parameters:
dataset The dataset to retrieve the pen for.
Returns:
The pen to use for painting.
585 {
Returns:
The pen to use for painting.
577 {
320 {
124 {
125 return d->referenceDiagram;
126 }
129 {
130 return d->referenceDiagramOffset;
131 }
Parameters:
area
[reimplemented]
Definition at line 646 of file KDChartAbstractDiagram.cpp.
Parameters:
allow True means that overlapping labels are allowed.
290 {
Parameters:
enabled True means that AA is enabled.
301 {
Wrong:
diagram1->setAttributesModel( diagram2->attributesModel() );
Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel
161 {
162 if( amodel->sourceModel() != model() ) {
163 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
164 "Trying to set an attributesmodel which works on a different "
165 "model than the diagram.");
166 return;
167 }
168 if( qobject_cast<PrivateAttributesModel*>(amodel) ) {
169 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
170 "Trying to set an attributesmodel that is private to another diagram.");
171 return;
172 }
173 d->setAttributesModel(amodel);
174 scheduleDelayedItemsLayout();
175 d->databoundariesDirty = true;
176 emit modelsChanged();
177 }
Set the brush to be used, for painting all datasets in the model.
Parameters:
brush The brush to use.
608 {
6.5.3.54 void AbstractDiagram::setBrush (int dataset, const QBrush & brush) [inherited]
Parameters:
dataset The dataset’s column in the model.
pen The brush to use.
617 {
6.5.3.55 void AbstractDiagram::setBrush (const QModelIndex & index, const QBrush & brush)
[inherited]
Set the brush to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
brush The brush to use.
601 {
Returns:
The coordinate plane associated with the diagram.
101 {
102 if( coordinatePlane() ) disconnect( coordinatePlane() );
103 AbstractDiagram::setCoordinatePlane(plane);
104
105 // show the axes, after all have been adjusted
106 // (because they might be dependend on each other)
107 /*
108 if( plane )
109 Q_FOREACH( CartesianAxis* axis, d->axesList )
110 axis->show();
111 else
112 Q_FOREACH( CartesianAxis* axis, d->axesList )
113 axis->hide();
114 */
115 }
140 {
141 d->databoundariesDirty = true;
142 }
See also:
datasetDimension.
Parameters:
dimension
770 {
Parameters:
a The attributes to set.
284 {
Parameters:
dataset The dataset to set the attributes for.
a The attributes to set.
259 {
Parameters:
index The datapoint to set the attributes for.
a The attributes to set.
240 {
241 d->attributesModel->setData(
242 d->attributesModel->mapFromSource( index ),
243 qVariantFromValue( a ),
244 DataValueLabelAttributesRole );
245 emit propertiesChanged();
246 }
247
248
145 {
146 QAbstractItemView::setModel( newModel );
147 AttributesModel* amodel = new PrivateAttributesModel( newModel, this );
148 amodel->initFrom( d->attributesModel );
149 d->setAttributesModel(amodel);
150 scheduleDelayedItemsLayout();
151 d->databoundariesDirty = true;
152 emit modelsChanged();
153 }
Set the pen to be used, for painting all datasets in the model.
Parameters:
pen The pen to use.
562 {
6.5.3.64 void AbstractDiagram::setPen (int dataset, const QPen & pen) [inherited]
Parameters:
dataset The dataset’s row in the model.
pen The pen to use.
571 {
6.5.3.65 void AbstractDiagram::setPen (const QModelIndex & index, const QPen & pen)
[inherited]
Set the pen to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
pen The pen to use.
555 {
312 {
118 {
119 d->referenceDiagram = diagram;
120 d->referenceDiagramOffset = offset;
121 }
Set the root index in the model, where the diagram starts referencing data for display.
[reimplemented]
Definition at line 188 of file KDChartAbstractDiagram.cpp.
References d.
[reimplemented]
Definition at line 664 of file KDChartAbstractDiagram.cpp.
See also:
addAxis
76 {
77 const int idx = d->axesList.indexOf( axis );
78 if( idx != -1 )
79 d->axesList.takeAt( idx );
80 axis->deleteObserver( this );
81 axis->setParentWidget( 0 );
82 layoutPlanes();
83 }
Set the palette to be used, for painting datasets to the default palette.
See also:
KDChart::Palette. FIXME: fold into one usePalette (KDChart::Palette&) method
675 {
Set the palette to be used, for painting datasets to the rainbow palette.
See also:
KDChart::Palette.
685 {
Set the palette to be used, for painting datasets to the subdued palette.
See also:
KDChart::Palette.
680 {
Helper method, retrieving the data value (DisplayRole) for a given row and column.
Parameters:
row The row to query.
column The column to query.
Returns:
The value of the display role at the given row and column as a double.
776 {
[reimplemented]
Definition at line 658 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 641 of file KDChartAbstractDiagram.cpp.
645 {}
[reimplemented]
Definition at line 667 of file KDChartAbstractDiagram.cpp.
• KDChartAbstractCartesianDiagram.h
• KDChartAbstractCartesianDiagram.cpp
Public Types
• enum AxesCalcMode {
Linear,
Logarithmic }
• void layoutPlanes ()
Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes().
• void needLayoutPlanes ()
Emitted when plane needs to trigger the Chart’s layouting of the coord.
• void needRelayout ()
Emitted when plane needs to trigger the Chart’s layouting.
• void needUpdate ()
Emitted when plane needs to update its drawings.
• void relayout ()
Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout().
• void removeFromParentLayout ()
• virtual void replaceDiagram (AbstractDiagram ∗diagram, AbstractDiagram ∗oldDiagram=0)
Replaces the old diagram, or appends the diagram, it there is none yet.
Public Attributes
• Q_SIGNALS __pad0__: void destroyedCoordinatePlane( AbstractCoordinatePlane∗ )
• public Q_SLOTS: void update()
Protected Attributes
• QWidget ∗ mParent
• QLayout ∗ mParentLayout
Enumeration values:
Linear
Logarithmic
55 { Linear, Logarithmic };
59 {
60 emit destroyedCoordinatePlane( this );
61 }
Parameters:
diagram The diagram to add.
See also:
replaceDiagram, takeDiagram
69 {
70 // diagrams are invisible and paint through their paint() method
71 diagram->hide();
72
73 d->diagrams.append( diagram );
74 diagram->setParent( d->parent );
75 diagram->setCoordinatePlane( this );
76 layoutDiagrams();
77 layoutPlanes(); // there might be new axes, etc
78 update();
79 }
76 {
77 Q_UNUSED( position );
78 // PENDING(kalle) FIXME
79 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosi
80 }
Implements KDChart::AbstractAreaBase.
Definition at line 105 of file KDChartAbstractArea.cpp.
Referenced by KDChart::CartesianCoordinatePlane::drawingArea(), KDChart::PolarCoordinate-
Plane::layoutDiagrams(), KDChart::CartesianAxis::paint(), KDChart::AbstractArea::paintAll(), and
KDChart::CartesianAxis::paintCtx().
106 {
107 return geometry();
108 }
98 {
99 return d->backgroundAttributes;
100 }
Returns:
The first diagram associated with this coordinate plane.
114 {
115 if ( d->diagrams.isEmpty() )
116 {
117 return 0;
118 } else {
119 return d->diagrams.first();
120 }
121 }
Returns:
The list of diagrams associated with this coordinate plane.
129 {
130 ConstAbstractDiagramList list;
131 #ifndef QT_NO_STL
132 qCopy( d->diagrams.begin(), d->diagrams.end(), std::back_inserter( list ) );
133 #else
134 Q_FOREACH( AbstractDiagram * a, d->diagrams )
135 list.push_back( a );
136 #endif
137 return list;
138 }
Returns:
The list of diagrams associated with this coordinate plane.
124 {
125 return d->diagrams;
126 }
201 {
202 return Qt::Vertical | Qt::Horizontal;
203 }
88 {
89 return d->frameAttributes;
90 }
238 {
239 return d->geometry;
240 }
Returns:
The grid attributes used by this coordinate plane.
See also:
setGlobalGridAttributes
CartesianCoordinatePlane::gridAttributes
158 {
159 return d->gridAttributes;
160 }
Note:
Returned list will contain different numbers of DataDimension, depending on the kind of coordinate
plane used. For CartesianCoordinatePlane two DataDimension are returned: the first representing
grid lines in X direction (matching the Abscissa axes) and the second indicating vertical grid lines (or
Ordinate axes, resp.).
Returns:
The dimensions used for drawing the grid lines.
See also:
DataDimension
163 {
164 return d->grid->updateData( this );
165 }
176 {
177 Q_ASSERT_X ( d != 0, "AbstractAreaBase::innerRect()",
194 {
195 return false; // never empty!
196 // coordinate planes with no associated diagrams
197 // are showing a default grid of ()1..10, 1..10) stepWidth 1
198 }
255 {
256 //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
257 emit needLayoutPlanes();
258 }
206 {
207 if( d->parent )
208 return d->parent->size();
209 // Note: At external layut calculation time the coord.plane *will*
210 // have a parent widget, so returning a default size here
211 // will not affect its real drawing size.
212 return QSize(1000, 1000);
213 }
216 {
217 return QSize(60, 60); // this default can be overwritten by derived classes
218 }
[reimplemented]
Definition at line 140 of file KDChartAbstractCoordinatePlane.cpp.
141 {
142 return QSize( 200, 200 );
143 }
Emitted when plane needs to trigger the Chart’s layouting of the coord.
planes.
Referenced by layoutPlanes().
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked
automatically.
Definition at line 83 of file KDChartAbstractArea.cpp.
References KDChart::AbstractArea::areaGeometry(), KDChart::AbstractAreaBase::innerRect(),
KDChart::AbstractLayoutItem::paint(), KDChart::AbstractAreaBase::paintBackground(), and
KDChart::AbstractAreaBase::paintFrame().
Referenced by KDChart::Chart::paint(), and KDChart::AbstractArea::paintIntoRect().
84 {
85 // Paint the background and frame
86 paintBackground( painter, geometry() );
87 paintFrame( painter, geometry() );
88
89 // temporarily adjust the widget size, to be sure all content gets calculated
90 // to fit into the inner rectangle
91 const QRect oldGeometry( areaGeometry() );
92 QRect inner( innerRect() );
93 inner.moveTo(
94 oldGeometry.left() + inner.left(),
95 oldGeometry.top() + inner.top() );
96 const bool needAdjustGeometry = oldGeometry != inner;
97 if( needAdjustGeometry )
98 setGeometry( inner );
99 paint( &painter );
100 if( needAdjustGeometry )
101 setGeometry( oldGeometry );
102 //qDebug() << "AbstractAreaWidget::paintAll() done.";
103 }
6.6.3.26 void AbstractAreaBase::paintBackground (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
104 {
105 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
106 "Private class was not initialized!" );
107
108 #define attributes d->backgroundAttributes
109
110 if( !attributes.isVisible() ) return;
111
112 /* first draw the brush (may contain a pixmap)*/
113 if( Qt::NoBrush != attributes.brush().style() ) {
114 KDChart::PainterSaver painterSaver( &painter );
115 painter.setPen( Qt::NoPen );
116 const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
117 painter.setBrushOrigin( newTopLeft );
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
6.6.3.28 void AbstractAreaBase::paintFrame (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
159 {
160 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
161 "Private class was not initialized!" );
162
163 #define attributes d->frameAttributes
164
165 if( !attributes.isVisible() ) return;
166
167 const QPen oldPen( painter.pen() );
168 painter.setPen( attributes.pen() );
169 painter.drawRect( rect );
170 painter.setPen( oldPen );
171 #undef attributes
172 }
6.6.3.29 void AbstractArea::paintIntoRect (QPainter & painter, const QRect & rect)
[virtual, inherited]
72 {
73 const QRect oldGeometry( geometry() );
74 if( oldGeometry != rect )
75 setGeometry( rect );
76 painter.translate( rect.left(), rect.top() );
77 paintAll( painter );
78 painter.translate( -rect.left(), -rect.top() );
79 if( oldGeometry != rect )
80 setGeometry( oldGeometry );
81 }
183 {
184 return d->parent;
185 }
188 {
189 return d->parent;
190 }
111 {
112 emit positionChanged( this );
113 }
Emitted upon change of a property of the Coordinate Plane or any of its components.
Referenced by KDChart::CartesianCoordinatePlane::addDiagram(), KDChart::Cartesian-
CoordinatePlane::setAxesCalcModes(), KDChart::CartesianCoordinatePlane::setAxesCalcModeX(),
KDChart::CartesianCoordinatePlane::setAxesCalcModeY(), KDChart::PolarCoordinatePlane::set-
GridAttributes(), KDChart::CartesianCoordinatePlane::setGridAttributes(), KDChart::Cartesian-
CoordinatePlane::setHorizontalRange(), KDChart::CartesianCoordinatePlane::setIsometricScaling(),
KDChart::CartesianCoordinatePlane::setVerticalRange(), KDChart::CartesianCoordinatePlane::setZoom-
Center(), KDChart::CartesianCoordinatePlane::setZoomFactorX(), and KDChart::CartesianCoordinate-
Plane::setZoomFactorY().
There are two ways, in which planes can be caused to interact, in where they are put layouting wise: The
first is the reference plane.
If such a reference plane is set, on a plane, it will use the same cell in the layout as that one. In addition
to this, planes can share an axis. In that case they will be layed out in relation to each other as suggested
by the position of the axis. If, for example Plane1 and Plane2 share an axis at position Left, that will result
in the layout: Axis Plane1 Plane 2, vertically. If Plane1 also happens to be Plane2’s reference plane, both
planes are drawn over each other. The reference plane concept allows two planes to share the same space
even if neither has any axis, and in case there are shared axis, it is used to decided, whether the planes
should be painted on top of each other or layed out vertically or horizontally next to each other.
Returns:
The reference coordinate plane associated with this one.
173 {
174 return d->referenceCoordinatePlane;
175 }
249 {
250 //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
251 emit needRelayout();
252 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
Replaces the old diagram, or appends the diagram, it there is none yet.
Parameters:
diagram The diagram to be used instead of the old diagram. This parameter must not be zero, or the
method will do nothing.
oldDiagram The diagram to be removed by the new diagram. This diagram will be deleted automat-
ically. If the parameter is omitted, the very first diagram will be replaced. In case, there was no
diagram yet, the new diagram will just be added.
Note:
If you want to re-use the old diagram, call takeDiagram and addDiagram, instead of using replace-
Diagram.
See also:
addDiagram, takeDiagram
83 {
84 if( diagram && oldDiagram_ != diagram ){
85 AbstractDiagram* oldDiagram = oldDiagram_;
86 if( d->diagrams.count() ){
87 if( ! oldDiagram )
88 oldDiagram = d->diagrams.first();
89 takeDiagram( oldDiagram );
90 }
91 delete oldDiagram;
92 addDiagram( diagram );
93 layoutDiagrams();
94 layoutPlanes(); // there might be new axes, etc
95 update();
96 }
97 }
93 {
94 d->backgroundAttributes = a;
95 }
83 {
84 d->frameAttributes = a;
85 }
Note:
Do not call this function directly, unless you know exactly what you are doing. Geometry management
is done by KD Chart’s internal layouting measures.
228 {
229 // qDebug() << "KDChart::AbstractCoordinatePlane::setGeometry(" << r << ") called";
230 if( d->geometry != r ){
231 d->geometry = r;
232 // Note: We do *not* call update() here
233 // because it would invoke KDChart::update() recursively.
234 }
235 }
GridAttributes ga = plane->globalGridAttributes();
ga.setGlobalGridVisible( false );
plane->setGlobalGridAttributes( ga );
See also:
globalGridAttributes
CartesianCoordinatePlane::setGridAttributes
152 {
153 d->gridAttributes = a;
154 update();
155 }
178 {
179 d->parent = parent;
180 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
57 {
58 mParent = widget;
59 }
Set another coordinate plane to be used as the reference plane for this one.
Parameters:
plane The coordinate plane to be used the reference plane for this one.
See also:
referenceCoordinatePlane
168 {
169 d->referenceCoordinatePlane = plane;
170 }
Set the point (in value coordinates) to be used as the center point in zoom operations.
Parameters:
center The point to use.
172 :
* \code
Sets the zoom factor in horizontal direction, that is applied to all coordinate transformations.
Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.
Definition at line 153 of file KDChartAbstractCoordinatePlane.h.
155 {}
Sets the zoom factor in vertical direction, that is applied to all coordinate transformations.
Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.
Definition at line 159 of file KDChartAbstractCoordinatePlane.h.
221 {
222 // we return our maxiumu (which is the full size of the Chart)
223 // even if we know the plane will be smaller
224 return maximumSize();
225 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
[reimplemented]
Definition at line 146 of file KDChartAbstractCoordinatePlane.cpp.
147 {
148 return QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
149 }
See also:
addDiagram, replaceDiagram
101 {
102 const int idx = d->diagrams.indexOf( diagram );
103 if( idx != -1 ){
104 d->diagrams.removeAt( idx );
105 diagram->setParent( 0 );
106 diagram->setCoordinatePlane( 0 );
107 layoutDiagrams();
108 update();
109 }
110 }
Translate the given point in value space coordinates to a position in pixel space.
Parameters:
diagramPoint The point in value coordinates.
Returns:
The translated point.
Returns:
The center point (in value coordinates) of the coordinate plane, that is used for zoom operations.
168 {}
Returns:
The zoom factor in horizontal direction, that is applied to all coordinate transformations.
Returns:
The zoom factor in vertical direction, that is applied to all coordinate transformations.
149 {}
• KDChartAbstractCoordinatePlane.h
• KDChartAbstractCoordinatePlane.cpp
The set of dataset labels currently displayed, for use in legends, etc.
Set the root index in the model, where the diagram starts referencing data for display.
• void useRainbowColors ()
Set the palette to be used, for painting datasets to the rainbow palette.
• void useSubduedColors ()
Set the palette to be used, for painting datasets to the subdued palette.
• virtual ∼AbstractDiagram ()
• void paintDataValueText (QPainter ∗painter, const QModelIndex &index, const QPointF &pos, dou-
ble value)
• virtual void paintDataValueTexts (QPainter ∗painter)
• void paintMarker (QPainter ∗painter, const QModelIndex &index, const QPointF &pos)
• virtual void paintMarkers (QPainter ∗painter)
• void propertiesChanged ()
Emitted upon change of a property of the Diagram.
Protected Attributes
• Q_SIGNALS __pad0__: void layoutChanged( AbstractDiagram∗ )
116 {
117 delete _d;
118 }
Returns:
Whether data value labels are allowed to overlap.
295 {
Returns:
Whether anti-aliasing is to be used for rendering this diagram.
306 {
Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel
181 {
182 return d->attributesModel;
183 }
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram.
Definition at line 204 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::LineDiagram::calculateDataBoundaries(), KDChart::BarDiagram::calculate-
DataBoundaries(), KDChart::LineDiagram::numberOfAbscissaSegments(), KDChart::Bar-
Diagram::numberOfAbscissaSegments(), KDChart::LineDiagram::numberOfOrdinateSegments(),
KDChart::BarDiagram::numberOfOrdinateSegments(), KDChart::LineDiagram::paint(), KDChart::Bar-
Diagram::paint(), and valueForCell().
210 {
Retrieve the brush to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The brush to use for painting.
638 :
QRect AbstractDiagram::visualRect(const QModelIndex &) const
Parameters:
dataset The dataset to retrieve the brush for.
Returns:
The brush to use for painting.
631 {
Returns:
The brush to use for painting.
623 {
746 {
747 Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
748 "There is no usable model set, for the diagram." );
749
750 Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
751 "There is no usable coordinate plane set, for the diagram." );
752 }
753 return model() && coordinatePlane();
754 }
755
756 int AbstractDiagram::datasetDimension( ) const
217 {
Returns:
The coordinate plane associated with the diagram.
126 {
127 return d->plane;
128 }
Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these
values).
This method returns a chached result of calculations done by calculateDataBoundaries. Classes derived
from AbstractDiagram must implement the calculateDataBoundaries function, to specify their own way of
calculating the data boundaries. If derived classes want to force recalculation of the data boundaries, they
can call setDataBoundariesDirty()
Returned value is in diagram coordinates.
Definition at line 130 of file KDChartAbstractDiagram.cpp.
References calculateDataBoundaries(), and d.
Referenced by KDChart::CartesianCoordinatePlane::calculateRawDataBoundingRect(), KDChart::Polar-
CoordinatePlane::layoutDiagrams(), KDChart::LineDiagram::paint(), and KDChart::BarDiagram::paint().
131 {
132 if( d->databoundariesDirty ){
133 d->databoundaries = calculateDataBoundaries ();
134 d->databoundariesDirty = false;
135 }
136 return d->databoundaries;
137 }
[reimplemented]
Definition at line 232 of file KDChartAbstractDiagram.cpp.
References d.
232 {
233 // We are still too dumb to do intelligent updates...
234 d->databoundariesDirty = true;
235 scheduleDelayedItemsLayout();
236 }
237
238 void AbstractDiagram::setDataValueAttributes( const QModelIndex & index,
The set of dataset brushes currently used, for use in legends, etc.
Note:
Cell-level override brushes, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the brush, that is used for a single cell.
Returns:
The current set of dataset brushes.
712 {
713 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( i, Qt::Vertical, DatasetB
714 ret << brush;
715 }
716
717 return ret;
718 }
719
720 QList<QPen> AbstractDiagram::datasetPens() const
The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to
have.
For each dimension it will expect one column of values in the model. If the dimensionality is 1, automatic
values will be used for the abscissa.
For example a diagram with the default dimension of 1, will have one column per datapoint (the y values)
and will use automatic values for the x axis (1, 2, 3, ... n). If the dimension is 2, the diagram will use the
first, (and the third, fifth, etc) columns as X values, and the second, (and the fourth, sixth, etc) column as Y
values.
Returns:
The dataset dimension of the diagram.
762 {
The set of dataset labels currently displayed, for use in legends, etc.
Returns:
The set of dataset labels currently displayed.
The set of dataset markers currently used, for use in legends, etc.
Note:
Cell-level override markers, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the marker, that is shown for a single cell.
Returns:
The current set of dataset brushes.
735 {
736 DataValueAttributes a =
737 qVariantValue<DataValueAttributes>( attributesModel()->headerData( i, Qt::Vertical, DataVa
738 const MarkerAttributes &ma = a.markerAttributes();
739 ret << ma;
740 }
741 return ret;
742 }
743
744 bool AbstractDiagram::checkInvariants( bool justReturnTheStatus ) const
The set of dataset pens currently used, for use in legends, etc.
Note:
Cell-level override pens, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the pens, that is used for a single cell.
Returns:
The current set of dataset pens.
724 {
725 QPen pen = qVariantValue<QPen>( attributesModel()->headerData( i, Qt::Vertical, DatasetPenRole
726 ret << pen;
727 }
728 return ret;
729 }
730
731 QList<MarkerAttributes> AbstractDiagram::datasetMarkers() const
Parameters:
index The datapoint to retrieve the attributes for.
Returns:
The DataValueAttributes for the given index.
278 {
Parameters:
dataset The dataset to retrieve the attributes for.
Returns:
The DataValueAttributes for the given dataset.
271 {
Returns:
The global DataValueAttributes.
264 {
[reimplemented]
Definition at line 223 of file KDChartAbstractDiagram.cpp.
References d, and update().
223 {
224 d->plane->layoutDiagrams();
225 update();
226 }
227 QAbstractItemView::doItemsLayout();
228 }
229
230 void AbstractDiagram::dataChanged( const QModelIndex &topLeft,
[reimplemented]
Definition at line 655 of file KDChartAbstractDiagram.cpp.
657 { return 0; }
[reimplemented]
Definition at line 649 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 661 of file KDChartAbstractDiagram.cpp.
663 {}
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Returns:
The set of item row labels currently displayed.
This signal is emitted, when either the model or the AttributesModel is replaced.
Referenced by setAttributesModel(), and setModel().
[reimplemented]
Definition at line 652 of file KDChartAbstractDiagram.cpp.
654 { return 0; }
Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context.
Parameters:
paintContext All information needed for painting.
320 {
321 // paint one data series
322 DataValueAttributes a = dataValueAttributes(index);
323 if ( !a.isVisible() ) return;
324
325 // handle decimal digits
326 int decimalDigits = a.decimalDigits();
327 int decimalPos = QString::number( value ).indexOf( QLatin1Char( ’.’ ) );
328 QString roundedValue;
329 if ( a.dataLabel().isNull() ) {
330 if ( decimalPos > 0 && value != 0 )
331 roundedValue = roundValues ( value, decimalPos, decimalDigits );
332 else
333 roundedValue = QString::number( value );
334 } else
335 roundedValue = a.dataLabel();
336 // handle prefix and suffix
337 if ( !a.prefix().isNull() )
338 roundedValue.prepend( a.prefix() );
339
340 if ( !a.suffix().isNull() )
341 roundedValue.append( a.suffix() );
342
385 {
386 for ( int j=0; j< rowCount; ++j ) {
387 const QModelIndex index = model()->index( j, i, rootIndex() );
388 double value = model()->data( index ).toDouble();
389 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
390 paintDataValueText( painter, index, pos, value );
391 }
392 }
393 }
394
395
399 {
400
401 if ( !checkInvariants() ) return;
402 DataValueAttributes a = dataValueAttributes(index);
403 if ( !a.isVisible() ) return;
404 const MarkerAttributes &ma = a.markerAttributes();
405 if ( !ma.isVisible() ) return;
406
407 PainterSaver painterSaver( painter );
408 QSizeF maSize( ma.markerSize() );
409 QBrush indexBrush( brush( index ) );
410 QPen indexPen( ma.pen() );
411 if ( ma.markerColor().isValid() )
412 indexBrush.setColor( ma.markerColor() );
413
414 paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
415 }
416
417
424 {
425 PainterSaver painterSaver( painter );
426 painter->setBrush( brush );
427 painter->setPen( pen );
428 painter->setRenderHint ( QPainter::Antialiasing );
429 painter->translate( pos );
430 switch ( markerAttributes.markerStyle() ) {
431 case MarkerAttributes::MarkerCircle:
432 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
433 maSize.height(), maSize.width()) );
434 break;
435 case MarkerAttributes::MarkerSquare:
436 {
437 QRectF rect( 0 - maSize.height()/2, 0 - maSize.width()/2,
438 maSize.height(), maSize.width() );
439 painter->drawRect( rect );
440 painter->fillRect( rect, painter->brush() );
441 break;
442 }
443 case MarkerAttributes::MarkerDiamond:
444 {
445 QVector <QPointF > diamondPoints;
446 QPointF top, left, bottom, right;
447 top = QPointF( 0, 0 - maSize.height()/2 );
448 left = QPointF( 0 - maSize.width()/2, 0 );
449 bottom = QPointF( 0, maSize.height()/2 );
450 right = QPointF( maSize.width()/2, 0 );
451 diamondPoints << top << left << bottom << right;
452 painter->drawPolygon( diamondPoints );
453 break;
454 }
455 //Pending Michel: do we need that? Ask: What is the idea about
456 // Marker1Pixel and Marker4Pixels.
457 case MarkerAttributes::Marker1Pixel:
458 {
459 QSizeF pSize(4,4);
460 QPen pen1Pixel;
461 pen1Pixel.setColor( painter->background().color() );
462 QRectF centerRect( -pSize.height()/2, -pSize.width()/2,
463 pSize.height(), pSize.width() );
464 painter->setPen( pen1Pixel );
465 painter->drawEllipse( centerRect );
466 break;
467 }
468 case MarkerAttributes::Marker4Pixels:
469 {
470 QSizeF pSize(8, 8);
471 QPen pen4Pixel;
472 pen4Pixel.setColor( painter->background().color() );
473 QRectF centerRect( -pSize.height()/2, -pSize.width()/2,
474 pSize.height(), pSize.width() );
475 painter->setPen( pen4Pixel );
476 painter->drawEllipse( centerRect );
477 break;
478 }
479 case MarkerAttributes::MarkerRing:
480 {
481 painter->setBrush( Qt::NoBrush );
482 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
483 maSize.height(), maSize.width()) );
484 break;
485 }
486 case MarkerAttributes::MarkerCross:
487 {
488 QVector <QPointF > crossPoints;
489 QPointF leftTop, leftBottom, centerBottomLeft, bottomLeft, bottomRight,
490 centerBottomRight,rightBottom, rightTop, centerTopRight, topRight, topLeft,
491 centerTopLeft;
492 leftTop = QPointF( -maSize.width()/2, -maSize.height()/4 );
493 leftBottom = QPointF( -maSize.width()/2, maSize.height()/4 );
494 centerBottomLeft = QPointF( -maSize.width()/4, maSize.height()/4 );
495 bottomLeft = QPointF( -maSize.width()/4, maSize.height()/2 );
496 bottomRight = QPointF( maSize.width()/4, maSize.height()/2 );
497 centerBottomRight = QPointF( maSize.width()/4, maSize.height()/4 );
498 rightBottom = QPointF( maSize.width()/2, maSize.height()/4 );
499 rightTop = QPointF( maSize.width()/2, -maSize.height()/4 );
500 centerTopRight = QPointF( maSize.width()/4, -maSize.height()/4 );
501 topRight = QPointF( maSize.width()/4, -maSize.height()/2 );
502 topLeft = QPointF( -maSize.width()/4, -maSize.height()/2 );
503 centerTopLeft = QPointF( -maSize.width()/4, -maSize.height()/4 );
504
505 crossPoints << leftTop << leftBottom << centerBottomLeft
506 << bottomLeft << bottomRight << centerBottomRight
507 << rightBottom << rightTop << centerTopRight
508 << topRight << topLeft << centerTopLeft;
509
510 painter->drawPolygon( crossPoints );
511 break;
512 }
513 case MarkerAttributes::MarkerFastCross:
514 {
515 QPointF left, right, top, bottom;
516 left = QPointF( -maSize.width()/2, 0 );
517 right = QPointF( maSize.width()/2, 0 );
518 top = QPointF( 0, -maSize.height()/2 );
519 bottom= QPointF( 0, maSize.height()/2 );
520 painter->drawLine( left, right );
521 painter->drawLine( top, bottom );
522 break;
523 }
524 default:
525 Q_ASSERT_X ( false, "paintMarkers()",
526 "Type item does not match a defined Marker Type." );
527 }
528 }
529
530 void AbstractDiagram::paintMarkers( QPainter* painter )
535 {
536 for ( int j=0; j< rowCount; ++j ) {
537 const QModelIndex index = model()->index( j, i, rootIndex() );
538 double value = model()->data( index ).toDouble();
539 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
540 paintMarker( painter, index, pos );
541 }
542 }
543 }
544
545
Retrieve the pen to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The pen to use for painting.
593 {
Parameters:
dataset The dataset to retrieve the pen for.
Returns:
The pen to use for painting.
585 {
Returns:
The pen to use for painting.
577 {
320 {
Parameters:
area
[reimplemented]
Definition at line 646 of file KDChartAbstractDiagram.cpp.
Parameters:
allow True means that overlapping labels are allowed.
290 {
Parameters:
enabled True means that AA is enabled.
301 {
Wrong:
diagram1->setAttributesModel( diagram2->attributesModel() );
Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel
161 {
162 if( amodel->sourceModel() != model() ) {
163 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
164 "Trying to set an attributesmodel which works on a different "
165 "model than the diagram.");
166 return;
167 }
168 if( qobject_cast<PrivateAttributesModel*>(amodel) ) {
169 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
170 "Trying to set an attributesmodel that is private to another diagram.");
171 return;
172 }
173 d->setAttributesModel(amodel);
174 scheduleDelayedItemsLayout();
175 d->databoundariesDirty = true;
176 emit modelsChanged();
177 }
Set the brush to be used, for painting all datasets in the model.
Parameters:
brush The brush to use.
608 {
Parameters:
dataset The dataset’s column in the model.
pen The brush to use.
617 {
6.7.3.48 void AbstractDiagram::setBrush (const QModelIndex & index, const QBrush & brush)
Set the brush to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
brush The brush to use.
601 {
Returns:
The coordinate plane associated with the diagram.
Reimplemented in KDChart::AbstractCartesianDiagram.
Definition at line 218 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::AbstractCartesian-
Diagram::setCoordinatePlane(), and KDChart::AbstractCoordinatePlane::takeDiagram().
222 {
140 {
141 d->databoundariesDirty = true;
142 }
See also:
datasetDimension.
Parameters:
dimension
770 {
Parameters:
a The attributes to set.
284 {
Parameters:
dataset The dataset to set the attributes for.
a The attributes to set.
259 {
Parameters:
index The datapoint to set the attributes for.
a The attributes to set.
240 {
241 d->attributesModel->setData(
242 d->attributesModel->mapFromSource( index ),
243 qVariantFromValue( a ),
244 DataValueLabelAttributesRole );
245 emit propertiesChanged();
246 }
247
248
145 {
146 QAbstractItemView::setModel( newModel );
147 AttributesModel* amodel = new PrivateAttributesModel( newModel, this );
148 amodel->initFrom( d->attributesModel );
149 d->setAttributesModel(amodel);
150 scheduleDelayedItemsLayout();
151 d->databoundariesDirty = true;
152 emit modelsChanged();
153 }
Set the pen to be used, for painting all datasets in the model.
Parameters:
pen The pen to use.
562 {
Parameters:
dataset The dataset’s row in the model.
pen The pen to use.
571 {
6.7.3.58 void AbstractDiagram::setPen (const QModelIndex & index, const QPen & pen)
Set the pen to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
pen The pen to use.
555 {
312 {
Set the root index in the model, where the diagram starts referencing data for display.
[reimplemented]
Definition at line 188 of file KDChartAbstractDiagram.cpp.
References d.
[reimplemented]
Definition at line 664 of file KDChartAbstractDiagram.cpp.
Set the palette to be used, for painting datasets to the default palette.
See also:
KDChart::Palette. FIXME: fold into one usePalette (KDChart::Palette&) method
675 {
Set the palette to be used, for painting datasets to the rainbow palette.
See also:
KDChart::Palette.
685 {
Set the palette to be used, for painting datasets to the subdued palette.
See also:
KDChart::Palette.
680 {
Helper method, retrieving the data value (DisplayRole) for a given row and column.
Parameters:
row The row to query.
column The column to query.
Returns:
The value of the display role at the given row and column as a double.
776 {
[reimplemented]
Definition at line 658 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 641 of file KDChartAbstractDiagram.cpp.
645 {}
[reimplemented]
Definition at line 667 of file KDChartAbstractDiagram.cpp.
• KDChartAbstractDiagram.h
• KDChartAbstractDiagram.cpp
• void removeFromParentLayout ()
• void setParentLayout (QLayout ∗lay)
• virtual void setParentWidget (QWidget ∗widget)
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Protected Attributes
• QWidget ∗ mParent
• QLayout ∗ mParentLayout
51 :
52 QLayoutItem( itemAlignment ),
53 mParent( 0 ),
54 mParentLayout( 0 ) {}
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
• KDChartLayoutItems.h
• KDChartLayoutItems.cpp
Set the pen to be used, for painting the datapoint at the given index.
• void useRainbowColors ()
Set the palette to be used, for painting datasets to the rainbow palette.
• void useSubduedColors ()
Set the palette to be used, for painting datasets to the subdued palette.
• virtual ∼AbstractPieDiagram ()
This signal is emitted, when either the model or the AttributesModel is replaced.
• void paintDataValueText (QPainter ∗painter, const QModelIndex &index, const QPointF &pos, dou-
ble value)
• virtual void paintDataValueTexts (QPainter ∗painter)
• void paintMarker (QPainter ∗painter, const QModelIndex &index, const QPointF &pos)
• virtual void paintMarkers (QPainter ∗painter)
• void propertiesChanged ()
Emitted upon change of a property of the Diagram.
Protected Attributes
• Q_SIGNALS __pad0__: void layoutChanged( AbstractDiagram∗ )
47 :
48 AbstractPolarDiagram( new Private(), parent, plane )
49 {
50 init();
51 }
54 {
55 }
Returns:
Whether data value labels are allowed to overlap.
295 {
Returns:
Whether anti-aliasing is to be used for rendering this diagram.
306 {
Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel
181 {
182 return d->attributesModel;
183 }
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram.
Definition at line 204 of file KDChartAbstractDiagram.cpp.
References d.
210 {
Retrieve the brush to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The brush to use for painting.
638 :
QRect AbstractDiagram::visualRect(const QModelIndex &) const
Parameters:
dataset The dataset to retrieve the brush for.
Returns:
The brush to use for painting.
631 {
Returns:
The brush to use for painting.
623 {
746 {
747 Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
748 "There is no usable model set, for the diagram." );
749
750 Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
751 "There is no usable coordinate plane set, for the diagram." );
752 }
753 return model() && coordinatePlane();
754 }
755
756 int AbstractDiagram::datasetDimension( ) const
59 {
60 return static_cast<int>( numberOfValuesPerDataset() );
61 }
217 {
126 {
127 return d->plane;
128 }
Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these
values).
This method returns a chached result of calculations done by calculateDataBoundaries. Classes derived
from AbstractDiagram must implement the calculateDataBoundaries function, to specify their own way of
calculating the data boundaries. If derived classes want to force recalculation of the data boundaries, they
can call setDataBoundariesDirty()
Returned value is in diagram coordinates.
Definition at line 130 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::calculateDataBoundaries(), and d.
Referenced by KDChart::CartesianCoordinatePlane::calculateRawDataBoundingRect(), KDChart::Polar-
CoordinatePlane::layoutDiagrams(), KDChart::LineDiagram::paint(), and KDChart::BarDiagram::paint().
131 {
132 if( d->databoundariesDirty ){
133 d->databoundaries = calculateDataBoundaries ();
134 d->databoundariesDirty = false;
135 }
136 return d->databoundaries;
137 }
[reimplemented]
Definition at line 232 of file KDChartAbstractDiagram.cpp.
References d.
232 {
233 // We are still too dumb to do intelligent updates...
234 d->databoundariesDirty = true;
235 scheduleDelayedItemsLayout();
236 }
237
238 void AbstractDiagram::setDataValueAttributes( const QModelIndex & index,
The set of dataset brushes currently used, for use in legends, etc.
Note:
Cell-level override brushes, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the brush, that is used for a single cell.
Returns:
The current set of dataset brushes.
712 {
713 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( i, Qt::Vertical, DatasetB
714 ret << brush;
715 }
716
717 return ret;
718 }
719
720 QList<QPen> AbstractDiagram::datasetPens() const
The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to
have.
For each dimension it will expect one column of values in the model. If the dimensionality is 1, automatic
values will be used for the abscissa.
For example a diagram with the default dimension of 1, will have one column per datapoint (the y values)
and will use automatic values for the x axis (1, 2, 3, ... n). If the dimension is 2, the diagram will use the
first, (and the third, fifth, etc) columns as X values, and the second, (and the fourth, sixth, etc) column as Y
values.
Returns:
The dataset dimension of the diagram.
762 {
The set of dataset labels currently displayed, for use in legends, etc.
Returns:
The set of dataset labels currently displayed.
The set of dataset markers currently used, for use in legends, etc.
Note:
Cell-level override markers, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the marker, that is shown for a single cell.
Returns:
The current set of dataset brushes.
735 {
736 DataValueAttributes a =
737 qVariantValue<DataValueAttributes>( attributesModel()->headerData( i, Qt::Vertical, DataVa
738 const MarkerAttributes &ma = a.markerAttributes();
739 ret << ma;
740 }
741 return ret;
742 }
743
744 bool AbstractDiagram::checkInvariants( bool justReturnTheStatus ) const
The set of dataset pens currently used, for use in legends, etc.
Note:
Cell-level override pens, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the pens, that is used for a single cell.
Returns:
The current set of dataset pens.
724 {
725 QPen pen = qVariantValue<QPen>( attributesModel()->headerData( i, Qt::Vertical, DatasetPenRole
726 ret << pen;
727 }
728 return ret;
729 }
730
731 QList<MarkerAttributes> AbstractDiagram::datasetMarkers() const
Parameters:
index The datapoint to retrieve the attributes for.
Returns:
The DataValueAttributes for the given index.
278 {
Parameters:
dataset The dataset to retrieve the attributes for.
Returns:
The DataValueAttributes for the given dataset.
271 {
Returns:
The global DataValueAttributes.
264 {
[reimplemented]
Definition at line 223 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::update().
223 {
224 d->plane->layoutDiagrams();
225 update();
226 }
227 QAbstractItemView::doItemsLayout();
228 }
229
230 void AbstractDiagram::dataChanged( const QModelIndex &topLeft,
Returns:
the granularity.
82 {
83 return (d->granularity < 0.05 || d->granularity > 36.0)
84 ? 1.0
85 : d->granularity;
86 }
[reimplemented]
Definition at line 655 of file KDChartAbstractDiagram.cpp.
657 { return 0; }
[reimplemented]
Definition at line 649 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 661 of file KDChartAbstractDiagram.cpp.
663 {}
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Returns:
The set of item row labels currently displayed.
This signal is emitted, when either the model or the AttributesModel is replaced.
Referenced by KDChart::AbstractDiagram::setAttributesModel(), and KDChart::AbstractDiagram::set-
Model().
[reimplemented]
Definition at line 652 of file KDChartAbstractDiagram.cpp.
654 { return 0; }
Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context.
Parameters:
paintContext All information needed for painting.
320 {
321 // paint one data series
322 DataValueAttributes a = dataValueAttributes(index);
323 if ( !a.isVisible() ) return;
324
325 // handle decimal digits
326 int decimalDigits = a.decimalDigits();
385 {
386 for ( int j=0; j< rowCount; ++j ) {
387 const QModelIndex index = model()->index( j, i, rootIndex() );
388 double value = model()->data( index ).toDouble();
389 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
390 paintDataValueText( painter, index, pos, value );
391 }
392 }
393 }
394
395
399 {
400
401 if ( !checkInvariants() ) return;
402 DataValueAttributes a = dataValueAttributes(index);
403 if ( !a.isVisible() ) return;
404 const MarkerAttributes &ma = a.markerAttributes();
405 if ( !ma.isVisible() ) return;
406
407 PainterSaver painterSaver( painter );
408 QSizeF maSize( ma.markerSize() );
409 QBrush indexBrush( brush( index ) );
410 QPen indexPen( ma.pen() );
411 if ( ma.markerColor().isValid() )
412 indexBrush.setColor( ma.markerColor() );
413
414 paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
415 }
416
417
424 {
425 PainterSaver painterSaver( painter );
426 painter->setBrush( brush );
427 painter->setPen( pen );
428 painter->setRenderHint ( QPainter::Antialiasing );
429 painter->translate( pos );
430 switch ( markerAttributes.markerStyle() ) {
431 case MarkerAttributes::MarkerCircle:
432 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
433 maSize.height(), maSize.width()) );
434 break;
435 case MarkerAttributes::MarkerSquare:
436 {
437 QRectF rect( 0 - maSize.height()/2, 0 - maSize.width()/2,
438 maSize.height(), maSize.width() );
439 painter->drawRect( rect );
440 painter->fillRect( rect, painter->brush() );
441 break;
442 }
443 case MarkerAttributes::MarkerDiamond:
444 {
445 QVector <QPointF > diamondPoints;
446 QPointF top, left, bottom, right;
447 top = QPointF( 0, 0 - maSize.height()/2 );
448 left = QPointF( 0 - maSize.width()/2, 0 );
449 bottom = QPointF( 0, maSize.height()/2 );
450 right = QPointF( maSize.width()/2, 0 );
451 diamondPoints << top << left << bottom << right;
452 painter->drawPolygon( diamondPoints );
453 break;
454 }
455 //Pending Michel: do we need that? Ask: What is the idea about
456 // Marker1Pixel and Marker4Pixels.
457 case MarkerAttributes::Marker1Pixel:
458 {
459 QSizeF pSize(4,4);
460 QPen pen1Pixel;
461 pen1Pixel.setColor( painter->background().color() );
462 QRectF centerRect( -pSize.height()/2, -pSize.width()/2,
463 pSize.height(), pSize.width() );
464 painter->setPen( pen1Pixel );
465 painter->drawEllipse( centerRect );
466 break;
467 }
468 case MarkerAttributes::Marker4Pixels:
469 {
470 QSizeF pSize(8, 8);
471 QPen pen4Pixel;
472 pen4Pixel.setColor( painter->background().color() );
473 QRectF centerRect( -pSize.height()/2, -pSize.width()/2,
474 pSize.height(), pSize.width() );
475 painter->setPen( pen4Pixel );
476 painter->drawEllipse( centerRect );
477 break;
478 }
479 case MarkerAttributes::MarkerRing:
480 {
481 painter->setBrush( Qt::NoBrush );
482 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
483 maSize.height(), maSize.width()) );
484 break;
485 }
486 case MarkerAttributes::MarkerCross:
487 {
488 QVector <QPointF > crossPoints;
489 QPointF leftTop, leftBottom, centerBottomLeft, bottomLeft, bottomRight,
490 centerBottomRight,rightBottom, rightTop, centerTopRight, topRight, topLeft,
491 centerTopLeft;
492 leftTop = QPointF( -maSize.width()/2, -maSize.height()/4 );
493 leftBottom = QPointF( -maSize.width()/2, maSize.height()/4 );
494 centerBottomLeft = QPointF( -maSize.width()/4, maSize.height()/4 );
495 bottomLeft = QPointF( -maSize.width()/4, maSize.height()/2 );
496 bottomRight = QPointF( maSize.width()/4, maSize.height()/2 );
497 centerBottomRight = QPointF( maSize.width()/4, maSize.height()/4 );
498 rightBottom = QPointF( maSize.width()/2, maSize.height()/4 );
499 rightTop = QPointF( maSize.width()/2, -maSize.height()/4 );
500 centerTopRight = QPointF( maSize.width()/4, -maSize.height()/4 );
501 topRight = QPointF( maSize.width()/4, -maSize.height()/2 );
502 topLeft = QPointF( -maSize.width()/4, -maSize.height()/2 );
503 centerTopLeft = QPointF( -maSize.width()/4, -maSize.height()/4 );
504
505 crossPoints << leftTop << leftBottom << centerBottomLeft
506 << bottomLeft << bottomRight << centerBottomRight
507 << rightBottom << rightTop << centerTopRight
508 << topRight << topLeft << centerTopLeft;
509
510 painter->drawPolygon( crossPoints );
511 break;
512 }
513 case MarkerAttributes::MarkerFastCross:
514 {
515 QPointF left, right, top, bottom;
516 left = QPointF( -maSize.width()/2, 0 );
517 right = QPointF( maSize.width()/2, 0 );
518 top = QPointF( 0, -maSize.height()/2 );
519 bottom= QPointF( 0, maSize.height()/2 );
520 painter->drawLine( left, right );
521 painter->drawLine( top, bottom );
522 break;
523 }
524 default:
535 {
536 for ( int j=0; j< rowCount; ++j ) {
537 const QModelIndex index = model()->index( j, i, rootIndex() );
538 double value = model()->data( index ).toDouble();
539 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
540 paintMarker( painter, index, pos );
541 }
542 }
543 }
544
545
Retrieve the pen to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The pen to use for painting.
593 {
Parameters:
dataset The dataset to retrieve the pen for.
Returns:
The pen to use for painting.
585 {
Returns:
The pen to use for painting.
577 {
320 {
123 {
124 return qVariantValue<PieAttributes>(
125 d->attributesModel->data(
126 d->attributesModel->mapFromSource( index ),
127 PieAttributesRole ) );
128 }
115 {
116 return qVariantValue<PieAttributes>(
117 d->attributesModel->data(
118 d->attributesModel->mapFromSource( columnToIndex( column ) ).column(),
119 PieAttributesRole ) );
120 }
106 {
107 return qVariantValue<PieAttributes>(
108 d->attributesModel->data( PieAttributesRole ) );
109 }
54 {
55 return dynamic_cast<const PolarCoordinatePlane*>( coordinatePlane() );
56 }
Parameters:
area
[reimplemented]
Definition at line 646 of file KDChartAbstractDiagram.cpp.
Parameters:
allow True means that overlapping labels are allowed.
290 {
Parameters:
enabled True means that AA is enabled.
301 {
Wrong:
diagram1->setAttributesModel( diagram2->attributesModel() );
Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel
161 {
162 if( amodel->sourceModel() != model() ) {
163 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
164 "Trying to set an attributesmodel which works on a different "
165 "model than the diagram.");
166 return;
167 }
168 if( qobject_cast<PrivateAttributesModel*>(amodel) ) {
169 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
170 "Trying to set an attributesmodel that is private to another diagram.");
171 return;
172 }
173 d->setAttributesModel(amodel);
174 scheduleDelayedItemsLayout();
175 d->databoundariesDirty = true;
176 emit modelsChanged();
177 }
Set the brush to be used, for painting all datasets in the model.
Parameters:
brush The brush to use.
608 {
6.9.2.55 void AbstractDiagram::setBrush (int dataset, const QBrush & brush) [inherited]
Parameters:
dataset The dataset’s column in the model.
pen The brush to use.
617 {
6.9.2.56 void AbstractDiagram::setBrush (const QModelIndex & index, const QBrush & brush)
[inherited]
Set the brush to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
brush The brush to use.
601 {
Returns:
The coordinate plane associated with the diagram.
Reimplemented in KDChart::AbstractCartesianDiagram.
Definition at line 218 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::AbstractCartesian-
Diagram::setCoordinatePlane(), and KDChart::AbstractCoordinatePlane::takeDiagram().
222 {
140 {
141 d->databoundariesDirty = true;
142 }
See also:
datasetDimension.
Parameters:
dimension
770 {
Parameters:
a The attributes to set.
284 {
Parameters:
dataset The dataset to set the attributes for.
a The attributes to set.
259 {
Parameters:
index The datapoint to set the attributes for.
a The attributes to set.
240 {
241 d->attributesModel->setData(
242 d->attributesModel->mapFromSource( index ),
243 qVariantFromValue( a ),
244 DataValueLabelAttributesRole );
245 emit propertiesChanged();
246 }
247
248
Set the granularity: the smaller the granularity the more your diagram segments will show facettes instead
of rounded segments.
Parameters:
value the granularity value between 0.05 (one twentieth of a degree) and 36.0 (one tenth of a full
circle), other values will be interpreted as 1.0.
77 {
78 d->granularity = value;
79 }
145 {
146 QAbstractItemView::setModel( newModel );
147 AttributesModel* amodel = new PrivateAttributesModel( newModel, this );
148 amodel->initFrom( d->attributesModel );
149 d->setAttributesModel(amodel);
150 scheduleDelayedItemsLayout();
151 d->databoundariesDirty = true;
152 emit modelsChanged();
153 }
Set the pen to be used, for painting all datasets in the model.
Parameters:
pen The pen to use.
562 {
6.9.2.66 void AbstractDiagram::setPen (int dataset, const QPen & pen) [inherited]
Parameters:
dataset The dataset’s row in the model.
pen The pen to use.
571 {
6.9.2.67 void AbstractDiagram::setPen (const QModelIndex & index, const QPen & pen)
[inherited]
Set the pen to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
pen The pen to use.
555 {
312 {
96 {
97 d->attributesModel->setHeaderData(
98 column, Qt::Vertical, qVariantFromValue( attrs ), PieAttributesRole );
99 emit layoutChanged( this );
100 }
90 {
91 d->attributesModel->setModelData( qVariantFromValue( attrs ), PieAttributesRole );
92 emit layoutChanged( this );
93 }
Set the root index in the model, where the diagram starts referencing data for display.
[reimplemented]
Definition at line 188 of file KDChartAbstractDiagram.cpp.
References d.
[reimplemented]
Definition at line 664 of file KDChartAbstractDiagram.cpp.
66 {
67 d->startPosition = degrees;
68 }
145 {
146 model()->setData( index, qVariantFromValue( tda ), ThreeDPieAttributesRole );
147 emit layoutChanged( this );
148 }
138 {
139 d->attributesModel->setHeaderData(
140 column, Qt::Vertical, qVariantFromValue( tda ), ThreeDPieAttributesRole );
141 emit layoutChanged( this );
142 }
132 {
133 d->attributesModel->setModelData( qVariantFromValue( tda ), ThreeDPieAttributesRole );
134 emit layoutChanged( this );
135 }
Returns:
the starting angle for the first dataset.
71 {
72 return d->startPosition;
73 }
171 {
172 return qVariantValue<ThreeDPieAttributes>(
173 d->attributesModel->data(
174 d->attributesModel->mapFromSource( index ),
175 ThreeDPieAttributesRole ) );
176 }
163 {
164 return qVariantValue<ThreeDPieAttributes>(
165 d->attributesModel->data(
166 d->attributesModel->mapFromSource( columnToIndex( column ) ).column(),
167 ThreeDPieAttributesRole ) );
168 }
154 {
155 return qVariantValue<ThreeDPieAttributes>(
156 d->attributesModel->data( ThreeDPieAttributesRole ) );
157 }
Set the palette to be used, for painting datasets to the default palette.
See also:
KDChart::Palette. FIXME: fold into one usePalette (KDChart::Palette&) method
675 {
Set the palette to be used, for painting datasets to the rainbow palette.
See also:
KDChart::Palette.
685 {
Set the palette to be used, for painting datasets to the subdued palette.
See also:
KDChart::Palette.
680 {
Helper method, retrieving the data value (DisplayRole) for a given row and column.
Parameters:
row The row to query.
column The column to query.
Returns:
The value of the display role at the given row and column as a double.
776 {
[reimplemented]
Definition at line 658 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 641 of file KDChartAbstractDiagram.cpp.
645 {}
[reimplemented]
Definition at line 667 of file KDChartAbstractDiagram.cpp.
• KDChartAbstractPieDiagram.h
• KDChartAbstractPieDiagram.cpp
• void useRainbowColors ()
Set the palette to be used, for painting datasets to the rainbow palette.
• void useSubduedColors ()
Set the palette to be used, for painting datasets to the subdued palette.
• virtual ∼AbstractPolarDiagram ()
• void paintDataValueText (QPainter ∗painter, const QModelIndex &index, const QPointF &pos, dou-
ble value)
• virtual void paintDataValueTexts (QPainter ∗painter)
• void paintMarker (QPainter ∗painter, const QModelIndex &index, const QPointF &pos)
• virtual void paintMarkers (QPainter ∗painter)
• void propertiesChanged ()
Emitted upon change of a property of the Diagram.
Protected Attributes
45 {}
Returns:
Whether data value labels are allowed to overlap.
295 {
Returns:
Whether anti-aliasing is to be used for rendering this diagram.
306 {
Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel
181 {
182 return d->attributesModel;
183 }
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram.
Definition at line 204 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::LineDiagram::calculateDataBoundaries(), KDChart::BarDiagram::calculate-
DataBoundaries(), KDChart::LineDiagram::numberOfAbscissaSegments(), KDChart::Bar-
Diagram::numberOfAbscissaSegments(), KDChart::LineDiagram::numberOfOrdinateSegments(),
KDChart::BarDiagram::numberOfOrdinateSegments(), KDChart::LineDiagram::paint(), KDChart::Bar-
Diagram::paint(), and KDChart::AbstractDiagram::valueForCell().
210 {
Retrieve the brush to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The brush to use for painting.
638 :
QRect AbstractDiagram::visualRect(const QModelIndex &) const
Parameters:
dataset The dataset to retrieve the brush for.
Returns:
The brush to use for painting.
631 {
Returns:
The brush to use for painting.
623 {
746 {
747 Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
748 "There is no usable model set, for the diagram." );
749
750 Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
751 "There is no usable coordinate plane set, for the diagram." );
752 }
753 return model() && coordinatePlane();
754 }
755
756 int AbstractDiagram::datasetDimension( ) const
59 {
60 return static_cast<int>( numberOfValuesPerDataset() );
61 }
217 {
Returns:
The coordinate plane associated with the diagram.
126 {
127 return d->plane;
128 }
Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these
values).
This method returns a chached result of calculations done by calculateDataBoundaries. Classes derived
from AbstractDiagram must implement the calculateDataBoundaries function, to specify their own way of
calculating the data boundaries. If derived classes want to force recalculation of the data boundaries, they
can call setDataBoundariesDirty()
Returned value is in diagram coordinates.
Definition at line 130 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::calculateDataBoundaries(), and d.
Referenced by KDChart::CartesianCoordinatePlane::calculateRawDataBoundingRect(), KDChart::Polar-
CoordinatePlane::layoutDiagrams(), KDChart::LineDiagram::paint(), and KDChart::BarDiagram::paint().
131 {
132 if( d->databoundariesDirty ){
133 d->databoundaries = calculateDataBoundaries ();
134 d->databoundariesDirty = false;
135 }
136 return d->databoundaries;
137 }
[reimplemented]
Definition at line 232 of file KDChartAbstractDiagram.cpp.
References d.
232 {
233 // We are still too dumb to do intelligent updates...
234 d->databoundariesDirty = true;
235 scheduleDelayedItemsLayout();
236 }
237
238 void AbstractDiagram::setDataValueAttributes( const QModelIndex & index,
The set of dataset brushes currently used, for use in legends, etc.
Note:
Cell-level override brushes, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the brush, that is used for a single cell.
Returns:
The current set of dataset brushes.
712 {
713 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( i, Qt::Vertical, DatasetB
714 ret << brush;
715 }
716
717 return ret;
718 }
719
720 QList<QPen> AbstractDiagram::datasetPens() const
The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to
have.
For each dimension it will expect one column of values in the model. If the dimensionality is 1, automatic
values will be used for the abscissa.
For example a diagram with the default dimension of 1, will have one column per datapoint (the y values)
and will use automatic values for the x axis (1, 2, 3, ... n). If the dimension is 2, the diagram will use the
first, (and the third, fifth, etc) columns as X values, and the second, (and the fourth, sixth, etc) column as Y
values.
Returns:
The dataset dimension of the diagram.
762 {
The set of dataset labels currently displayed, for use in legends, etc.
Returns:
The set of dataset labels currently displayed.
The set of dataset markers currently used, for use in legends, etc.
Note:
Cell-level override markers, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the marker, that is shown for a single cell.
Returns:
The current set of dataset brushes.
735 {
736 DataValueAttributes a =
737 qVariantValue<DataValueAttributes>( attributesModel()->headerData( i, Qt::Vertical, DataVa
738 const MarkerAttributes &ma = a.markerAttributes();
739 ret << ma;
740 }
741 return ret;
742 }
743
744 bool AbstractDiagram::checkInvariants( bool justReturnTheStatus ) const
The set of dataset pens currently used, for use in legends, etc.
Note:
Cell-level override pens, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the pens, that is used for a single cell.
Returns:
The current set of dataset pens.
724 {
725 QPen pen = qVariantValue<QPen>( attributesModel()->headerData( i, Qt::Vertical, DatasetPenRole
726 ret << pen;
727 }
728 return ret;
729 }
730
731 QList<MarkerAttributes> AbstractDiagram::datasetMarkers() const
Parameters:
index The datapoint to retrieve the attributes for.
Returns:
The DataValueAttributes for the given index.
278 {
Parameters:
dataset The dataset to retrieve the attributes for.
Returns:
The DataValueAttributes for the given dataset.
271 {
Returns:
The global DataValueAttributes.
264 {
[reimplemented]
Definition at line 223 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::update().
223 {
224 d->plane->layoutDiagrams();
225 update();
226 }
227 QAbstractItemView::doItemsLayout();
228 }
229
230 void AbstractDiagram::dataChanged( const QModelIndex &topLeft,
[reimplemented]
Definition at line 655 of file KDChartAbstractDiagram.cpp.
657 { return 0; }
[reimplemented]
Definition at line 649 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 661 of file KDChartAbstractDiagram.cpp.
663 {}
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Returns:
The set of item row labels currently displayed.
This signal is emitted, when either the model or the AttributesModel is replaced.
Referenced by KDChart::AbstractDiagram::setAttributesModel(), and KDChart::AbstractDiagram::set-
Model().
[reimplemented]
Definition at line 652 of file KDChartAbstractDiagram.cpp.
654 { return 0; }
Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context.
Parameters:
paintContext All information needed for painting.
320 {
321 // paint one data series
322 DataValueAttributes a = dataValueAttributes(index);
323 if ( !a.isVisible() ) return;
324
325 // handle decimal digits
326 int decimalDigits = a.decimalDigits();
327 int decimalPos = QString::number( value ).indexOf( QLatin1Char( ’.’ ) );
328 QString roundedValue;
329 if ( a.dataLabel().isNull() ) {
330 if ( decimalPos > 0 && value != 0 )
331 roundedValue = roundValues ( value, decimalPos, decimalDigits );
332 else
333 roundedValue = QString::number( value );
334 } else
335 roundedValue = a.dataLabel();
336 // handle prefix and suffix
337 if ( !a.prefix().isNull() )
338 roundedValue.prepend( a.prefix() );
339
340 if ( !a.suffix().isNull() )
341 roundedValue.append( a.suffix() );
342
343 PainterSaver painterSaver( painter );
344 // FIXME draw the non-text bits, background, etc
345 const TextAttributes &ta = a.textAttributes();
346 if ( ta.isVisible() ) {
347 painter->setPen( ta.pen() );
348 painter->setFont( ta.font() );
349 painter->translate( pos );
350 painter->rotate( ta.rotation() );
351 painter->drawText( QPointF(0, 0), roundedValue );
352 }
353 }
354
355 QString AbstractDiagram::roundValues( double value,
385 {
386 for ( int j=0; j< rowCount; ++j ) {
387 const QModelIndex index = model()->index( j, i, rootIndex() );
388 double value = model()->data( index ).toDouble();
389 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
390 paintDataValueText( painter, index, pos, value );
391 }
392 }
393 }
394
395
399 {
400
401 if ( !checkInvariants() ) return;
402 DataValueAttributes a = dataValueAttributes(index);
403 if ( !a.isVisible() ) return;
404 const MarkerAttributes &ma = a.markerAttributes();
405 if ( !ma.isVisible() ) return;
406
407 PainterSaver painterSaver( painter );
408 QSizeF maSize( ma.markerSize() );
409 QBrush indexBrush( brush( index ) );
410 QPen indexPen( ma.pen() );
411 if ( ma.markerColor().isValid() )
412 indexBrush.setColor( ma.markerColor() );
413
414 paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
415 }
416
417
424 {
425 PainterSaver painterSaver( painter );
426 painter->setBrush( brush );
427 painter->setPen( pen );
428 painter->setRenderHint ( QPainter::Antialiasing );
429 painter->translate( pos );
430 switch ( markerAttributes.markerStyle() ) {
431 case MarkerAttributes::MarkerCircle:
432 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
433 maSize.height(), maSize.width()) );
434 break;
535 {
536 for ( int j=0; j< rowCount; ++j ) {
537 const QModelIndex index = model()->index( j, i, rootIndex() );
538 double value = model()->data( index ).toDouble();
539 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
540 paintMarker( painter, index, pos );
541 }
542 }
543 }
544
545
Retrieve the pen to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The pen to use for painting.
593 {
Parameters:
dataset The dataset to retrieve the pen for.
Returns:
The pen to use for painting.
585 {
Returns:
The pen to use for painting.
577 {
320 {
54 {
55 return dynamic_cast<const PolarCoordinatePlane*>( coordinatePlane() );
56 }
Parameters:
area
[reimplemented]
Definition at line 646 of file KDChartAbstractDiagram.cpp.
Parameters:
allow True means that overlapping labels are allowed.
290 {
Parameters:
enabled True means that AA is enabled.
301 {
Wrong:
diagram1->setAttributesModel( diagram2->attributesModel() );
Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel
161 {
162 if( amodel->sourceModel() != model() ) {
163 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
164 "Trying to set an attributesmodel which works on a different "
165 "model than the diagram.");
166 return;
167 }
168 if( qobject_cast<PrivateAttributesModel*>(amodel) ) {
169 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
170 "Trying to set an attributesmodel that is private to another diagram.");
171 return;
172 }
173 d->setAttributesModel(amodel);
174 scheduleDelayedItemsLayout();
175 d->databoundariesDirty = true;
176 emit modelsChanged();
177 }
Set the brush to be used, for painting all datasets in the model.
Parameters:
brush The brush to use.
608 {
6.10.2.51 void AbstractDiagram::setBrush (int dataset, const QBrush & brush) [inherited]
Parameters:
dataset The dataset’s column in the model.
pen The brush to use.
617 {
6.10.2.52 void AbstractDiagram::setBrush (const QModelIndex & index, const QBrush & brush)
[inherited]
Set the brush to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
brush The brush to use.
601 {
Returns:
The coordinate plane associated with the diagram.
Reimplemented in KDChart::AbstractCartesianDiagram.
Definition at line 218 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::AbstractCartesian-
Diagram::setCoordinatePlane(), and KDChart::AbstractCoordinatePlane::takeDiagram().
222 {
140 {
141 d->databoundariesDirty = true;
142 }
See also:
datasetDimension.
Parameters:
dimension
770 {
Parameters:
a The attributes to set.
284 {
Parameters:
dataset The dataset to set the attributes for.
a The attributes to set.
259 {
Parameters:
index The datapoint to set the attributes for.
a The attributes to set.
240 {
241 d->attributesModel->setData(
242 d->attributesModel->mapFromSource( index ),
243 qVariantFromValue( a ),
244 DataValueLabelAttributesRole );
245 emit propertiesChanged();
246 }
247
248
145 {
146 QAbstractItemView::setModel( newModel );
147 AttributesModel* amodel = new PrivateAttributesModel( newModel, this );
148 amodel->initFrom( d->attributesModel );
149 d->setAttributesModel(amodel);
150 scheduleDelayedItemsLayout();
151 d->databoundariesDirty = true;
152 emit modelsChanged();
153 }
Set the pen to be used, for painting all datasets in the model.
Parameters:
pen The pen to use.
562 {
6.10.2.61 void AbstractDiagram::setPen (int dataset, const QPen & pen) [inherited]
Parameters:
dataset The dataset’s row in the model.
pen The pen to use.
571 {
6.10.2.62 void AbstractDiagram::setPen (const QModelIndex & index, const QPen & pen)
[inherited]
Set the pen to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
pen The pen to use.
555 {
312 {
Set the root index in the model, where the diagram starts referencing data for display.
[reimplemented]
Definition at line 188 of file KDChartAbstractDiagram.cpp.
References d.
[reimplemented]
Definition at line 664 of file KDChartAbstractDiagram.cpp.
Set the palette to be used, for painting datasets to the default palette.
See also:
KDChart::Palette. FIXME: fold into one usePalette (KDChart::Palette&) method
675 {
Set the palette to be used, for painting datasets to the rainbow palette.
See also:
KDChart::Palette.
685 {
Set the palette to be used, for painting datasets to the subdued palette.
See also:
KDChart::Palette.
680 {
Helper method, retrieving the data value (DisplayRole) for a given row and column.
Parameters:
row The row to query.
column The column to query.
Returns:
The value of the display role at the given row and column as a double.
776 {
[reimplemented]
Definition at line 658 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 641 of file KDChartAbstractDiagram.cpp.
645 {}
[reimplemented]
Definition at line 667 of file KDChartAbstractDiagram.cpp.
• KDChartAbstractPolarDiagram.h
• KDChartAbstractPolarDiagram.cpp
• QModelIndex index (int row, int col, const QModelIndex &index) const
• QModelIndex mapFromSource (const QModelIndex &sourceIndex) const
• QModelIndex mapToSource (const QModelIndex &proxyIndex) const
• QModelIndex parent (const QModelIndex &index) const
This is basically KDAbstractProxyModel, but only the bits that we really need from it.
Definition at line 12 of file KDChartAbstractProxyModel.cpp.
13 : QAbstractProxyModel(parent) {}
54 {
55 Q_ASSERT(sourceModel());
56 return mapFromSource(sourceModel()->index( row, col, mapToSource(index) ));
57 }
24 {
25 if ( !sourceIndex.isValid() )
26 return QModelIndex();
27 //qDebug() << "sourceIndex.model()="<<sourceIndex.model();
28 //qDebug() << "model()="<<sourceModel();
29 Q_ASSERT( sourceIndex.model() == sourceModel() );
30
31 // Create an index that preserves the internal pointer from the source;
32 // this way AbstractProxyModel preserves the structure of the source model
33 return createIndex( sourceIndex.row(), sourceIndex.column(), sourceIndex.internalPointer() );
34 }
37 {
38 if ( !proxyIndex.isValid() )
39 return QModelIndex();
40 Q_ASSERT( proxyIndex.model() == this );
41 // So here we need to create a source index which holds that internal pointer.
42 // No way to pass it to sourceModel()->index... so we have to do the ugly way:
43 QModelIndex sourceIndex;
44 KDPrivateModelIndex* hack = reinterpret_cast<KDPrivateModelIndex*>(&sourceIndex);
45 hack->r = proxyIndex.row();
46 hack->c = proxyIndex.column();
47 hack->p = proxyIndex.internalPointer();
48 hack->m = sourceModel();
49 Q_ASSERT( sourceIndex.isValid() );
50 return sourceIndex;
51 }
60 {
61 Q_ASSERT(sourceModel());
62 return mapFromSource(sourceModel()->parent( mapToSource(index) ));
63 }
The documentation for this class was generated from the following files:
• KDChartAbstractProxyModel.h
• KDChartAbstractProxyModel.cpp
6.12.1.1 AbstractThreeDAttributes::AbstractThreeDAttributes ()
67 {
68 delete _d; _d = 0;
69 }
104 {
105 return d->depth;
106 }
93 {
94 return d->enabled;
95 }
57 { return !operator==(other); }
57 {
58 if( this == &r )
59 return *this;
60
61 *d = *r.d;
62
63 return *this;
64 }
73 {
74 if( isEnabled() == r.isEnabled() &&
75 depth() == r.depth() )
76 return true;
77 else
78 return false;
79 }
98 {
99 d->depth = depth;
100 }
88 {
89 d->enabled = enabled;
90 }
110 {
111 return isEnabled() ? d->depth : 0.0;
112 }
The documentation for this class was generated from the following files:
• KDChartAbstractThreeDAttributes.h
• KDChartAbstractThreeDAttributes.cpp
Public Types
• enum PaletteType {
PaletteTypeDefault = 0,
PaletteTypeRainbow = 1,
PaletteTypeSubdued = 2 }
• QModelIndex index (int row, int col, const QModelIndex &index) const
• void initFrom (const AttributesModel ∗other)
• bool isKnownAttributesRole (int role) const
Returns whether the given role corresponds to one of the known internally used ones.
• bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole)
[reimplemented]
• bool setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int
role=Qt::DisplayRole)
[reimplemented]
• ∼AttributesModel ()
Public Attributes
Enumeration values:
PaletteTypeDefault
PaletteTypeRainbow
PaletteTypeSubdued
44 {
45 PaletteTypeDefault = 0,
46 PaletteTypeRainbow = 1,
47 PaletteTypeSubdued = 2
48 };
44 : AbstractProxyModel( parent ),
45 mPaletteType( PaletteTypeDefault )
46 {
47 setSourceModel(model);
48 }
6.13.2.2 AttributesModel::∼AttributesModel ()
51 {
52 }
[reimplemented]
Definition at line 272 of file KDChartAttributesModel.cpp.
References KDChart::AbstractProxyModel::mapToSource().
Referenced by setModelData().
273 {
274 Q_ASSERT(sourceModel());
275 return sourceModel()->columnCount( mapToSource(index) );
276 }
6.13.3.2 QVariant AttributesModel::data (const QModelIndex &, int role = Qt::DisplayRole) const
[reimplemented]
Definition at line 149 of file KDChartAttributesModel.cpp.
References data(), and KDChart::AbstractProxyModel::mapToSource().
150 {
151 //qDebug() << "AttributesModel::data(" << index << role << ")";
152 if( index.isValid() ) {
153 Q_ASSERT( index.model() == this );
154 }
155 QVariant sourceData = sourceModel()->data( mapToSource(index), role );
156 if ( sourceData.isValid() )
157 return sourceData;
158
159 // check if we are storing a value for this role at this cell index
160 if ( mDataMap.contains( index.column() ) ) {
161 const QMap< int, QMap< int, QVariant> > &colDataMap = mDataMap[ index.column() ];
162 if ( colDataMap.contains( index.row() ) ) {
163 const QMap<int, QVariant> &dataMap = colDataMap[ index.row() ];
164 if ( dataMap.contains( role ) )
165 return dataMap[ role ];
166 }
167 }
168 // check if there is something set for the column (dataset), or at global level
169 if( index.isValid() )
170 return data( index.column(), role ); // includes automatic fallback to default
171
172 return QVariant();
173 }
Returns the data that were specified at per column level, or the globally set data, or the default data, or
QVariant().
Definition at line 133 of file KDChartAttributesModel.cpp.
References data(), headerData(), and isKnownAttributesRole().
134 {
135 if ( isKnownAttributesRole( role ) ) {
136 // check if there is something set for the column (dataset)
137 QVariant v;
138 v = headerData( column, Qt::Vertical, role );
139
140 // check if there is something set at global level
141 if ( !v.isValid() )
142 v = data( role ); // includes automatic fallback to default
143 return v;
144 }
145 return QVariant();
146 }
Returns the data that were specified at global level, or the default data, or QVariant().
Definition at line 115 of file KDChartAttributesModel.cpp.
References isKnownAttributesRole(), and modelData().
Referenced by data().
116 {
117 if ( isKnownAttributesRole( role ) ) {
118 // check if there is something set at global level
119 QVariant v = modelData( role );
120
121 // else return the default setting, if any
122 if ( !v.isValid() )
123 v = defaultsForRole( role );
124 return v;
125 }
126 return QVariant();
127 }
[reimplemented]
Definition at line 66 of file KDChartAttributesModel.cpp.
References KDChart::DatasetBrushRole, KDChart::Palette::defaultPalette(), KDChart::Palette::get-
Brush(), modelData(), paletteType(), PaletteTypeDefault, PaletteTypeRainbow, PaletteTypeSubdued,
KDChart::Palette::rainbowPalette(), and KDChart::Palette::subduedPalette().
Referenced by data(), KDChart::RingDiagram::paint(), and KDChart::PolarDiagram::paint().
69 {
54 {
55 Q_ASSERT(sourceModel());
56 return mapFromSource(sourceModel()->index( row, col, mapToSource(index) ));
57 }
Referenced by KDChart::AbstractDiagram::setModel().
55 {
56 if( other == this || ! other ) return;
57
58 mDataMap = other->mDataMap;
59 mHorizontalHeaderDataMap = other->mHorizontalHeaderDataMap;
60 mVerticalHeaderDataMap = other->mVerticalHeaderDataMap;
61 mModelDataMap = other->mModelDataMap;
62
63 setPaletteType( other->paletteType() );
64 }
Returns whether the given role corresponds to one of the known internally used ones.
Definition at line 176 of file KDChartAttributesModel.cpp.
References KDChart::BarAttributesRole, KDChart::DatasetBrushRole, KDChart::DatasetPenRole,
KDChart::DataValueLabelAttributesRole, KDChart::LineAttributesRole, KDChart::PieAttributesRole,
KDChart::ThreeDAttributesRole, KDChart::ThreeDBarAttributesRole, KDChart::ThreeDLineAttributes-
Role, and KDChart::ThreeDPieAttributesRole.
Referenced by data(), setData(), and setHeaderData().
177 {
178 bool oneOfOurs = false;
179 switch( role ) {
180 // fallthrough intended
181 case DataValueLabelAttributesRole:
182 case DatasetBrushRole:
183 case DatasetPenRole:
184 case ThreeDAttributesRole:
185 case LineAttributesRole:
186 case ThreeDLineAttributesRole:
187 case BarAttributesRole:
188 case ThreeDBarAttributesRole:
189 case PieAttributesRole:
190 case ThreeDPieAttributesRole:
191 oneOfOurs = true;
192 default:
193 break;
194 }
195 return oneOfOurs;
196 }
24 {
25 if ( !sourceIndex.isValid() )
26 return QModelIndex();
27 //qDebug() << "sourceIndex.model()="<<sourceIndex.model();
28 //qDebug() << "model()="<<sourceModel();
37 {
38 if ( !proxyIndex.isValid() )
39 return QModelIndex();
40 Q_ASSERT( proxyIndex.model() == this );
41 // So here we need to create a source index which holds that internal pointer.
42 // No way to pass it to sourceModel()->index... so we have to do the ugly way:
43 QModelIndex sourceIndex;
44 KDPrivateModelIndex* hack = reinterpret_cast<KDPrivateModelIndex*>(&sourceIndex);
45 hack->r = proxyIndex.row();
46 hack->c = proxyIndex.column();
47 hack->p = proxyIndex.internalPointer();
48 hack->m = sourceModel();
49 Q_ASSERT( sourceIndex.isValid() );
50 return sourceIndex;
51 }
262 {
263 return mModelDataMap.value( role, QVariant() );
264 }
248 {
249 return mPaletteType;
250 }
60 {
61 Q_ASSERT(sourceModel());
62 return mapFromSource(sourceModel()->parent( mapToSource(index) ));
63 }
[reimplemented]
Definition at line 266 of file KDChartAttributesModel.cpp.
References KDChart::AbstractProxyModel::mapToSource().
Referenced by setHeaderData(), and setModelData().
267 {
268 Q_ASSERT(sourceModel());
269 return sourceModel()->rowCount( mapToSource(index) );
270 }
6.13.3.15 bool AttributesModel::setData (const QModelIndex & index, const QVariant & value,
int role = Qt::DisplayRole)
[reimplemented]
Definition at line 212 of file KDChartAttributesModel.cpp.
References isKnownAttributesRole(), and KDChart::AbstractProxyModel::mapToSource().
Referenced by KDChart::BarDiagram::setBarAttributes().
213 {
214 if ( !isKnownAttributesRole( role ) ) {
215 return sourceModel()->setData( mapToSource(index), value, role );
216 } else {
217 QMap< int, QMap< int, QVariant> > &colDataMap = mDataMap[ index.column() ];
218 QMap<int, QVariant> &dataMap = colDataMap[ index.row() ];
219 //qDebug() << "AttributesModel::setData" <<"role" << role << "value" << value;
220 dataMap.insert( role, value );
221 emit attributesChanged( index, index );
222 return true;
223 }
224 }
[reimplemented]
228 {
229 if ( !isKnownAttributesRole( role ) ) {
230 return sourceModel()->setHeaderData( section, orientation, value, role );
231 } else {
232 QMap<int, QMap<int, QVariant> > §ionDataMap
233 = orientation == Qt::Horizontal ? mHorizontalHeaderDataMap : mVerticalHeaderDataMap;
234 QMap<int, QVariant> &dataMap = sectionDataMap[ section ];
235 dataMap.insert( role, value );
236 emit attributesChanged( index( 0, section, QModelIndex() ),
237 index( rowCount( QModelIndex() ), section, QModelIndex() ) );
238 return true;
239 }
240 }
253 {
254 mModelDataMap.insert( role, value );
255 emit attributesChanged( index( 0, 0, QModelIndex() ),
256 index( rowCount( QModelIndex() ),
257 columnCount( QModelIndex() ), QModelIndex() ) );
258 return true;
259 }
243 {
244 mPaletteType = type;
245 }
[reimplemented]
Definition at line 278 of file KDChartAttributesModel.cpp.
Referenced by AttributesModel().
279 {
280 if( this->sourceModel() != 0 )
281 disconnect( this->sourceModel(), SIGNAL( dataChanged( const QModelIndex&, const QModelIndex&))
282 this, SIGNAL( dataChanged( const QModelIndex&, const QModelIndex&)))
283 QAbstractProxyModel::setSourceModel( sourceModel );
• KDChartAttributesModel.h
• KDChartAttributesModel.cpp
Public Types
• enum BackgroundPixmapMode {
BackgroundPixmapModeNone,
BackgroundPixmapModeCentered,
BackgroundPixmapModeScaled,
BackgroundPixmapModeStretched }
Enumeration values:
BackgroundPixmapModeNone
BackgroundPixmapModeCentered
BackgroundPixmapModeScaled
BackgroundPixmapModeStretched
49 { BackgroundPixmapModeNone,
50 BackgroundPixmapModeCentered,
51 BackgroundPixmapModeScaled,
52 BackgroundPixmapModeStretched };
6.14.2.1 KDChart::BackgroundAttributes::BackgroundAttributes ()
6.14.2.3 KDChart::BackgroundAttributes::∼BackgroundAttributes ()
Referenced by operator<<().
Referenced by operator<<().
67 { return !operator==(other); }
Referenced by operator<<().
Referenced by operator<<().
The documentation for this class was generated from the following file:
• KDChartBackgroundAttributes.h
6.15.1.1 KDChart::BarAttributes::BarAttributes ()
6.15.1.3 KDChart::BarAttributes::∼BarAttributes ()
Referenced by KDChart::BarDiagram::paint().
Referenced by KDChart::BarDiagram::paint().
Referenced by KDChart::BarDiagram::paint().
71 { return !operator==(other); }
Referenced by KDChart::BarDiagram::paint().
Referenced by KDChart::BarDiagram::paint().
Referenced by KDChart::BarDiagram::paint().
The documentation for this class was generated from the following file:
• KDChartBarAttributes.h
Public Types
• enum BarType {
Normal,
Stacked,
Percent,
Rows }
• void useRainbowColors ()
Set the palette to be used, for painting datasets to the rainbow palette.
• void useSubduedColors ()
Set the palette to be used, for painting datasets to the subdued palette.
• virtual ∼BarDiagram ()
• void paintDataValueText (QPainter ∗painter, const QModelIndex &index, const QPointF &pos, dou-
ble value)
• virtual void paintDataValueTexts (QPainter ∗painter)
• void paintMarker (QPainter ∗painter, const QModelIndex &index, const QPointF &pos)
• virtual void paintMarkers (QPainter ∗painter)
• void propertiesChanged ()
Emitted upon change of a property of the Diagram.
Protected Attributes
Enumeration values:
Normal
Stacked
Percent
Rows
55 { Normal,
56 Stacked,
57 Percent,
58 Rows };
53 :
54 AbstractCartesianDiagram( new Private(), parent, plane )
55 {
56 init();
57 }
64 {
65 }
See also:
takeAxis
67 {
68 if ( !d->axesList.contains( axis ) ) {
69 d->axesList.append( axis );
70 axis->createObserver( this );
71 layoutPlanes();
72 }
73 }
Returns:
Whether data value labels are allowed to overlap.
295 {
Returns:
Whether anti-aliasing is to be used for rendering this diagram.
306 {
Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel
181 {
182 return d->attributesModel;
183 }
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram.
Definition at line 204 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::LineDiagram::calculateDataBoundaries(), calculateDataBoundaries(),
KDChart::LineDiagram::numberOfAbscissaSegments(), numberOfAbscissaSegments(), KDChart::Line-
Diagram::numberOfOrdinateSegments(), numberOfOrdinateSegments(), KDChart::LineDiagram::paint(),
paint(), and KDChart::AbstractDiagram::valueForCell().
210 {
86 {
87 return d->axesList;
88 }
124 {
125 return qVariantValue<BarAttributes>(
126 d->attributesModel->data(
127 d->attributesModel->mapFromSource( index ),
128 KDChart::BarAttributesRole ) );
129 }
116 {
117 return qVariantValue<BarAttributes>(
118 d->attributesModel->data(
119 d->attributesModel->mapFromSource( columnToIndex( column ) ),
120 KDChart::BarAttributesRole ) );
121 }
110 {
111 return qVariantValue<BarAttributes>(
112 d->attributesModel->data( KDChart::BarAttributesRole ) );
113 }
Retrieve the brush to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The brush to use for painting.
638 :
QRect AbstractDiagram::visualRect(const QModelIndex &) const
Parameters:
dataset The dataset to retrieve the brush for.
Returns:
The brush to use for painting.
631 {
Returns:
The brush to use for painting.
623 {
[reimplemented]
Implements KDChart::AbstractDiagram.
Definition at line 199 of file KDChartBarDiagram.cpp.
References KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AbstractDiagram::check-
Invariants(), KDChart::AbstractDiagram::coordinatePlane(), d, threeDItemDepth(), KDChart::Abstract-
CoordinatePlane::translate(), and type().
200 {
201 if ( !checkInvariants() ) return QPair<QPointF, QPointF>( QPointF( 0, 0 ), QPointF( 0, 0 ) );
202 const int rowCount = d->attributesModel->rowCount(attributesModelRootIndex());
203 const int colCount = d->attributesModel->columnCount(attributesModelRootIndex());
204
205 double xMin = 0;
206 double xMax = rowCount;
207 double yMin = 0, yMax = 0;
208 double maxThreeDDepth = 0.0;
209 double firstThreeDDepth = 0.0;
210 double lastThreeDDepth = 0.0;
211
212 bool bStarting = true;
213 // calculate boundaries for different line types Normal - Stacked - Percent - Default Normal
214 switch ( type() ){
215 case BarDiagram::Normal:
216 {
217 for ( int i=0; i<colCount; ++i ) {
218 for ( int j=0; j< rowCount; ++j ) {
219 const double value = d->attributesModel->data( d->attributesModel->index( j, i, at
220 // this is always true yMin can be 0 in case all values
221 // are the same
222 // same for yMax it can be zero if all values are negative
223 yMin = qMin( yMin, value );
224 yMax = qMax( yMax, value );
225
226 const double depth = threeDItemDepth( model()->index( j, i, rootIndex() ) );
227 if( depth > 0.0 ){
228 maxThreeDDepth = qMax( maxThreeDDepth, depth );
229 if( bStarting )
230 firstThreeDDepth = depth;
231 lastThreeDDepth = depth;
232 }
233 bStarting = false;
234 }
235 }
236 }
237 break;
238 case BarDiagram::Stacked:
239 {
240 for ( int j=0; j< rowCount; ++j ) {
241 // calculate sum of values per column - Find out stacked Min/Max
242 double stackedValues = 0;
243 for ( int i=0; i<colCount ; ++i ) {
244 QModelIndex idx = model()->index( j, i, rootIndex() );
245 stackedValues += model()->data( idx ).toDouble();
246 // this is always true yMin can be 0 in case all values
247 // are the same
248 // same for yMax it can be zero if all values are negative
249 yMin = qMin( yMin, stackedValues );
250 yMax = qMax( yMax, stackedValues );
251
252 const double depth = threeDItemDepth( idx );
253 if( depth > 0.0 ){
254 maxThreeDDepth = qMax( maxThreeDDepth, depth );
255 if( bStarting )
256 firstThreeDDepth = depth;
257 lastThreeDDepth = depth;
258 }
259 bStarting = false;
260 }
261 }
262 }
263 break;
264 case BarDiagram::Percent:
265 {
266 for ( int i=0; i<colCount; ++i ) {
267 for ( int j=0; j< rowCount; ++j ) {
268 // Ordinate should begin at 0 the max value being the 100% pos
269 QModelIndex idx = model()->index( j, i, rootIndex() );
270 // only positive values are handled
271 double value = model()->data( idx ).toDouble();
272 yMax = qMax( yMax, value );
273 const double depth = threeDItemDepth( idx );
274 if( depth > 0.0 ){
275 maxThreeDDepth = qMax( maxThreeDDepth, depth );
276 if( bStarting )
277 firstThreeDDepth = depth;
278 lastThreeDDepth = depth;
279 }
280 bStarting = false;
281 }
282 }
283 break;
284 }
285 default:
286 Q_ASSERT_X ( false, "calculateDataBoundaries()",
287 "Type item does not match a defined bar chart Type." );
288 }
289
290 // special cases
291 if ( yMax == yMin ) {
292 if ( yMin == 0.0 )
293 yMax = 0.1; //we need at list a range
294 else
295 yMax = 0.0; // they are the same but negative
296 }
297 QPointF bottomLeft ( QPointF( xMin, yMin ) );
298 QPointF topRight ( QPointF( xMax, yMax ) );
299
300 //FIXME(khz): Verify, if this code is right: We are taking
746 {
747 Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
748 "There is no usable model set, for the diagram." );
749
750 Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
751 "There is no usable coordinate plane set, for the diagram." );
752 }
753 return model() && coordinatePlane();
754 }
755
756 int AbstractDiagram::datasetDimension( ) const
68 {
69 return new BarDiagram( new Private( *d ) );
70 }
217 {
126 {
127 return d->plane;
128 }
Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these
values).
This method returns a chached result of calculations done by calculateDataBoundaries. Classes derived
from AbstractDiagram must implement the calculateDataBoundaries function, to specify their own way of
calculating the data boundaries. If derived classes want to force recalculation of the data boundaries, they
can call setDataBoundariesDirty()
Returned value is in diagram coordinates.
Definition at line 130 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::calculateDataBoundaries(), and d.
Referenced by KDChart::CartesianCoordinatePlane::calculateRawDataBoundingRect(), KDChart::Polar-
CoordinatePlane::layoutDiagrams(), KDChart::LineDiagram::paint(), and paint().
131 {
132 if( d->databoundariesDirty ){
133 d->databoundaries = calculateDataBoundaries ();
134 d->databoundariesDirty = false;
135 }
136 return d->databoundaries;
137 }
[reimplemented]
Definition at line 232 of file KDChartAbstractDiagram.cpp.
References d.
232 {
233 // We are still too dumb to do intelligent updates...
234 d->databoundariesDirty = true;
235 scheduleDelayedItemsLayout();
236 }
237
238 void AbstractDiagram::setDataValueAttributes( const QModelIndex & index,
The set of dataset brushes currently used, for use in legends, etc.
Note:
Cell-level override brushes, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the brush, that is used for a single cell.
Returns:
The current set of dataset brushes.
712 {
713 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( i, Qt::Vertical, DatasetB
714 ret << brush;
715 }
716
717 return ret;
718 }
719
720 QList<QPen> AbstractDiagram::datasetPens() const
The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to
have.
For each dimension it will expect one column of values in the model. If the dimensionality is 1, automatic
values will be used for the abscissa.
For example a diagram with the default dimension of 1, will have one column per datapoint (the y values)
and will use automatic values for the x axis (1, 2, 3, ... n). If the dimension is 2, the diagram will use the
first, (and the third, fifth, etc) columns as X values, and the second, (and the fourth, sixth, etc) column as Y
values.
Returns:
The dataset dimension of the diagram.
762 {
The set of dataset labels currently displayed, for use in legends, etc.
Returns:
The set of dataset labels currently displayed.
The set of dataset markers currently used, for use in legends, etc.
Note:
Cell-level override markers, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the marker, that is shown for a single cell.
Returns:
The current set of dataset brushes.
735 {
736 DataValueAttributes a =
737 qVariantValue<DataValueAttributes>( attributesModel()->headerData( i, Qt::Vertical, DataVa
738 const MarkerAttributes &ma = a.markerAttributes();
739 ret << ma;
740 }
741 return ret;
742 }
743
744 bool AbstractDiagram::checkInvariants( bool justReturnTheStatus ) const
The set of dataset pens currently used, for use in legends, etc.
Note:
Cell-level override pens, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the pens, that is used for a single cell.
Returns:
The current set of dataset pens.
724 {
725 QPen pen = qVariantValue<QPen>( attributesModel()->headerData( i, Qt::Vertical, DatasetPenRole
726 ret << pen;
727 }
728 return ret;
729 }
730
731 QList<MarkerAttributes> AbstractDiagram::datasetMarkers() const
Parameters:
index The datapoint to retrieve the attributes for.
Returns:
The DataValueAttributes for the given index.
278 {
Parameters:
dataset The dataset to retrieve the attributes for.
Returns:
The DataValueAttributes for the given dataset.
271 {
Returns:
The global DataValueAttributes.
264 {
[reimplemented]
Definition at line 223 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::update().
223 {
224 d->plane->layoutDiagrams();
225 update();
226 }
227 QAbstractItemView::doItemsLayout();
228 }
229
230 void AbstractDiagram::dataChanged( const QModelIndex &topLeft,
[reimplemented]
Definition at line 655 of file KDChartAbstractDiagram.cpp.
657 { return 0; }
[reimplemented]
Definition at line 649 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 661 of file KDChartAbstractDiagram.cpp.
663 {}
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Returns:
The set of item row labels currently displayed.
91 {
92 //qDebug() << "KDChart::AbstractCartesianDiagram::layoutPlanes()";
93 AbstractCoordinatePlane* plane = coordinatePlane();
94 if( plane ){
95 plane->layoutPlanes();
96 //qDebug() << "KDChart::AbstractCartesianDiagram::layoutPlanes() OK";
97 }
98 }
This signal is emitted, when either the model or the AttributesModel is replaced.
Referenced by KDChart::AbstractDiagram::setAttributesModel(), and KDChart::AbstractDiagram::set-
Model().
[reimplemented]
Definition at line 652 of file KDChartAbstractDiagram.cpp.
654 { return 0; }
[reimplemented]
Implements KDChart::AbstractCartesianDiagram.
Definition at line 667 of file KDChartBarDiagram.cpp.
References KDChart::AbstractDiagram::attributesModelRootIndex(), and d.
668 {
669 return d->attributesModel->rowCount(attributesModelRootIndex());
670 }
[reimplemented]
Implements KDChart::AbstractCartesianDiagram.
Definition at line 672 of file KDChartBarDiagram.cpp.
References KDChart::AbstractDiagram::attributesModelRootIndex(), and d.
673 {
674 return d->attributesModel->columnCount(attributesModelRootIndex());
675 }
Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context.
Parameters:
paintContext All information needed for painting.
Implements KDChart::AbstractDiagram.
Definition at line 376 of file KDChartBarDiagram.cpp.
377 {
378 if ( !checkInvariants() )
379 return;
380 // Calculate width
381 QPointF boundLeft, boundRight;
382 QPair<QPointF,QPointF> boundaries = dataBoundaries();
383 if( !AbstractGrid::isBoundariesValid(boundaries) ) return;
384 boundLeft = coordinatePlane()->translate( boundaries.first );
385 boundRight = coordinatePlane()->translate( boundaries.second );
386 double width = boundRight.x() - boundLeft.x();
387 //calculates and stores the values
388 const int rowCount = d->attributesModel->rowCount(attributesModelRootIndex());
389 const int colCount = d->attributesModel->columnCount(attributesModelRootIndex());
390 DataValueTextInfoList list;
391 BarAttributes ba = barAttributes( model()->index( 0, 0, rootIndex() ) );
392 double barWidth = 0;
393 double maxDepth = 0;
394 double spaceBetweenBars = 0;
395 double spaceBetweenGroups = 0;
396 double groupWidth = /*ctx->rectangle().width() / ( rowCount + 2 )*/ width/ (rowCount + 2);
397
398
399 if ( ba.useFixedBarWidth() ) {
400 barWidth = ba.fixedBarWidth();
401 groupWidth += barWidth;
402
403 // Pending Michel set a min and max value for the groupWidth related to the area.width
404 // FixMe
405 if ( groupWidth < 0 )
406 groupWidth = 0;
407
408 if ( groupWidth * rowCount > ctx->rectangle().width() )
409 groupWidth = ctx->rectangle().width() / rowCount;
410 }
411
412 // maxLimit: allow the space between bars to be larger until area.width() is covered by the groups
413 double maxLimit = rowCount * (groupWidth + ((colCount-1) * ba.fixedDataValueGap()) );
414
415 //Pending Michel: FixMe
416 if ( ba.useFixedDataValueGap() ) {
417 if ( ctx->rectangle().width() > maxLimit )
418 spaceBetweenBars += ba.fixedDataValueGap();
419 else
420 spaceBetweenBars = ((ctx->rectangle().width()/rowCount) - groupWidth)/(colCount-1);
421 }
422
423 //Pending Michel: FixMe
424 if ( ba.useFixedValueBlockGap() )
425 spaceBetweenGroups += ba.fixedValueBlockGap();
426
427 calculateValueAndGapWidths( rowCount, colCount,groupWidth,
428 barWidth, spaceBetweenBars, spaceBetweenGroups );
429
430 // paint different bar types: Normal - Stacked - Percent
431 switch ( type() )
432 {
433 case BarDiagram::Normal:
434 {
435 // we paint the bars for all series next to each other, then move to the next value
436 for ( int i=0; i<rowCount; ++i ) {
437 double offset = -groupWidth/2 + spaceBetweenGroups/2;
438 // case fixed data value gap - handles max and min limits as well
439 if ( ba.useFixedDataValueGap() ) {
440 if ( spaceBetweenBars > 0 ) {
441 if ( ctx->rectangle().width() > maxLimit )
442 offset -= ba.fixedDataValueGap();
443 else
444 offset -= ((ctx->rectangle().width()/rowCount) - groupWidth)/(colCount-1);
445
446 } else {
447 //allow reducing the gap until the bars are displayed next to each other - nul
448 offset += barWidth/2;
449 }
450 }
451
452 for ( int j=0; j< colCount; ++j ) {
453 // paint one group
454 const double value = d->attributesModel->data( d->attributesModel->index( i, j, at
455 QPointF topPoint = coordinatePlane()->translate( QPointF( i + 0.5, value ) );
456 QPointF bottomPoint = coordinatePlane()->translate( QPointF( i, 0 ) );
457 const double barHeight = bottomPoint.y() - topPoint.y();
458 topPoint.setX( topPoint.x() + offset );
459 //PENDING Michel: FIXME barWidth
460 QModelIndex index = model()->index( i, j, rootIndex() );
461 list.append( DataValueTextInfo( index, topPoint, value ) );
462 paintBars( ctx, index, QRectF( topPoint, QSizeF( barWidth, barHeight ) ), maxDepth
463
464 offset += barWidth + spaceBetweenBars;
465 }
466 }
467 }
468 break;
469 case BarDiagram::Stacked:
470 {
471 for ( int i = 0; i<colCount; ++i ) {
472 double offset = spaceBetweenGroups;
473 for ( int j = 0; j< rowCount; ++j ) {
474 QModelIndex index = model()->index( j, i, rootIndex() );
475 ThreeDBarAttributes tda = threeDBarAttributes( index );
476 double value = 0, stackedValues = 0;
477 QPointF point, previousPoint;
478
479 if ( tda.isEnabled() ) {
480 if ( barWidth > 0 )
481 barWidth = (width - ((offset+(tda.depth()))*rowCount))/ rowCount;
482 if ( barWidth <= 0 ) {
483 barWidth = 0;
484 maxDepth = offset - (width/rowCount);
485 }
486 } else
487 barWidth = (ctx->rectangle().width() - (offset*rowCount))/ rowCount ;
488
489 value = model()->data( index ).toDouble();
490 for ( int k = i; k >= 0 ; --k )
491 stackedValues += model()->data( model()->index( j, k, rootIndex() ) ).toDouble(
492 point = coordinatePlane()->translate( QPointF( j, stackedValues ) );
493 point.setX( point.x() + offset/2 );
494 previousPoint = coordinatePlane()->translate( QPointF( j, stackedValues - value ) )
495 const double barHeight = previousPoint.y() - point.y();
496 list.append( DataValueTextInfo( index, point, value ) );
497 paintBars( ctx, index, QRectF( point, QSizeF( barWidth , barHeight ) ), maxDepth );
498 }
499
500 }
501 }
502 break;
503 case BarDiagram::Percent:
504 {
505 double maxValue = 100; // always 100 %
506 double sumValues = 0;
507 QVector <double > sumValuesVector;
508
509 //calculate sum of values for each column and store
510 for ( int j=0; j<rowCount; ++j ) {
511 for ( int i=0; i<colCount; ++i ) {
512 double tmpValue = model()->data( model()->index( j, i, rootIndex() ) ).toDouble();
513 if ( tmpValue > 0 )
514 sumValues += tmpValue;
515 if ( i == colCount-1 ) {
516 sumValuesVector << sumValues ;
517 sumValues = 0;
518 }
519 }
520 }
521
522 // calculate stacked percent value
523 for ( int i = 0; i<colCount; ++i ) {
524 double offset = spaceBetweenGroups;
525 for ( int j=0; j<rowCount ; ++j ) {
526 double value = 0, stackedValues = 0;
527 QPointF point, previousPoint;
528 QModelIndex index = model()->index( j, i, rootIndex() );
529 ThreeDBarAttributes tda = threeDBarAttributes( index );
530
531 if ( tda.isEnabled() ) {
532 if ( barWidth > 0 )
533 barWidth = (width - ((offset+(tda.depth()))*rowCount))/ rowCount;
534 if ( barWidth <= 0 ) {
535 barWidth = 0;
536 maxDepth = offset - ( width/rowCount);
537 }
538 }
539 else
540 barWidth = (ctx->rectangle().width() - (offset*rowCount))/ rowCount;
541
542 value = model()->data( index ).toDouble();
543
544 // calculate stacked percent value
545 // we only take in account positives values for now.
546 for ( int k = i; k >= 0 ; --k ) {
547 double val = model()->data( model()->index( j, k, rootIndex() ) ).toDouble();
548 if ( val > 0)
549 stackedValues += val;
550 }
551
552 if ( sumValuesVector.at( j ) != 0 && value > 0 ) {
553 point = coordinatePlane()->translate( QPointF( j, stackedValues/sumValuesVect
554
555 point.setX( point.x() + offset/2 );
556
557 previousPoint = coordinatePlane()->translate( QPointF( j, (stackedValues - val
558 }
559 const double barHeight = previousPoint.y() - point.y();
560
561 list.append( DataValueTextInfo( index, point, value ) );
562 paintBars( ctx, index, QRectF( point, QSizeF( barWidth, barHeight ) ), maxDepth );
563
564 }
565 }
566 }
567 break;
568 default:
569 Q_ASSERT_X ( false, "paint()",
570 "Type item does not match a defined bar chart Type." );
571 }
572
573 DataValueTextInfoListIterator it( list );
574 while ( it.hasNext() ) {
575 const DataValueTextInfo& info = it.next();
576 paintDataValueText( ctx->painter(), info.index, info.pos, info.value );
577 }
578 }
320 {
321 // paint one data series
322 DataValueAttributes a = dataValueAttributes(index);
323 if ( !a.isVisible() ) return;
324
325 // handle decimal digits
326 int decimalDigits = a.decimalDigits();
327 int decimalPos = QString::number( value ).indexOf( QLatin1Char( ’.’ ) );
328 QString roundedValue;
329 if ( a.dataLabel().isNull() ) {
330 if ( decimalPos > 0 && value != 0 )
331 roundedValue = roundValues ( value, decimalPos, decimalDigits );
332 else
333 roundedValue = QString::number( value );
334 } else
335 roundedValue = a.dataLabel();
336 // handle prefix and suffix
337 if ( !a.prefix().isNull() )
338 roundedValue.prepend( a.prefix() );
339
340 if ( !a.suffix().isNull() )
341 roundedValue.append( a.suffix() );
342
343 PainterSaver painterSaver( painter );
344 // FIXME draw the non-text bits, background, etc
345 const TextAttributes &ta = a.textAttributes();
346 if ( ta.isVisible() ) {
347 painter->setPen( ta.pen() );
348 painter->setFont( ta.font() );
349 painter->translate( pos );
350 painter->rotate( ta.rotation() );
351 painter->drawText( QPointF(0, 0), roundedValue );
352 }
353 }
354
385 {
386 for ( int j=0; j< rowCount; ++j ) {
387 const QModelIndex index = model()->index( j, i, rootIndex() );
388 double value = model()->data( index ).toDouble();
389 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
390 paintDataValueText( painter, index, pos, value );
391 }
392 }
393 }
394
395
399 {
400
401 if ( !checkInvariants() ) return;
402 DataValueAttributes a = dataValueAttributes(index);
403 if ( !a.isVisible() ) return;
404 const MarkerAttributes &ma = a.markerAttributes();
405 if ( !ma.isVisible() ) return;
406
407 PainterSaver painterSaver( painter );
408 QSizeF maSize( ma.markerSize() );
409 QBrush indexBrush( brush( index ) );
410 QPen indexPen( ma.pen() );
411 if ( ma.markerColor().isValid() )
412 indexBrush.setColor( ma.markerColor() );
413
414 paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
415 }
416
417
References KDChart::MarkerAttributes::markerStyle().
Referenced by KDChart::LineDiagram::paint(), KDChart::MarkerLayoutItem::paint(), and
KDChart::AbstractDiagram::paintMarker().
424 {
425 PainterSaver painterSaver( painter );
426 painter->setBrush( brush );
427 painter->setPen( pen );
428 painter->setRenderHint ( QPainter::Antialiasing );
429 painter->translate( pos );
430 switch ( markerAttributes.markerStyle() ) {
431 case MarkerAttributes::MarkerCircle:
432 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
433 maSize.height(), maSize.width()) );
434 break;
435 case MarkerAttributes::MarkerSquare:
436 {
437 QRectF rect( 0 - maSize.height()/2, 0 - maSize.width()/2,
438 maSize.height(), maSize.width() );
439 painter->drawRect( rect );
440 painter->fillRect( rect, painter->brush() );
441 break;
442 }
443 case MarkerAttributes::MarkerDiamond:
444 {
445 QVector <QPointF > diamondPoints;
446 QPointF top, left, bottom, right;
447 top = QPointF( 0, 0 - maSize.height()/2 );
448 left = QPointF( 0 - maSize.width()/2, 0 );
449 bottom = QPointF( 0, maSize.height()/2 );
450 right = QPointF( maSize.width()/2, 0 );
451 diamondPoints << top << left << bottom << right;
452 painter->drawPolygon( diamondPoints );
453 break;
454 }
455 //Pending Michel: do we need that? Ask: What is the idea about
456 // Marker1Pixel and Marker4Pixels.
457 case MarkerAttributes::Marker1Pixel:
458 {
459 QSizeF pSize(4,4);
460 QPen pen1Pixel;
461 pen1Pixel.setColor( painter->background().color() );
462 QRectF centerRect( -pSize.height()/2, -pSize.width()/2,
463 pSize.height(), pSize.width() );
464 painter->setPen( pen1Pixel );
465 painter->drawEllipse( centerRect );
466 break;
467 }
468 case MarkerAttributes::Marker4Pixels:
469 {
470 QSizeF pSize(8, 8);
471 QPen pen4Pixel;
472 pen4Pixel.setColor( painter->background().color() );
473 QRectF centerRect( -pSize.height()/2, -pSize.width()/2,
474 pSize.height(), pSize.width() );
475 painter->setPen( pen4Pixel );
476 painter->drawEllipse( centerRect );
477 break;
478 }
479 case MarkerAttributes::MarkerRing:
480 {
481 painter->setBrush( Qt::NoBrush );
482 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
483 maSize.height(), maSize.width()) );
484 break;
485 }
535 {
536 for ( int j=0; j< rowCount; ++j ) {
537 const QModelIndex index = model()->index( j, i, rootIndex() );
538 double value = model()->data( index ).toDouble();
539 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
540 paintMarker( painter, index, pos );
541 }
542 }
543 }
544
545
Retrieve the pen to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The pen to use for painting.
593 {
Parameters:
dataset The dataset to retrieve the pen for.
Returns:
The pen to use for painting.
585 {
Returns:
The pen to use for painting.
577 {
320 {
124 {
125 return d->referenceDiagram;
126 }
129 {
130 return d->referenceDiagramOffset;
131 }
Parameters:
area
Implements KDChart::AbstractDiagram.
Definition at line 663 of file KDChartBarDiagram.cpp.
664 {
665 }
195 {
196
197 }
[reimplemented]
Definition at line 646 of file KDChartAbstractDiagram.cpp.
Parameters:
allow True means that overlapping labels are allowed.
290 {
Parameters:
enabled True means that AA is enabled.
301 {
Wrong:
diagram1->setAttributesModel( diagram2->attributesModel() );
Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel
161 {
162 if( amodel->sourceModel() != model() ) {
163 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
164 "Trying to set an attributesmodel which works on a different "
165 "model than the diagram.");
166 return;
167 }
168 if( qobject_cast<PrivateAttributesModel*>(amodel) ) {
169 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
170 "Trying to set an attributesmodel that is private to another diagram.");
171 return;
172 }
173 d->setAttributesModel(amodel);
174 scheduleDelayedItemsLayout();
175 d->databoundariesDirty = true;
176 emit modelsChanged();
177 }
102 {
103 attributesModel()->setData(
104 d->attributesModel->mapFromSource( index ),
105 qVariantFromValue( ta ),
106 BarAttributesRole );
107 }
94 {
95 d->attributesModel->setHeaderData(
96 column, Qt::Vertical,
97 qVariantFromValue( ta ),
98 BarAttributesRole );
99 }
89 {
90 d->attributesModel->setModelData( qVariantFromValue( ta ), BarAttributesRole );
91 }
Set the brush to be used, for painting all datasets in the model.
Parameters:
brush The brush to use.
608 {
6.16.3.62 void AbstractDiagram::setBrush (int dataset, const QBrush & brush) [inherited]
Parameters:
dataset The dataset’s column in the model.
pen The brush to use.
617 {
6.16.3.63 void AbstractDiagram::setBrush (const QModelIndex & index, const QBrush & brush)
[inherited]
Set the brush to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
brush The brush to use.
601 {
Returns:
The coordinate plane associated with the diagram.
101 {
102 if( coordinatePlane() ) disconnect( coordinatePlane() );
103 AbstractDiagram::setCoordinatePlane(plane);
104
105 // show the axes, after all have been adjusted
106 // (because they might be dependend on each other)
107 /*
108 if( plane )
109 Q_FOREACH( CartesianAxis* axis, d->axesList )
110 axis->show();
111 else
112 Q_FOREACH( CartesianAxis* axis, d->axesList )
113 axis->hide();
114 */
115 }
140 {
141 d->databoundariesDirty = true;
142 }
See also:
datasetDimension.
Parameters:
dimension
770 {
Parameters:
a The attributes to set.
284 {
Parameters:
dataset The dataset to set the attributes for.
a The attributes to set.
259 {
Parameters:
index The datapoint to set the attributes for.
a The attributes to set.
240 {
241 d->attributesModel->setData(
242 d->attributesModel->mapFromSource( index ),
243 qVariantFromValue( a ),
244 DataValueLabelAttributesRole );
245 emit propertiesChanged();
246 }
247
248
145 {
146 QAbstractItemView::setModel( newModel );
147 AttributesModel* amodel = new PrivateAttributesModel( newModel, this );
148 amodel->initFrom( d->attributesModel );
149 d->setAttributesModel(amodel);
150 scheduleDelayedItemsLayout();
151 d->databoundariesDirty = true;
152 emit modelsChanged();
153 }
Set the pen to be used, for painting all datasets in the model.
Parameters:
pen The pen to use.
562 {
6.16.3.72 void AbstractDiagram::setPen (int dataset, const QPen & pen) [inherited]
Parameters:
dataset The dataset’s row in the model.
pen The pen to use.
571 {
6.16.3.73 void AbstractDiagram::setPen (const QModelIndex & index, const QPen & pen)
[inherited]
Set the pen to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
pen The pen to use.
555 {
312 {
118 {
119 d->referenceDiagram = diagram;
120 d->referenceDiagramOffset = offset;
121 }
Set the root index in the model, where the diagram starts referencing data for display.
[reimplemented]
Definition at line 188 of file KDChartAbstractDiagram.cpp.
References d.
[reimplemented]
Definition at line 664 of file KDChartAbstractDiagram.cpp.
149 {
150 setDataBoundariesDirty();
151 d->attributesModel->setData(
152 d->attributesModel->mapFromSource(index),
153 qVariantFromValue( tda ),
154 ThreeDBarAttributesRole );
155 emit layoutChanged( this );
156 }
139 {
140 setDataBoundariesDirty();
141 d->attributesModel->setHeaderData(
142 column, Qt::Vertical,
143 qVariantFromValue( tda ),
144 ThreeDBarAttributesRole );
145 emit layoutChanged( this );
146 }
132 {
133 setDataBoundariesDirty();
134 d->attributesModel->setModelData( qVariantFromValue( tda ), ThreeDBarAttributesRole );
135 emit layoutChanged( this );
136 }
73 {
74 if ( type == d->barType ) return;
75
76 d->barType = type;
77 // AbstractAxis settings - see AbstractDiagram and CartesianAxis
78 setPercentMode( type == BarDiagram::Percent );
79 setDataBoundariesDirty();
80 emit layoutChanged( this );
81 }
See also:
addAxis
76 {
77 const int idx = d->axesList.indexOf( axis );
78 if( idx != -1 )
79 d->axesList.takeAt( idx );
80 axis->deleteObserver( this );
81 axis->setParentWidget( 0 );
82 layoutPlanes();
83 }
173 {
174 return qVariantValue<ThreeDBarAttributes>(
175 d->attributesModel->data(
176 d->attributesModel->mapFromSource(index),
177 KDChart::ThreeDBarAttributesRole ) );
178 }
165 {
166 return qVariantValue<ThreeDBarAttributes>(
167 d->attributesModel->data(
168 d->attributesModel->mapFromSource( columnToIndex( column ) ),
169 KDChart::ThreeDBarAttributesRole ) );
170 }
159 {
160 return qVariantValue<ThreeDBarAttributes>(
161 d->attributesModel->data( KDChart::ThreeDBarAttributesRole ) );
162 }
Implements KDChart::AbstractCartesianDiagram.
Definition at line 185 of file KDChartBarDiagram.cpp.
References d.
186 {
187 return qVariantValue<ThreeDBarAttributes>(
188 d->attributesModel->headerData (
189 column,
190 Qt::Vertical,
191 KDChart::ThreeDBarAttributesRole ) ).validDepth();
192 }
Implements KDChart::AbstractCartesianDiagram.
Definition at line 180 of file KDChartBarDiagram.cpp.
References threeDBarAttributes(), and KDChart::AbstractThreeDAttributes::validDepth().
Referenced by calculateDataBoundaries().
181 {
182 return threeDBarAttributes( index ).validDepth();
183 }
84 {
85 return d->barType;
86 }
Set the palette to be used, for painting datasets to the default palette.
See also:
KDChart::Palette. FIXME: fold into one usePalette (KDChart::Palette&) method
675 {
Set the palette to be used, for painting datasets to the rainbow palette.
See also:
KDChart::Palette.
685 {
Set the palette to be used, for painting datasets to the subdued palette.
See also:
KDChart::Palette.
680 {
Helper method, retrieving the data value (DisplayRole) for a given row and column.
Parameters:
row The row to query.
column The column to query.
Returns:
The value of the display role at the given row and column as a double.
776 {
[reimplemented]
Definition at line 658 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 641 of file KDChartAbstractDiagram.cpp.
645 {}
[reimplemented]
Definition at line 667 of file KDChartAbstractDiagram.cpp.
• KDChartBarDiagram.h
• KDChartBarDiagram.cpp
See also:
PolarAxis, AbstractCartesianDiagram
Public Types
• enum Position {
Bottom,
Top,
Right,
Left }
• ∼CartesianAxis ()
Public Attributes
Protected Attributes
Enumeration values:
Bottom
Top
Right
Left
56 {
57 Bottom,
58 Top,
59 Right,
60 Left
61 };
See also:
AbstractCartesianDiagram::addAxis
6.17.3.2 CartesianAxis::∼CartesianAxis ()
56 {
57 // when we remove the first axis it will unregister itself and
58 // propagate the next one to the primary, thus the while loop
59 while ( d->mDiagram ) {
60 AbstractCartesianDiagram *cd = qobject_cast<AbstractCartesianDiagram*>( d->mDiagram );
61 cd->takeAxis( this );
62 }
63 Q_FOREACH( AbstractDiagram *diagram, d->secondaryDiagrams ) {
64 AbstractCartesianDiagram *cd = qobject_cast<AbstractCartesianDiagram*>( diagram );
65 cd->takeAxis( this );
66 }
67 }
76 {
77 Q_UNUSED( position );
78 // PENDING(kalle) FIXME
79 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosi
80 }
Implements KDChart::AbstractAreaBase.
Definition at line 105 of file KDChartAbstractArea.cpp.
Referenced by KDChart::CartesianCoordinatePlane::drawingArea(), KDChart::PolarCoordinate-
Plane::layoutDiagrams(), paint(), KDChart::AbstractArea::paintAll(), and paintCtx().
106 {
107 return geometry();
108 }
98 {
99 return d->backgroundAttributes;
100 }
See also:
AbstractCartesianDiagram::addAxis()
193 {
194 if( d->observer ){
195 connect( d->observer, SIGNAL( diagramDataChanged( AbstractDiagram *) ),
196 this, SLOT( update() ) );
197 }
198 }
Convenience function, returns the coordinate plane, in which this axis is used.
If the axis is not used in a coordinate plane, the return value is Zero.
Definition at line 293 of file KDChartAbstractAxis.cpp.
References d.
294 {
295 if( d->diagram() )
296 return d->diagram()->coordinatePlane();
297 return 0;
298 }
159 {
160 if( d->setDiagram( diagram, this ) )
161 connectSignals();
162 }
175 {
176 d->unsetDiagram( diagram, this );
177 }
301 {
302 return d->diagram();
303 }
690 {
691 Qt::Orientations ret;
692 switch ( position() )
693 {
694 case Bottom:
695 case Top:
696 ret = Qt::Horizontal;
697 break;
698 case Left:
699 case Right:
700 ret = Qt::Vertical;
701 break;
702 default:
703 Q_ASSERT( false ); // all positions need to be handeld
704 break;
705 };
706 return ret;
707 }
88 {
89 return d->frameAttributes;
90 }
828 {
829 return d->geometry;
830 }
112 {
113 return d->useDefaultTextAttributes;
114 }
176 {
177 Q_ASSERT_X ( d != 0, "AbstractAreaBase::innerRect()",
178 "Private class was not initialized!" );
179
180 const int padding
181 = d->frameAttributes.isVisible()
182 ? qMax( d->frameAttributes.padding(), 0 ) : 0;
183 return
184 QRect( QPoint(0,0), areaGeometry().size() )
185 .adjusted( padding, padding, -padding, -padding );
186 }
140 {
141 return position() == Bottom || position() == Top;
142 }
685 {
686 return false; // if the axis exists, it has some (perhaps default) content
687 }
145 {
146 return position() == Left || position() == Right;
147 }
Returns a list of strings, that are used as axis labels, as set via setLabels.
See also:
setLabels
255 {
256 return d->hardLabels;
257 }
128 {
129 //qDebug() << "CartesianAxis::layoutPlanes()";
130 if( ! d->diagram() || ! d->diagram()->coordinatePlane() ) return;
131 //qDebug() << "CartesianAxis::layoutPlanes(): Sorry, found no plane.";
132 AbstractCoordinatePlane* plane = d->diagram()->coordinatePlane();
133 if( plane ){
134 plane->layoutPlanes();
135 //qDebug() << "CartesianAxis::layoutPlanes() OK";
136 }
137 }
710 {
711 QSize result;
712 if ( !d->diagram() )
713 return result;
714
715 const TextAttributes labelTA = textAttributes();
716 const bool drawLabels = labelTA.isVisible();
717
718 const TextAttributes titleTA( titleTextAttributes() );
719 const bool drawTitle = titleTA.isVisible() && ! titleText().isEmpty();
720
721 AbstractCoordinatePlane* plane = d->diagram()->coordinatePlane();
722 QObject* refArea = plane->parent();
723 TextLayoutItem labelItem( QString::null, labelTA, refArea,
724 KDChartEnums::MeasureOrientationMinimum, Qt::AlignLeft );
725 TextLayoutItem titleItem( titleText(), titleTA, refArea,
726 KDChartEnums::MeasureOrientationMinimum, Qt::AlignHCenter | Qt::AlignVCenter );
727 const qreal labelGap =
728 drawLabels
729 ? (QFontMetricsF( labelItem.realFont() ).height() / 3.0)
730 : 0.0;
731 const qreal titleGap =
732 drawTitle
733 ? (QFontMetricsF( titleItem.realFont() ).height() / 3.0)
734 : 0.0;
735
736 switch ( position() )
737 {
738 case Bottom:
739 case Top: {
740 qreal h = 0;
741 if( drawLabels ){
742 // if there’re no label strings, we take the biggest needed number as height
743 if ( ! labels().count() )
744 {
745 labelItem.setText( QString::number( plane->gridDimensionsList().first().end, ’f’,
746 h = labelItem.sizeHint().height();
747 }else{
748 // find the longest label text:
749 for ( int i = 0; i < labels().count(); ++i )
750 {
751 labelItem.setText( labels()[ i ] );
752 qreal lh = labelItem.sizeHint().height();
753 h = qMax( h, lh );
754 }
755 }
756 // we leave a little gap between axis labels and bottom (or top, resp.) side of axis
757 h += labelGap;
758 }
759 // space for a possible title:
760 if ( drawTitle ) {
761 // we add the title height and leave a little gap between axis labels and axis title
762 h += titleItem.sizeHint().height() + titleGap;
763 }
764 // space for the ticks
765 h += qAbs( tickLength() ) * 3.0;
766 result = QSize ( 10, static_cast<int>( h ) );
767 }
768 break;
769 case Left:
770 case Right: {
771 qreal w = 0;
772 if( drawLabels ){
773 // if there’re no label strings, we take the biggest needed number as width
774 if ( labels().count() == 0 )
775 {
776 labelItem.setText( QString::number( plane->gridDimensionsList().last().end, ’f’, 0
777 w = labelItem.sizeHint().width();
778 }else{
779 // find the longest label text:
780 for ( int i = 0; i < labels().count(); ++i )
781 {
782 labelItem.setText( labels()[ i ] );
783 qreal lw = labelItem.sizeHint().width();
784 w = qMax( w, lw );
785 }
786 }
787 // we leave a little gap between axis labels and left (or right, resp.) side of axis
788 w += labelGap;
789 }
790 // space for a possible title:
791 if ( drawTitle ) {
792 // we add the title height and leave a little gap between axis labels and axis title
793 w += titleItem.sizeHint().height() + titleGap;
794 }
795 // space for the ticks
796 w += qAbs( tickLength() ) * 3.0;
797
798 result = QSize ( static_cast<int>( w ), 10 );
799 // qDebug() << "left/right axis width:" << result << " w:" << w;
800 }
801 break;
802 default:
803 Q_ASSERT( false ); // all positions need to be handled
804 break;
805 };
806 //qDebug() << "*******************" << result;
807 return result;
808 }
811 {
812 return maximumSize();
813 }
306 {
307 return d->hasDiagram( diagram );
308 }
reimpl
Implements KDChart::AbstractLayoutItem.
Definition at line 168 of file KDChartCartesianAxis.cpp.
References KDChart::AbstractArea::areaGeometry(), d, paintCtx(), KDChart::PaintContext::set-
CoordinatePlane(), KDChart::PaintContext::setPainter(), and KDChart::PaintContext::setRectangle().
169 {
170 //qDebug() << "KDChart::CartesianAxis::paint() called";
171 if( ! d->diagram() || ! d->diagram()->coordinatePlane() ) return;
172 PaintContext ctx;
173 ctx.setPainter ( painter );
174 ctx.setCoordinatePlane( d->diagram()->coordinatePlane() );
175 const QRect rect( areaGeometry() );
176
177 //qDebug() << "CartesianAxis::paint( QPainter* painter ) " << " areaGeometry()():" << rect << " s
178
179 ctx.setRectangle(
180 QRectF (
181 //QPointF(0, 0),
182 QPointF(rect.left(), rect.top()),
183 QSizeF(rect.width(), rect.height() ) ) );
184 // enabling clipping so that we’re not drawing outside
185 QRegion clipRegion( rect.adjusted( -1, -1, 1, 1 ) );
186 painter->setClipRegion( clipRegion );
187 paintCtx( &ctx );
188 painter->setClipping( false );
189 //qDebug() << "KDChart::CartesianAxis::paint() done.";
190 }
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked
automatically.
Definition at line 83 of file KDChartAbstractArea.cpp.
References KDChart::AbstractArea::areaGeometry(), KDChart::AbstractAreaBase::innerRect(),
KDChart::AbstractLayoutItem::paint(), KDChart::AbstractAreaBase::paintBackground(), and
KDChart::AbstractAreaBase::paintFrame().
Referenced by KDChart::Chart::paint(), and KDChart::AbstractArea::paintIntoRect().
84 {
85 // Paint the background and frame
86 paintBackground( painter, geometry() );
87 paintFrame( painter, geometry() );
88
89 // temporarily adjust the widget size, to be sure all content gets calculated
90 // to fit into the inner rectangle
91 const QRect oldGeometry( areaGeometry() );
92 QRect inner( innerRect() );
93 inner.moveTo(
94 oldGeometry.left() + inner.left(),
95 oldGeometry.top() + inner.top() );
96 const bool needAdjustGeometry = oldGeometry != inner;
97 if( needAdjustGeometry )
98 setGeometry( inner );
99 paint( &painter );
100 if( needAdjustGeometry )
101 setGeometry( oldGeometry );
102 //qDebug() << "AbstractAreaWidget::paintAll() done.";
103 }
104 {
105 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
106 "Private class was not initialized!" );
107
108 #define attributes d->backgroundAttributes
109
110 if( !attributes.isVisible() ) return;
111
112 /* first draw the brush (may contain a pixmap)*/
113 if( Qt::NoBrush != attributes.brush().style() ) {
114 KDChart::PainterSaver painterSaver( &painter );
115 painter.setPen( Qt::NoPen );
116 const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
117 painter.setBrushOrigin( newTopLeft );
118 painter.setBrush( attributes.brush() );
119 painter.drawRect( rect );
120 }
121 /* next draw the backPixmap over the brush */
122 if( !attributes.pixmap().isNull() &&
123 attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) {
124 QPointF ol = rect.topLeft();
125 if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() )
126 {
127 ol.setX( rect.center().x() - attributes.pixmap().width() / 2 );
128 ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 );
129 painter.drawPixmap( ol, attributes.pixmap() );
130 } else {
131 QMatrix m;
132 double zW = (double)rect.width() / (double)attributes.pixmap().width();
133 double zH = (double)rect.height() / (double)attributes.pixmap().height();
134 switch( attributes.pixmapMode() ) {
135 case BackgroundAttributes::BackgroundPixmapModeScaled:
136 {
137 double z;
138 z = qMin( zW, zH );
139 m.scale( z, z );
140 }
141 break;
142 case BackgroundAttributes::BackgroundPixmapModeStretched:
143 m.scale( zW, zH );
144 break;
145 default:
reimpl
Reimplemented from KDChart::AbstractLayoutItem.
Definition at line 193 of file KDChartCartesianAxis.cpp.
References KDChart::AbstractArea::areaGeometry(), Bottom, KDChart::DataDimension::calcMode,
KDChart::PaintContext::coordinatePlane(), d, KDChart::DataDimensionsList, KDChart::Data-
Dimension::distance(), KDChart::DataDimension::end, KDChart::TextLayoutItem::geometry(),
KDChart::AbstractCoordinatePlane::gridDimensionsList(), KDChart::TextLayoutItem::intersects(),
isAbscissa(), KDChart::DataDimension::isCalculated, isOrdinate(), KDChart::TextAttributes::isVisible(),
KDChart::AbstractAxis::labels(), Left, KDChart::TextLayoutItem::paint(), KDChart::AbstractCoordinate-
Plane::parent(), position(), ptr, KDChart::TextLayoutItem::realFont(), Right, KDChart::TextLayout-
Item::setGeometry(), KDChart::TextLayoutItem::setText(), KDChart::AbstractAxis::shortLabels(),
KDChart::TextLayoutItem::sizeHint(), KDChart::DataDimension::start, KDChart::DataDimension::step-
Width, KDChart::DataDimension::subStepWidth, KDChart::TextLayoutItem::text(), KDChart::Abstract-
Axis::textAttributes(), tickLength(), titleText(), titleTextAttributes(), Top, and KDChart::Cartesian-
CoordinatePlane::translate().
Referenced by paint().
194 {
195 //qDebug() << "KDChart::CartesianAxis::paintCtx() called";
196
197 Q_ASSERT_X ( d->diagram(), "CartesianAxis::paint",
198 "Function call not allowed: The axis is not assigned to any diagram." );
199
200 CartesianCoordinatePlane* plane = dynamic_cast<CartesianCoordinatePlane*>(context->coordinatePlane
201 Q_ASSERT_X ( plane, "CartesianAxis::paint",
202 "Bad function call: PaintContext::coodinatePlane() NOT a cartesian plane." );
203
204 const int MinimumPixelsBetweenRulers = 5;
205 DataDimensionsList dimensions( plane->gridDimensionsList() );
206 // test for programming errors: critical
207 Q_ASSERT_X ( dimensions.count() == 2, "CartesianAxis::paint",
208 "Error: plane->gridDimensionsList() did not return exactly two dimensions." );
209 DataDimension& dimX = dimensions.first();
210 const DataDimension& dimY = dimensions.last();
211 const DataDimension& dim = (isAbscissa() ? dimensions.first() : dimensions.last());
212 // if(isAbscissa())
213 // qDebug() << " " << "Abscissa:" << dimX.start <<".."<<dimX.end;
214 // else
215 // qDebug() << " " << "Ordinate:" << dimY.start <<".."<<dimY.end;
216
217 // preparations:
218 // - calculate the range that will be displayed:
219 const qreal absRange = qAbs( dim.distance() );
220
221 // Fixme Michel: Need to find the type of chart here - Line or Bar
557 }
558 if ( isLogarithmicY )
559 f *= 10.0;
560 else
561 f += steg;
562 }
563 }
564 if( labelItem )
565 delete labelItem;
566 if( labelItem2 )
567 delete labelItem2;
568 }
569
570 // this draws the subunit rulers
571 if ( drawSubUnitRulers ) {
572 // for the x-axis
573 if ( isAbscissa() ) {
574 int nextMayBeTick = 0;
575 int mayBeTick = 0;
576 float f = minValueX;
577 qreal fLogSubstep = minValueX;
578 int logSubstep = 0;
579 while ( f <= maxValueX ) {
580 QPointF topPoint ( f, 0 );
581 QPointF bottomPoint ( f, 0 );
582 // we don’t draw the sub ticks, if we are at the same position as a normal tick
583 topPoint = plane->translate( topPoint );
584 bottomPoint = plane->translate( bottomPoint );
585 topPoint.setY( fourthRulerRef.y() + tickLength( true ) );
586 bottomPoint.setY( fourthRulerRef.y() );
587 if( drawnXTicks.count() > nextMayBeTick )
588 mayBeTick = drawnXTicks[ nextMayBeTick ];
589 if( qAbs( mayBeTick - topPoint.x() ) > 1 )
590 ptr->drawLine( topPoint, bottomPoint );
591 else
592 ++nextMayBeTick;
593 if ( isLogarithmicX ){
594 if( logSubstep == 9 ){
595 fLogSubstep *= 10.0;
596 logSubstep = 0;
597 }
598 f += fLogSubstep;
599 ++logSubstep;
600 }else{
601 f += dimX.subStepWidth;
602 }
603 }
604 // for the y-axis
605 } else {
606 int nextMayBeTick = 0;
607 int mayBeTick = 0;
608 float f = minValueY;
609 qreal fLogSubstep = minValueY;
610 int logSubstep = 0;
611 while ( f <= maxValueY ) {
612 QPointF leftPoint ( 0, f );
613 QPointF rightPoint ( 0, f );
614 // we don’t draw the sub ticks, if we are at the same position as a normal tick
615 leftPoint = plane->translate( leftPoint );
616 rightPoint = plane->translate( rightPoint );
617 leftPoint.setX( fourthRulerRef.x() + tickLength( true ) );
618 rightPoint.setX( fourthRulerRef.x() );
619 if( drawnYTicks.count() > nextMayBeTick )
620 mayBeTick = drawnYTicks[ nextMayBeTick ];
621 if( qAbs( mayBeTick - leftPoint.y() ) > 1 )
622 ptr->drawLine( leftPoint, rightPoint );
623 else
624 ++nextMayBeTick;
625 if ( isLogarithmicY ){
626 if( logSubstep == 9 ){
627 fLogSubstep *= 10.0;
628 logSubstep = 0;
629 }
630 f += fLogSubstep;
631 ++logSubstep;
632 }else{
633 f += dimY.subStepWidth;
634 }
635 }
636 }
637 }
638
639
640 if( ! titleText().isEmpty() ){
641 const TextAttributes titleTA( titleTextAttributes() );
642 if( titleTA.isVisible() ){
643 TextLayoutItem titleItem( titleText(),
644 titleTA,
645 referenceArea,
646 KDChartEnums::MeasureOrientationMinimum,
647 Qt::AlignHCenter|Qt::AlignVCenter );
648 QPointF point;
649 const QSize size( titleItem.sizeHint() );
650 switch( position() )
651 {
652 case Top:
653 point.setX( geoRect.left() + geoRect.width() / 2.0);
654 point.setY( geoRect.top() );
655 break;
656 case Bottom:
657 point.setX( geoRect.left() + geoRect.width() / 2.0);
658 point.setY( geoRect.bottom() - size.height() );
659 break;
660 case Left:
661 point.setX( geoRect.left() );
662 point.setY( geoRect.top() + geoRect.height() / 2.0);
663 break;
664 case Right:
665 point.setX( geoRect.right() - size.height() );
666 point.setY( geoRect.top() + geoRect.height() / 2.0);
667 break;
668 }
669 PainterSaver painterSaver( ptr );
670 ptr->translate( point );
671 if( isOrdinate() )
672 ptr->rotate( 270.0 );
673 titleItem.setGeometry( QRect( QPoint(-size.width() / 2, 0), size ) );
674 //ptr->drawRect(titleItem.geometry().adjusted(0,0,-1,-1));
675 titleItem.paint( ptr );
676 }
677 }
678
679 //qDebug() << "KDChart::CartesianAxis::paintCtx() done.";
680 }
6.17.4.26 void AbstractAreaBase::paintFrame (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
159 {
160 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
161 "Private class was not initialized!" );
162
163 #define attributes d->frameAttributes
164
165 if( !attributes.isVisible() ) return;
166
167 const QPen oldPen( painter.pen() );
168 painter.setPen( attributes.pen() );
169 painter.drawRect( rect );
170 painter.setPen( oldPen );
171 #undef attributes
172 }
6.17.4.27 void AbstractArea::paintIntoRect (QPainter & painter, const QRect & rect)
[virtual, inherited]
72 {
73 const QRect oldGeometry( geometry() );
74 if( oldGeometry != rect )
75 setGeometry( rect );
76 painter.translate( rect.left(), rect.top() );
77 paintAll( painter );
78 painter.translate( -rect.left(), -rect.top() );
79 if( oldGeometry != rect )
80 setGeometry( oldGeometry );
81 }
123 {
124 return d->position;
125 }
111 {
112 emit positionChanged( this );
113 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
106 {
107 d->useDefaultTextAttributes = true;
108 layoutPlanes();
109 }
93 {
94 d->backgroundAttributes = a;
95 }
83 {
84 d->frameAttributes = a;
85 }
821 {
822 // qDebug() << "KDChart::CartesianAxis::setGeometry(" << r << ") called"
823 // << (isAbscissa() ? "for Abscissa":"for Ordinate") << "axis";
824 d->geometry = r;
825 }
Use this to specify your own set of strings, to be used as axis labels.
Labels specified via setLabels take precedence: If a non-empty list is passed, KD Chart will use these
strings as axis labels, instead of calculating them.
If you a smaller number of strings than the number od labels drawn at this axis, KD Chart will iterate over
the list, repeating the strings, until all labels are drawn. As an example you could specify the seven days of
the week as abscissa labels, which would be repeatedly used then.
By passing an empty QStringList you can reset the default behaviour.
See also:
labels, setShortLabels
245 {
246 d->hardLabels = list;
247 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
117 {
118 d->position = p;
119 layoutPlanes();
120 }
Use this to specify your own set of strings, to be used as axis labels, in case the normal labels are too long.
Note:
Setting done via setShortLabels will be ignored, if you did not pass a non-empty string list via set-
Labels too!
See also:
shortLabels, setLabels
271 {
272 d->hardShortLabels = list;
273 }
Use this to specify the text attributes to be used for axis labels.
By default, the reference area will be set at painting time. It will be the then-valid coordinate plane’s
parent widget, so normally, it will be the KDChart::Chart. Thus the labels of all of your axes in all of your
diagrams within that Chart will be drawn in same font size, by default.
See also:
textAttributes, setLabels
213 {
214 d->textAttributes = a;
215 }
75 {
76 //FIXME(khz): Call update al all places where axis internals are changed!
77 d->titleText = text;
78 layoutPlanes();
79 }
87 {
88 d->titleTextAttributes = a;
89 d->useDefaultTextAttributes = false;
90 layoutPlanes();
91 }
Returns a list of strings, that are used as axis labels, as set via setShortLabels.
Note:
Setting done via setShortLabels will be ignored, if you did not pass a non-empty string list via set-
Labels too!
See also:
setShortLabels
284 {
285 return d->hardShortLabels;
286 }
816 {
817 return maximumSize();
818 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
See also:
setTextAttributes
223 {
224 return d->textAttributes;
225 }
833 {
834 int result = 0;
835
836 if ( isAbscissa() ) {
837 result = position() == Top ? -4 : 3;
838 } else {
839 result = position() == Left ? -4 : 3;
840 }
841
842 if ( subUnitTicks )
843 result = result < 0 ? result + 1 : result - 1;
844
845 return result;
846 }
82 {
83 return d->titleText;
84 }
Returns the text attributes that will be used for displaying the title text.
This is either the text attributes as specified by setTitleTextAttributes, or (if setTitleTextAttributes() was
not called) the default text attributes.
See also:
resetTitleTextAttributes, hasDefaultTitleTextAttributes
94 {
95 if( hasDefaultTitleTextAttributes() ){
96 TextAttributes ta( textAttributes() );
97 Measure me( ta.fontSize() );
98 me.setValue( me.value() * 1.5 );
99 ta.setFontSize( me );
100 return ta;
101 }
102 return d->titleTextAttributes;
103 }
Reimplemented in KDChart::AbstractCoordinatePlane.
Definition at line 86 of file KDChartAbstractArea.h.
• KDChartCartesianAxis.h
• KDChartCartesianAxis.cpp
Public Types
• enum AxesCalcMode {
Linear,
Logarithmic }
• void layoutPlanes ()
Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes().
• void needLayoutPlanes ()
Emitted when plane needs to trigger the Chart’s layouting of the coord.
• void needRelayout ()
Emitted when plane needs to trigger the Chart’s layouting.
• void needUpdate ()
Emitted when plane needs to update its drawings.
• void relayout ()
Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout().
• void removeFromParentLayout ()
• virtual void replaceDiagram (AbstractDiagram ∗diagram, AbstractDiagram ∗oldDiagram=0)
Replaces the old diagram, or appends the diagram, it there is none yet.
Public Attributes
• Q_SIGNALS __pad0__: void destroyedCoordinatePlane( AbstractCoordinatePlane∗ )
Protected Attributes
• QWidget ∗ mParent
• QLayout ∗ mParentLayout
• protected Q_SLOTS: void slotLayoutChanged( AbstractDiagram∗ )
Enumeration values:
Linear
Logarithmic
55 { Linear, Logarithmic };
6.18.2.2 CartesianCoordinatePlane::∼CartesianCoordinatePlane ()
72 {
73 // this bloc left empty intentionally
74 }
Parameters:
diagram The diagram to add.
See also:
replaceDiagram, takeDiagram
83 {
84 Q_ASSERT_X ( dynamic_cast<AbstractCartesianDiagram*> ( diagram ),
85 "CartesianCoordinatePlane::addDiagram", "Only cartesian "
86 "diagrams can be added to a cartesian coordinate plane!" );
87 AbstractCoordinatePlane::addDiagram ( diagram );
88 connect ( diagram, SIGNAL ( layoutChanged ( AbstractDiagram* ) ),
89 SLOT ( slotLayoutChanged ( AbstractDiagram* ) ) );
90
91 connect( diagram, SIGNAL( propertiesChanged() ),this, SIGNAL( propertiesChanged() ) );
92 }
76 {
77 Q_UNUSED( position );
78 // PENDING(kalle) FIXME
79 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosi
80 }
Implements KDChart::AbstractAreaBase.
Definition at line 105 of file KDChartAbstractArea.cpp.
Referenced by drawingArea(), KDChart::PolarCoordinatePlane::layoutDiagrams(), KDChart::Cartesian-
Axis::paint(), KDChart::AbstractArea::paintAll(), and KDChart::CartesianAxis::paintCtx().
106 {
107 return geometry();
108 }
409 {
410 return d->coordinateTransformation.axesCalcModeX;
411 }
404 {
405 return d->coordinateTransformation.axesCalcModeY;
406 }
98 {
99 return d->backgroundAttributes;
100 }
164 {
165 // determine unit of the rectangles of all involved diagrams:
166 QPointF smallestPoint;
167 QPointF largestPoint;
168 bool bStarting = true;
169 Q_FOREACH( const AbstractDiagram* diagram, diagrams() )
170 {
171 QPair<QPointF, QPointF> dataBoundariesPair = diagram->dataBoundaries();
172 //qDebug() << "CartesianCoordinatePlane::calculateRawDataBoundingRect() gets diagram->dataBoun
173 if ( bStarting || dataBoundariesPair.first.x() < smallestPoint.x() )
174 smallestPoint.setX( dataBoundariesPair.first.x() );
175 if ( bStarting || dataBoundariesPair.first.y() < smallestPoint.y() )
176 smallestPoint.setY( dataBoundariesPair.first.y() );
177 if ( bStarting || dataBoundariesPair.second.x() > largestPoint.x() )
178 largestPoint.setX( dataBoundariesPair.second.x() );
179 if ( bStarting || dataBoundariesPair.second.y() > largestPoint.y() )
180 largestPoint.setY( dataBoundariesPair.second.y() );
181 bStarting = false;
182 }
183
184 // if custom boundaries are set on the plane, use them
185 if ( d->horizontalMin != d->horizontalMax ) {
186 smallestPoint.setX( d->horizontalMin );
187 largestPoint.setX( d->horizontalMax );
188 }
189 if ( d->verticalMin != d->verticalMax ) {
190 smallestPoint.setY( d->verticalMin );
191 largestPoint.setY( d->verticalMax );
192 }
193
194 QRectF dataBoundingRect;
195 dataBoundingRect.setBottomLeft ( smallestPoint );
196 dataBoundingRect.setTopRight ( largestPoint );
197 //qDebug() << "CartesianCoordinatePlane::calculateRawDataBoundingRect() returns" << dataBoundingRe
198 return dataBoundingRect;
199 }
Returns:
The first diagram associated with this coordinate plane.
114 {
115 if ( d->diagrams.isEmpty() )
116 {
117 return 0;
118 } else {
119 return d->diagrams.first();
120 }
121 }
Returns:
The list of diagrams associated with this coordinate plane.
129 {
130 ConstAbstractDiagramList list;
131 #ifndef QT_NO_STL
132 qCopy( d->diagrams.begin(), d->diagrams.end(), std::back_inserter( list ) );
133 #else
134 Q_FOREACH( AbstractDiagram * a, d->diagrams )
135 list.push_back( a );
136 #endif
137 return list;
138 }
Returns:
The list of diagrams associated with this coordinate plane.
124 {
125 return d->diagrams;
126 }
357 {
358 return d->isometricScaling;
359 }
251 {
252 const QRect rect( areaGeometry() );
253 return QRectF ( rect.left()+1, rect.top()+1, rect.width() - 3, rect.height() - 3 );
254 }
201 {
202 return Qt::Vertical | Qt::Horizontal;
203 }
88 {
89 return d->frameAttributes;
90 }
238 {
239 return d->geometry;
240 }
Implements KDChart::AbstractCoordinatePlane.
Definition at line 201 of file KDChartCartesianCoordinatePlane.cpp.
References axesCalcModeX(), axesCalcModeY(), calculateRawDataBoundingRect(), KDChart::Data-
DimensionsList, KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractCoordinate-
Plane::diagrams(), gridAttributes(), KDChart::GridAttributes::gridGranularitySequence(), KDChart::Grid-
Attributes::gridStepWidth(), KDChart::GridAttributes::gridSubStepWidth(), and KDChart::Abstract-
Diagram::percentMode().
202 {
203
204 DataDimensionsList l;
205 const AbstractCartesianDiagram* dgr
206 = diagrams().isEmpty() ? 0 : dynamic_cast<const AbstractCartesianDiagram*> (diagrams().first()
207
208 if( dgr ){
209 const QRectF r( calculateRawDataBoundingRect() );
210 // note:
211 // We do *not* access d->gridAttributesHorizontal here, but
212 // we use the getter function, to get the global attrs, if no
213 // special ones have been set for the respective orientation.
214 const GridAttributes gaH( gridAttributes( Qt::Horizontal ) );
215 const GridAttributes gaV( gridAttributes( Qt::Vertical ) );
216 // append the first dimension: for Abscissa axes
217 l.append(
218 DataDimension(
219 r.left(), r.right(),
220 dgr->datasetDimension() > 1,
221 axesCalcModeX(),
222 gaH.gridGranularitySequence(),
223 gaH.gridStepWidth() ) );
224 // append the second dimension: for Ordinate axes
225 if( dgr->percentMode() )
226 l.append(
227 DataDimension(
228 // always return 0-100 when in percentMode
229 0.0, 100.0,
230 true,
231 axesCalcModeY(),
232 KDChartEnums::GranularitySequence_10_20,
233 10.0 ) );
234 else
235 l.append(
236 DataDimension(
237 r.bottom(), r.top(),
238 true,
239 axesCalcModeY(),
240 gaV.gridGranularitySequence(),
241 gaV.gridStepWidth(),
242 gaV.gridSubStepWidth() ) );
243 }else{
244 l.append( DataDimension() ); // This gets us the default 1..0 / 1..0 grid
245 l.append( DataDimension() ); // shown, if there is no diagram on this plane.
246 }
247 return l;
248 }
Returns:
The grid attributes used by this coordinate plane.
See also:
setGlobalGridAttributes
CartesianCoordinatePlane::gridAttributes
158 {
159 return d->gridAttributes;
160 }
Returns:
The attributes used for grid lines drawn in horizontal direction (or in vertical direction, resp.).
Note:
This function always returns a valid set of grid attributes: If no special grid attributes were set foe
this orientation the global attributes are returned, as returned by AbstractCoordinatePlane::globalGrid-
Attributes.
See also:
setGridAttributes
resetGridAttributes
AbstractCoordinatePlane::globalGridAttributes
hasOwnGridAttributes
491 {
492 if( hasOwnGridAttributes( orientation ) ){
493 if( orientation == Qt::Horizontal )
494 return d->gridAttributesHorizontal;
495 else
496 return d->gridAttributesVertical;
497 }else{
498 return globalGridAttributes();
499 }
500 }
Note:
Returned list will contain different numbers of DataDimension, depending on the kind of coordinate
plane used. For CartesianCoordinatePlane two DataDimension are returned: the first representing
grid lines in X direction (matching the Abscissa axes) and the second indicating vertical grid lines (or
Ordinate axes, resp.).
Returns:
The dimensions used for drawing the grid lines.
See also:
DataDimension
163 {
164 return d->grid->updateData( this );
165 }
Returns:
Returns whether the grid attributes have been set for the respective direction via setGridAttributes(
orientation ).
If false, the grid will use the global attributes set by AbstractCoordinatePlane::globalGridAttributes (or the
default attributes, resp.)
See also:
setGridAttributes
resetGridAttributes
AbstractCoordinatePlane::globalGridAttributes
514 {
515 return
516 ( orientation == Qt::Horizontal )
517 ? d->hasOwnGridAttributesHorizontal
518 : d->hasOwnGridAttributesVertical;
519 }
Returns:
The largest and smallest visible horizontal value space value. If this is not explicitely set,or if both
values are the same, the plane will use the union of the dataBoundaries of all associated diagrams.
See also:
KDChart::AbstractDiagram::dataBoundaries
460 {
461 return QPair<qreal, qreal>( d->horizontalMin, d->horizontalMax );
462 }
176 {
177 Q_ASSERT_X ( d != 0, "AbstractAreaBase::innerRect()",
178 "Private class was not initialized!" );
179
180 const int padding
181 = d->frameAttributes.isVisible()
182 ? qMax( d->frameAttributes.padding(), 0 ) : 0;
183 return
184 QRect( QPoint(0,0), areaGeometry().size() )
185 .adjusted( padding, padding, -padding, -padding );
186 }
194 {
195 return false; // never empty!
196 // coordinate planes with no associated diagrams
197 // are showing a default grid of ()1..10, 1..10) stepWidth 1
198 }
257 {
258 //qDebug("KDChart::CartesianCoordinatePlane::layoutDiagrams() called");
259 if ( diagrams().isEmpty() )
260 { // FIXME evaluate what can still be prepared
261 // FIXME decide default dimension if no diagrams are present (to make empty planes useable)
262 }
263 // the rectangle the diagrams cover in the *plane*:
264 // (Why -3? We save 1px on each side for the antialiased drawing, and
265 // respect the way QPainter calculates the width of a painted rect (the
266 // size is the rectangle size plus the pen width). This way, most clipping
267 // for regular pens should be avoided. When pens with a penWidth or larger
268 // than 1 are used, this may not be sufficient.
269 const QRectF drawArea( drawingArea() );
270 //qDebug() << "drawingArea() returns" << drawArea;
271
272 const DataDimensionsList dimensions( gridDimensionsList() );
273 // test for programming errors: critical
274 Q_ASSERT_X ( dimensions.count() == 2, "CartesianCoordinatePlane::layoutDiagrams",
275 "Error: gridDimensionsList() did not return exactly two dimensions." );
276 const DataDimension dimX = dimensions.first();
277 const DataDimension dimY = dimensions.last();
278 const qreal distX = dimX.distance();
279 const qreal distY = dimY.distance();
280 const QPointF pt(qMin(dimX.start, dimX.end), qMax(dimY.start, dimY.end));
281 const QSizeF siz( qAbs(distX), -qAbs(distY) );
282 const QRectF dataBoundingRect( pt, siz );
283
284 // calculate the remaining rectangle, and use it as the diagram area:
285 QRectF diagramArea = drawArea;
286 diagramArea.setTopLeft ( QPointF ( drawArea.left(), drawArea.top() ) );
287 diagramArea.setBottomRight ( QPointF ( drawArea.right(), drawArea.bottom() ) );
288
289 // determine coordinate transformation:
290 QPointF diagramTopLeft = dataBoundingRect.topLeft();
291 double diagramWidth = dataBoundingRect.width();
292 double diagramHeight = dataBoundingRect.height();
293 double planeWidth = diagramArea.width();
294 double planeHeight = diagramArea.height();
295 double scaleX;
296 double scaleY;
297
298 double diagramXUnitInCoordinatePlane;
299 double diagramYUnitInCoordinatePlane;
300
301 diagramXUnitInCoordinatePlane = diagramWidth != 0 ? planeWidth / diagramWidth : 1;
302 diagramYUnitInCoordinatePlane = diagramHeight != 0 ? planeHeight / diagramHeight : 1;
303 // calculate diagram origin in plane coordinates:
304 QPointF coordinateOrigin = QPointF (
305 diagramTopLeft.x() * -diagramXUnitInCoordinatePlane,
306 diagramTopLeft.y() * -diagramYUnitInCoordinatePlane );
307 coordinateOrigin += diagramArea.topLeft();
308 // calculate isometric scaling factor to maxscale the diagram into
309 // the coordinate system:
310 if ( d->isometricScaling )
311 {
312 double scale = qMin ( qAbs ( diagramXUnitInCoordinatePlane ),
313 qAbs ( diagramYUnitInCoordinatePlane ) );
314
315 scaleX = qAbs( scale / diagramXUnitInCoordinatePlane );
316 scaleY = qAbs( scale / diagramYUnitInCoordinatePlane );
317 } else {
318 scaleX = 1.0;
319 scaleY = 1.0;
320 }
321 d->coordinateTransformation.diagramRect = dataBoundingRect;
322 d->coordinateTransformation.originTranslation = coordinateOrigin;
323 d->coordinateTransformation.unitVectorX = diagramXUnitInCoordinatePlane;
324 d->coordinateTransformation.unitVectorY = diagramYUnitInCoordinatePlane;
325 d->coordinateTransformation.isoScaleX = scaleX;
326 d->coordinateTransformation.isoScaleY = scaleY;
327 // adapt diagram area to effect of isometric scaling:
328 diagramArea.setTopLeft( translate ( dataBoundingRect.topLeft() ) );
329 diagramArea.setBottomRight ( translate ( dataBoundingRect.bottomRight() ) );
330 //qDebug("KDChart::CartesianCoordinatePlane::layoutDiagrams() done,\ncalling update() now:");
331 update();
332 }
255 {
256 //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
257 emit needLayoutPlanes();
258 }
206 {
207 if( d->parent )
208 return d->parent->size();
209 // Note: At external layut calculation time the coord.plane *will*
210 // have a parent widget, so returning a default size here
211 // will not affect its real drawing size.
212 return QSize(1000, 1000);
213 }
216 {
217 return QSize(60, 60); // this default can be overwritten by derived classes
218 }
[reimplemented]
Definition at line 140 of file KDChartAbstractCoordinatePlane.cpp.
141 {
142 return QSize( 200, 200 );
143 }
Emitted when plane needs to trigger the Chart’s layouting of the coord.
planes.
Referenced by KDChart::AbstractCoordinatePlane::layoutPlanes().
reimpl
Implements KDChart::AbstractLayoutItem.
Definition at line 95 of file KDChartCartesianCoordinatePlane.cpp.
References KDChart::AbstractDiagramList, d, KDChart::AbstractCoordinatePlane::diagrams(),
drawingArea(), KDChart::PaintContext::setCoordinatePlane(), KDChart::PaintContext::setPainter(),
and KDChart::PaintContext::setRectangle().
96 {
97 // prevent recursive call:
98 //qDebug("attempt plane::paint()");
99 if( d->bPaintIsRunning ){
100 d->bNextPaintPending = true;
101 return;
102 }
103 d->bNextPaintPending = false;
104 d->bPaintIsRunning = true;
105
106 //qDebug("start plane::paint()");
107
108 AbstractDiagramList diags = diagrams();
109 //FIXME(khz): make this also work in no diagrams are there
110 // (commenting out the following line should do it)
111 if ( !diags.isEmpty() )
112 {
113 PaintContext ctx;
114 ctx.setPainter ( painter );
115 ctx.setCoordinatePlane ( this );
116 const QRectF drawArea( drawingArea() );
117 ctx.setRectangle ( drawArea );
118
119 // enabling clipping so that we’re not drawing outside
120 QRect clipRect = drawArea.toRect().adjusted( -1, -1, 1, 1 );
121 QRegion clipRegion( clipRect );
122 painter->setClipRegion( clipRegion );
123
124 // paint the coordinate system rulers:
125 d->grid->drawGrid( &ctx );
126
127 // paint the diagrams:
128 for ( int i = 0; i < diags.size(); i++ )
129 {
130 //qDebug(" attempt diags[i]->paint ( &ctx );");
131
132 //if ( qApp->hasPendingEvents () )
133 // continue;
134
135 //if( ! d->bNextPaintPending )
136 // qApp->processEvents( QEventLoop::ExcludeSocketNotifiers );
137 //if( ! d->bNextPaintPending ){
138 //qDebug(" start diags[i]->paint ( &ctx );");
139 PainterSaver painterSaver( painter );
140 diags[i]->paint ( &ctx );
141 //}
142 //qDebug(" done: diags[i]->paint ( &ctx );");
143 }
144
145 // and disable clipping afterwards
146 painter->setClipping( false );
147
148 //for debugging:
149 // painter->drawRect( drawArea.adjusted(4,4,4,4) );
150 // painter->drawRect( drawArea.adjusted(2,2,2,2) );
151 // painter->drawRect( drawArea );
152 }
153 d->bPaintIsRunning = false;
154 //qDebug("done: plane::paint()");
155 }
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked
automatically.
84 {
85 // Paint the background and frame
86 paintBackground( painter, geometry() );
87 paintFrame( painter, geometry() );
88
89 // temporarily adjust the widget size, to be sure all content gets calculated
90 // to fit into the inner rectangle
91 const QRect oldGeometry( areaGeometry() );
92 QRect inner( innerRect() );
93 inner.moveTo(
94 oldGeometry.left() + inner.left(),
95 oldGeometry.top() + inner.top() );
96 const bool needAdjustGeometry = oldGeometry != inner;
97 if( needAdjustGeometry )
98 setGeometry( inner );
99 paint( &painter );
100 if( needAdjustGeometry )
101 setGeometry( oldGeometry );
102 //qDebug() << "AbstractAreaWidget::paintAll() done.";
103 }
104 {
105 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
106 "Private class was not initialized!" );
107
108 #define attributes d->backgroundAttributes
109
110 if( !attributes.isVisible() ) return;
111
112 /* first draw the brush (may contain a pixmap)*/
113 if( Qt::NoBrush != attributes.brush().style() ) {
114 KDChart::PainterSaver painterSaver( &painter );
115 painter.setPen( Qt::NoPen );
116 const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
117 painter.setBrushOrigin( newTopLeft );
118 painter.setBrush( attributes.brush() );
119 painter.drawRect( rect );
120 }
121 /* next draw the backPixmap over the brush */
122 if( !attributes.pixmap().isNull() &&
123 attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) {
124 QPointF ol = rect.topLeft();
125 if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() )
126 {
127 ol.setX( rect.center().x() - attributes.pixmap().width() / 2 );
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
6.18.3.37 void AbstractAreaBase::paintFrame (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
159 {
160 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
6.18.3.38 void AbstractArea::paintIntoRect (QPainter & painter, const QRect & rect)
[virtual, inherited]
72 {
73 const QRect oldGeometry( geometry() );
74 if( oldGeometry != rect )
75 setGeometry( rect );
76 painter.translate( rect.left(), rect.top() );
77 paintAll( painter );
78 painter.translate( -rect.left(), -rect.top() );
79 if( oldGeometry != rect )
80 setGeometry( oldGeometry );
81 }
183 {
184 return d->parent;
185 }
188 {
189 return d->parent;
190 }
111 {
112 emit positionChanged( this );
113 }
Emitted upon change of a property of the Coordinate Plane or any of its components.
Referenced by addDiagram(), setAxesCalcModes(), setAxesCalcModeX(), setAxesCalcModeY(),
KDChart::PolarCoordinatePlane::setGridAttributes(), setGridAttributes(), setHorizontalRange(), set-
IsometricScaling(), setVerticalRange(), setZoomCenter(), setZoomFactorX(), and setZoomFactorY().
There are two ways, in which planes can be caused to interact, in where they are put layouting wise: The
first is the reference plane.
If such a reference plane is set, on a plane, it will use the same cell in the layout as that one. In addition
to this, planes can share an axis. In that case they will be layed out in relation to each other as suggested
by the position of the axis. If, for example Plane1 and Plane2 share an axis at position Left, that will result
in the layout: Axis Plane1 Plane 2, vertically. If Plane1 also happens to be Plane2’s reference plane, both
planes are drawn over each other. The reference plane concept allows two planes to share the same space
even if neither has any axis, and in case there are shared axis, it is used to decided, whether the planes
should be painted on top of each other or layed out vertically or horizontally next to each other.
Returns:
The reference coordinate plane associated with this one.
173 {
174 return d->referenceCoordinatePlane;
175 }
249 {
250 //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
251 emit needRelayout();
252 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
Replaces the old diagram, or appends the diagram, it there is none yet.
Parameters:
diagram The diagram to be used instead of the old diagram. This parameter must not be zero, or the
method will do nothing.
oldDiagram The diagram to be removed by the new diagram. This diagram will be deleted automat-
ically. If the parameter is omitted, the very first diagram will be replaced. In case, there was no
diagram yet, the new diagram will just be added.
Note:
If you want to re-use the old diagram, call takeDiagram and addDiagram, instead of using replace-
Diagram.
See also:
addDiagram, takeDiagram
83 {
84 if( diagram && oldDiagram_ != diagram ){
85 AbstractDiagram* oldDiagram = oldDiagram_;
86 if( d->diagrams.count() ){
87 if( ! oldDiagram )
88 oldDiagram = d->diagrams.first();
89 takeDiagram( oldDiagram );
90 }
91 delete oldDiagram;
92 addDiagram( diagram );
93 layoutDiagrams();
94 layoutPlanes(); // there might be new axes, etc
95 update();
96 }
97 }
Reset the attributes to be used for grid lines drawn in horizontal direction (or in vertical direction, resp.).
By calling this method you specify that the global attributes set by AbstractCoordinatePlane::setGlobal-
GridAttributes be used.
See also:
setGridAttributes, gridAttributes
AbstractCoordinatePlane::globalGridAttributes
hasOwnGridAttributes
484 {
485 setHasOwnGridAttributes( orientation, false );
486 update();
487 }
414 {
415 if( d->coordinateTransformation.axesCalcModeY != mode ||
416 d->coordinateTransformation.axesCalcModeX != mode ){
417 d->coordinateTransformation.axesCalcModeY = mode;
418 d->coordinateTransformation.axesCalcModeX = mode;
419 emit propertiesChanged();
420 }
421 }
432 {
433 if( d->coordinateTransformation.axesCalcModeX != mode ){
434 d->coordinateTransformation.axesCalcModeX = mode;
435 emit propertiesChanged();
436 }
437 }
424 {
425 if( d->coordinateTransformation.axesCalcModeY != mode ){
426 d->coordinateTransformation.axesCalcModeY = mode;
427 emit propertiesChanged();
428 }
429 }
93 {
94 d->backgroundAttributes = a;
95 }
83 {
84 d->frameAttributes = a;
85 }
Note:
Do not call this function directly, unless you know exactly what you are doing. Geometry management
is done by KD Chart’s internal layouting measures.
228 {
229 // qDebug() << "KDChart::AbstractCoordinatePlane::setGeometry(" << r << ") called";
230 if( d->geometry != r ){
231 d->geometry = r;
232 // Note: We do *not* call update() here
233 // because it would invoke KDChart::update() recursively.
234 }
235 }
GridAttributes ga = plane->globalGridAttributes();
ga.setGlobalGridVisible( false );
plane->setGlobalGridAttributes( ga );
See also:
globalGridAttributes
CartesianCoordinatePlane::setGridAttributes
152 {
153 d->gridAttributes = a;
154 update();
155 }
Set the attributes to be used for grid lines drawn in horizontal direction (or in vertical direction, resp.).
To disable horizontal grid painting, for example, your code should like this:
Note:
setGridAttributes overwrites the global attributes that were set by AbstractCoordinatePlane::setGlobal-
GridAttributes. To re-activate these global attributes you can call resetGridAttributes.
See also:
resetGridAttributes, gridAttributes
AbstractCoordinatePlane::setGlobalGridAttributes
hasOwnGridAttributes
472 {
473 if( orientation == Qt::Horizontal )
474 d->gridAttributesHorizontal = a;
475 else
476 d->gridAttributesVertical = a;
477 setHasOwnGridAttributes( orientation, true );
478 update();
479 emit propertiesChanged();
480 }
Allows setting the boundaries of the visible value space area that the plane displays in horizontal direction.
The horizontal viewport. To disable use of this range, set both values to the same thing, which constiutes a
null range.
Parameters:
A pair of values representing the smalles and the largest horizontal value space coordinate that are still
visible.
440 {
441 if ( d->horizontalMin != range.first || d->horizontalMax != range.second ) {
442 d->horizontalMin = range.first;
443 d->horizontalMax = range.second;
444 layoutDiagrams();
445 emit propertiesChanged();
446 }
447 }
347 {
348 if ( d->isometricScaling != onOff )
349 {
350 d->isometricScaling = onOff;
351 layoutDiagrams();
352 emit propertiesChanged();
353 }
354 }
178 {
179 d->parent = parent;
180 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
Set another coordinate plane to be used as the reference plane for this one.
Parameters:
plane The coordinate plane to be used the reference plane for this one.
See also:
referenceCoordinatePlane
168 {
169 d->referenceCoordinatePlane = plane;
170 }
Allows setting the boundaries of the visible value space area that the plane displays in vertical direction.
The vertical viewport. To disable use of this range, set both values to the same thing, which constiutes a
null range.
Parameters:
A pair of values representing the smalles and the largest vertical value space coordinate that are still
visible.
450 {
451 if ( d->verticalMin != range.first || d->verticalMax != range.second ) {
452 d->verticalMin = range.first;
453 d->verticalMax = range.second;
454 layoutDiagrams();
455 emit propertiesChanged();
456 }
457 }
Set the point (in value coordinates) to be used as the center point in zoom operations.
Parameters:
center The point to use.
378 {
379 if( d->coordinateTransformation.zoom.xCenter != center.x() ||
380 d->coordinateTransformation.zoom.yCenter != center.y() ){
381 d->coordinateTransformation.zoom.xCenter = center.x();
382 d->coordinateTransformation.zoom.yCenter = center.y();
383 emit propertiesChanged();
384 }
385 }
Sets the zoom factor in horizontal direction, that is applied to all coordinate transformations.
Reimplemented from KDChart::AbstractCoordinatePlane.
Definition at line 361 of file KDChartCartesianCoordinatePlane.cpp.
References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().
362 {
363 if( d->coordinateTransformation.zoom.xFactor != factor ){
364 d->coordinateTransformation.zoom.xFactor = factor;
365 emit propertiesChanged();
366 }
367 }
Sets the zoom factor in vertical direction, that is applied to all coordinate transformations.
Reimplemented from KDChart::AbstractCoordinatePlane.
Definition at line 369 of file KDChartCartesianCoordinatePlane.cpp.
References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().
370 {
371 if( d->coordinateTransformation.zoom.yFactor != factor ){
372 d->coordinateTransformation.zoom.yFactor = factor;
373 emit propertiesChanged();
374 }
375 }
221 {
222 // we return our maxiumu (which is the full size of the Chart)
223 // even if we know the plane will be smaller
224 return maximumSize();
225 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
[reimplemented]
Definition at line 146 of file KDChartAbstractCoordinatePlane.cpp.
147 {
148 return QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
149 }
See also:
addDiagram, replaceDiagram
101 {
102 const int idx = d->diagrams.indexOf( diagram );
103 if( idx != -1 ){
104 d->diagrams.removeAt( idx );
105 diagram->setParent( 0 );
106 diagram->setCoordinatePlane( 0 );
107 layoutDiagrams();
108 update();
109 }
110 }
Translate the given point in value space coordinates to a position in pixel space.
Parameters:
diagramPoint The point in value coordinates.
Returns:
The translated point.
Implements KDChart::AbstractCoordinatePlane.
Definition at line 334 of file KDChartCartesianCoordinatePlane.cpp.
References d.
Referenced by KDChart::CartesianAxis::paintCtx().
335 {
336 // i had to disable the assertion, because it fails for diagramPoint’s
337 // directly on the edge of the diagramRect. i guess it can be replaced by
338 // manually comparing he coordinates, but be aware of the fact that the
339 // user coordinate system may be directed in any way the user choses!
340 // Q_ASSERT_X ( d->coordinateTransformation.diagramRect.contains ( diagramPoint ),
341 // "CartesianCoordinatePlane::translate", "Diagram point has to be inside "
342 // "user-supplied diagram rectangle." );
343 return d->coordinateTransformation.translate ( diagramPoint );
344 }
Returns:
The largest and smallest visible horizontal value space value. If this is not explicitely set, or if both
values are the same, the plane will use the union of the dataBoundaries of all associated diagrams.
See also:
KDChart::AbstractDiagram::dataBoundaries
465 {
466 return QPair<qreal, qreal>( d->verticalMin, d->verticalMax );
467 }
Returns:
The center point (in value coordinates) of the coordinate plane, that is used for zoom operations.
388 {
389 return QPointF( d->coordinateTransformation.zoom.xCenter,
390 d->coordinateTransformation.zoom.yCenter );
391 }
Returns:
The zoom factor in horizontal direction, that is applied to all coordinate transformations.
394 {
395 return d->coordinateTransformation.zoom.xFactor;
396 }
Returns:
The zoom factor in vertical direction, that is applied to all coordinate transformations.
399 {
400 return d->coordinateTransformation.zoom.yFactor;
401 }
• KDChartCartesianCoordinatePlane.h
• KDChartCartesianCoordinatePlane.cpp
• CoordinatePlaneList coordinatePlanes ()
The list of coordinate planes.
• HeaderFooter ∗ headerFooter ()
The first header or footer of the chart.
• HeaderFooterList headerFooters ()
The list of headers and footers associated with the chart.
• Legend ∗ legend ()
The first legend of the chart or 0 if there was none added to the chart.
• LegendList legends ()
The list of all legends associated with the chart.
• ∼Chart ()
Public Attributes
• Q_SIGNALS __pad0__: void propertiesChanged()
6.19.2.2 Chart::∼Chart ()
562 {
563 delete _d;
564 }
Parameters:
plane The coordinate plane to add.
See also:
replaceCoordinatePlane, takeCoordinatePlane
585 {
586 connect( plane, SIGNAL( destroyedCoordinatePlane( AbstractCoordinatePlane* ) ),
587 d, SLOT( slotUnregisterDestroyedPlane( AbstractCoordinatePlane* ) ) );
588 connect( plane, SIGNAL( needUpdate() ), this, SLOT( update() ) );
589 connect( plane, SIGNAL( needRelayout() ), d, SLOT( slotRelayout() ) ) ;
590 connect( plane, SIGNAL( needLayoutPlanes() ), d, SLOT( slotLayoutPlanes() ) ) ;
591 connect( plane, SIGNAL( propertiesChanged() ),this, SIGNAL( propertiesChanged() ) );
592 d->coordinatePlanes.append( plane );
593 plane->setParent( this );
594 d->slotLayoutPlanes();
595 }
Parameters:
headerFooter The header (or footer, resp.) to add.
See also:
replaceHeaderFooter, takeHeaderFooter
762 {
763 d->headerFooters.append( headerFooter );
764 headerFooter->setParent( this );
765 connect( headerFooter, SIGNAL( destroyedHeaderFooter( HeaderFooter* ) ),
766 d, SLOT( slotUnregisterDestroyedHeaderFooter( HeaderFooter* ) ) );
767 connect( headerFooter, SIGNAL( positionChanged( HeaderFooter* ) ),
768 d, SLOT( slotRelayout() ) );
769 d->slotRelayout();
770 }
Parameters:
legend The legend to add.
See also:
replaceLegend, takeLegend
814 {
815 d->legends.append( legend );
816 legend->setParent( this );
817 connect( legend, SIGNAL( destroyedLegend( Legend* ) ),
818 d, SLOT( slotUnregisterDestroyedLegend( Legend* ) ) );
819 connect( legend, SIGNAL( positionChanged( AbstractAreaWidget* ) ),
820 d, SLOT( slotLayoutPlanes() ) ); //slotRelayout() ) );
821 connect( legend, SIGNAL( propertiesChanged() ),this, SIGNAL( propertiesChanged() ) );
822 d->slotRelayout();
823 }
Returns:
The first coordinate plane of the chart.
569 {
570 if ( d->coordinatePlanes.isEmpty() )
571 {
572 qWarning() << "Chart::coordinatePlane: warning: no coordinate plane defined.";
573 return 0;
574 } else {
575 return d->coordinatePlanes.first();
576 }
577 }
Returns:
The list of coordinate planes.
580 {
581 return d->coordinatePlanes;
582 }
The padding between the start of the widget and the start of the area that is used for drawing at the bottom.
Returns:
The padding between the start of the widget and the start of the area that is used for drawing at the
bottom.
See also:
setGlobalLeading
674 {
675 return d->globalLeadingBottom;
676 }
The padding between the start of the widget and the start of the area that is used for drawing on the left.
Returns:
The padding between the start of the widget and the start of the area that is used for drawing on the
left.
See also:
setGlobalLeading
641 {
642 return d->globalLeadingLeft;
643 }
The padding between the start of the widget and the start of the area that is used for drawing on the right.
Returns:
The padding between the start of the widget and the start of the area that is used for drawing on the
right.
See also:
setGlobalLeading
663 {
664 return d->globalLeadingRight;
665 }
The padding between the start of the widget and the start of the area that is used for drawing at the top.
Returns:
The padding between the start of the widget and the start of the area that is used for drawing at the top.
See also:
setGlobalLeading
652 {
653 return d->globalLeadingTop;
654 }
Returns:
The first header or footer of the chart or 0 if there was none added to the chart.
800 {
801 if( d->headerFooters.isEmpty() ) {
802 return 0;
803 } else {
804 return d->headerFooters.first();
805 }
806 }
Returns:
The list of headers and footers associated with the chart.
809 {
810 return d->headerFooters;
811 }
The first legend of the chart or 0 if there was none added to the chart.
Returns:
The first legend of the chart or 0 if none exists.
852 {
853 if ( d->legends.isEmpty() )
854 {
855 return 0;
856 } else {
857 return d->legends.first();
858 }
859 }
Returns:
The list of all legends associated with the chart.
862 {
863 return d->legends;
864 }
Note:
Any global leading settings will be used by the paint method too, so make sure to set them to zero, if
you want the drawing to have the exact size of the target rectangle.
Parameters:
painter The painter to be drawn into.
target The rectangle to be filled by the Chart’s drawing.
See also:
setGlobalLeading
684 {
685 //qDebug() << "KDChart::Chart::paint() called, inPaint: " << d->inPaint;
686 #ifdef debug_recursive_paint
687 ++nPaint;
688 if( 100<nPaint)
689 qFatal("nPaint > 100");
690 #endif
691 if( d->inPaint || target_.isEmpty() || !painter ) return;
692
693 d->inPaint = true;
694
695 const QRect oldGeometry( geometry() );
696 //painter->drawRect( oldGeometry );
697 QRect target( target_ );
698 QPoint translation(0,0);
699
700 if( target != oldGeometry ){
701 //qDebug() << "KDChart::Chart::paint() calling new setGeometry(" << target << ")";
702 setGeometry( target );
703 painter->drawRect( target );
704 d->slotLayoutPlanes();
705 translation.setX( target_.left() );
706 translation.setY( target_.left() );
707 painter->translate( translation );
708 }
709
710 KDAB_FOREACH( KDChart::AbstractArea* layoutItem, d->layoutItems ) {
711 layoutItem->paintAll( *painter );
712 }
713 KDAB_FOREACH( KDChart::AbstractArea* planeLayoutItem, d->planeLayoutItems ) {
714 planeLayoutItem->paintAll( *painter );
715 }
716 KDAB_FOREACH( KDChart::TextArea* textLayoutItem, d->textLayoutItems ) {
717 textLayoutItem->paintAll( *painter );
718 }
719 //int i=0;
720 KDAB_FOREACH( Legend *legend, d->legends ) {
721 //qDebug("legend # %i",++i);
722 if( ! legend->isHidden() ){
723 //legend->forceRebuild();
724 /*
725 const QPoint translation( legend->geometry().topLeft() );
726 painter->translate( translation );
727 legend->paintAll( *painter );
728 if( ! translation.isNull() )
729 painter->translate( -translation.x(), -translation.y() );
730 */
731 legend->paintIntoRect( *painter, legend->geometry() );
732 }
733 }
734
735 if( target_ != oldGeometry ){
736 //qDebug() << "KDChart::Chart::paint() calling new setGeometry(" << oldGeometry << ")";
737 setGeometry( oldGeometry );
738 if( ! translation.isNull() )
739 painter->translate( -translation.x(), -translation.y() );
740 }
741
742 d->inPaint = false;
743 //qDebug() << "KDChart::Chart::paint() done.\n";
744 }
See also:
paint
752 {
753 event->accept();
754
755 QPainter painter( this );
756 //FIXME(khz): Paint the background/frame too!
757 // (can we derive Chart from AreaWidget ??)
758 paint( &painter, geometry() );
759 }
Replaces the old coordinate plane, or appends the plane, it there is none yet.
Parameters:
plane The coordinate plane to be used instead of the old plane. This parameter must not be zero, or
the method will do nothing.
oldPlane The coordinate plane to be removed by the new plane. This plane will be deleted automati-
cally. If the parameter is omitted, the very first coordinate plane will be replaced. In case, there
was no plane yet, the new plane will just be added.
Note:
If you want to re-use the old coordinate plane, call takeCoordinatePlane and addCoordinatePlane,
instead of using replaceCoordinatePlane.
See also:
addCoordinatePlane, takeCoordinatePlane
599 {
600 if( plane && oldPlane_ != plane ){
601 AbstractCoordinatePlane* oldPlane = oldPlane_;
602 if( d->coordinatePlanes.count() ){
603 if( ! oldPlane )
604 oldPlane = d->coordinatePlanes.first();
Replaces the old header (or footer, resp.), or appends the new header or footer, it there is none yet.
Parameters:
headerFooter The header or footer to be used instead of the old one. This parameter must not be zero,
or the method will do nothing.
oldHeaderFooter The header or footer to be removed by the new one. This header or footer will be
deleted automatically. If the parameter is omitted, the very first header or footer will be replaced.
In case, there was no header and no footer yet, the new header or footer will just be added.
Note:
If you want to re-use the old header or footer, call takeHeaderFooter and addHeaderFooter, instead of
using replaceHeaderFooter.
See also:
addHeaderFooter, takeHeaderFooter
774 {
775 if( headerFooter && oldHeaderFooter_ != headerFooter ){
776 HeaderFooter* oldHeaderFooter = oldHeaderFooter_;
777 if( d->headerFooters.count() ){
778 if( ! oldHeaderFooter )
779 oldHeaderFooter = d->headerFooters.first();
780 takeHeaderFooter( oldHeaderFooter );
781 }
782 delete oldHeaderFooter;
783 addHeaderFooter( headerFooter );
784 }
785 }
Replaces the old legend, or appends the new legend, it there is none yet.
Parameters:
legend The legend to be used instead of the old one. This parameter must not be zero, or the method
will do nothing.
oldLegend The legend to be removed by the new one. This legend will be deleted automatically. If
the parameter is omitted, the very first legend will be replaced. In case, there was no legend yet,
the new legend will just be added.
Note:
If you want to re-use the old legend, call takeLegend and addLegend, instead of using replaceLegend.
See also:
addLegend, takeLegend
826 {
827 if( legend && oldLegend_ != legend ){
828 Legend* oldLegend = oldLegend_;
829 if( d->legends.count() ){
830 if( ! oldLegend )
831 oldLegend = d->legends.first();
832 takeLegend( oldLegend );
833 }
834 delete oldLegend;
835 addLegend( legend );
836 }
837 }
747 {
748 d->slotLayoutPlanes();
749 }
6.19.3.21 void Chart::setGlobalLeading (int left, int top, int right, int bottom)
Set the padding between the margin of the widget and the area that the contents are drawn into.
Parameters:
left The padding on the left side.
top The padding at the top.
right The padding on the left hand side.
bottom The padding on the bottom.
See also:
setGlobalLeadingTop, setGlobalLeadingBottom, setGlobalLeadingLeft, setGlobalLeadingRight
globalLeadingTop, globalLeadingBottom, globalLeadingLeft, globalLeadingRight
626 {
627 setGlobalLeadingLeft( left );
628 setGlobalLeadingTop( top );
629 setGlobalLeadingRight( right );
630 setGlobalLeadingBottom( bottom );
631 d->slotRelayout();
632 }
Set the padding between the start of the widget and the start of the area that is used for drawing on the
bottom.
Parameters:
leading The padding value.
See also:
setGlobalLeading
668 {
669 d->globalLeadingBottom = leading;
670 d->slotRelayout();
671 }
Set the padding between the start of the widget and the start of the area that is used for drawing on the left.
Parameters:
leading The padding value.
See also:
setGlobalLeading
635 {
636 d->globalLeadingLeft = leading;
637 d->slotRelayout();
638 }
Set the padding between the start of the widget and the start of the area that is used for drawing on the right.
Parameters:
leading The padding value.
See also:
setGlobalLeading
657 {
658 d->globalLeadingRight = leading;
659 d->slotRelayout();
660 }
Set the padding between the start of the widget and the start of the area that is used for drawing at the top.
Parameters:
leading The padding value.
See also:
setGlobalLeading
646 {
647 d->globalLeadingTop = leading;
648 d->slotRelayout();
649 }
Removes the coordinate plane from the chart, without deleting it.
The chart no longer owns the plane, so it is the caller’s responsibility to delete the plane.
See also:
addCoordinatePlane, takeCoordinatePlane
613 {
614 const int idx = d->coordinatePlanes.indexOf( plane );
615 if( idx != -1 ){
616 d->coordinatePlanes.takeAt( idx );
617 disconnect( plane, SIGNAL( destroyedCoordinatePlane( AbstractCoordinatePlane* ) ),
618 d, SLOT( slotUnregisterDestroyedPlane( AbstractCoordinatePlane* ) ) );
619 plane->removeFromParentLayout();
620 plane->setParent( 0 );
621 }
622 d->slotLayoutPlanes();
623 }
Removes the header (or footer, resp.) from the chart, without deleting it.
The chart no longer owns the header or footer, so it is the caller’s responsibility to delete the header or
footer.
See also:
addHeaderFooter, replaceHeaderFooter
788 {
789 const int idx = d->headerFooters.indexOf( headerFooter );
790 if( idx != -1 ){
791 d->headerFooters.takeAt( idx );
792 disconnect( headerFooter, SIGNAL( destroyedHeaderFooter( HeaderFooter* ) ),
793 d, SLOT( slotUnregisterDestroyedHeaderFooter( HeaderFooter* ) ) );
794 headerFooter->setParent( 0 );
795 }
796 d->slotRelayout();
797 }
See also:
addLegend, takeLegend
840 {
841 const int idx = d->legends.indexOf( legend );
842 if( idx != -1 ){
843 d->legends.takeAt( idx );
• KDChartChart.h
• KDChartChart.cpp
Helper class for one dimension of data, e.g. for the rows in a data model, or for the labels of an axis, or for
the vertical lines in a grid.
isCalculated specifies whether this dimension’s values are calculated or counted. (counted == "Item 1",
"Item 2", "Item 3" ...)
sequence is the GranularitySequence, as specified at for the respective coordinate plane.
Step width is an optional parameter, to be omitted (or set to Zero, resp.) if the step width is unknown.
The default c’tor just gets you counted values from 1..10, using step width 1, used by the CartesianGrid,
when showing an empty plane without any diagrams.
Definition at line 320 of file KDChartAbstractCoordinatePlane.h.
Public Attributes
• AbstractCoordinatePlane::AxesCalcMode calcMode
• qreal end
• bool isCalculated
• KDChartEnums::GranularitySequence sequence
• qreal start
• qreal stepWidth
• qreal subStepWidth
6.20.2.1 KDChart::DataDimension::DataDimension ()
326 {}
327 DataDimension( qreal start_,
328 qreal end_,
329 bool isCalculated_,
330 AbstractCoordinatePlane::AxesCalcMode calcMode_,
Returns the size of the distance, equivalent to the width() (or height(), resp.) of a QRectF.
Note that this value can be negative, e.g. indicating axis labels going in reversed direction.
Definition at line 353 of file KDChartAbstractCoordinatePlane.h.
References start.
Referenced by KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::Cartesian-
Axis::paintCtx().
355 {
356 return
• KDChartAbstractCoordinatePlane.h
DatasetProxyModel takes a KDChart dataset configuration and translates it into a filtering proxy model.
The resulting model will only contain the part of the model that is selected by the dataset, and the according
row and column header data.
Currently, this model is implemented for table models only. The way it would work with models represent-
ing a tree is to be decided.
The column selection is configured by passing a dataset description vector to the model. This vector (of
integers) is supposed to have one value for each column of the original model. If the value at position x is
-1, column x of the original model is not included in the dataset. If it is between 0 and (columnCount() -1),
it is the column the source column is mapped to in the resulting model. Any other value is an error.
Definition at line 58 of file KDChartDatasetProxyModel.h.
• QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
• QModelIndex mapFromSource (const QModelIndex &sourceIndex) const
Implements the mapping from the source to the proxy indexes.
Public Attributes
• public Q_SLOTS: void resetDatasetDescriptions()
Create a DatasetProxyModel.
Without further configuration, this model is invalid.
See also:
setDatasetDescriptionVector
36 : QSortFilterProxyModel ( parent )
37 {
38 }
6.21.3.1 QVariant DatasetProxyModel::data (const QModelIndex & index, int role) const
210 {
211 return sourceModel()->data( mapToSource ( index ), role );
212 }
138 {
139 if ( mColSrcToProxyMap.isEmpty() )
140 { // no column mapping set up yet, all columns are passed down:
141 return true;
142 } else {
143 Q_ASSERT ( sourceModel() );
144 Q_ASSERT ( mColSrcToProxyMap.size() == sourceModel()->columnCount(mRootIndex) );
145 if ( mColSrcToProxyMap[sourceColumn] == -1 )
146 { // this column is explicitly not accepted:
147 return false;
148 } else {
149 Q_ASSERT ( mColSrcToProxyMap[sourceColumn] >= 0
150 && mColSrcToProxyMap[sourceColumn] < mColSrcToProxyMap.size() );
151 return true;
152 }
153 }
154 }
118 {
119 if ( mRowSrcToProxyMap.isEmpty() )
120 { // no row mapping set, all rows are passed down:
121 return true;
122 } else {
123 Q_ASSERT ( sourceModel() );
124 Q_ASSERT ( mRowSrcToProxyMap.size() == sourceModel()->rowCount(mRootIndex) );
125 if ( mRowSrcToProxyMap[sourceRow] == -1 )
126 { // this row is explicitly not accepted:
127 return false;
128 } else {
129 Q_ASSERT ( mRowSrcToProxyMap[sourceRow] >= 0
130 && mRowSrcToProxyMap[sourceRow] < mRowSrcToProxyMap.size() );
131 return true;
132 }
133 }
134 }
215 {
216 if ( orientation == Qt::Horizontal )
217 {
218 if ( mapProxyColumnToSource ( section ) == -1 )
219 {
220 return QVariant();
221 } else {
222 return sourceModel()->headerData ( mapProxyColumnToSource ( section ),
223 orientation, role );
224 }
225 } else {
226 if ( mapProxyRowToSource ( section ) == -1 )
227 {
228 return QVariant();
229 } else {
230 return sourceModel()->headerData ( mapProxyRowToSource ( section ),
231 orientation, role );
232 }
233 }
234 }
6.21.3.5 QModelIndex DatasetProxyModel::index (int row, int column, const QModelIndex &
parent = QModelIndex()) const
70 {
71 return mapFromSource( sourceModel()->index( mapProxyRowToSource(row),
72 mapProxyColumnToSource(column),
73 parent ) );
74 }
82 {
83 Q_ASSERT_X ( sourceModel(), "DatasetProxyModel::mapFromSource", "A source "
84 "model must be set before the selection can be configured." );
85
86 if ( !sourceIndex.isValid() ) return sourceIndex;
87
88 if ( mRowSrcToProxyMap.isEmpty() && mColSrcToProxyMap.isEmpty() )
89 {
90 return createIndex ( sourceIndex.row(), sourceIndex.column(),
91 sourceIndex.internalPointer() );
92 } else {
93 int row = mapSourceRowToProxy ( sourceIndex.row() );
94 int column = mapSourceColumnToProxy ( sourceIndex.column() );
95 return createIndex ( row, column, sourceIndex.internalPointer() );
96 }
97 }
100 {
101 Q_ASSERT_X ( sourceModel(), "DatasetProxyModel::mapToSource", "A source "
102 "model must be set before the selection can be configured." );
103
104 if ( !proxyIndex.isValid() ) return proxyIndex;
105 if ( mRowSrcToProxyMap.isEmpty() && mColSrcToProxyMap.isEmpty() )
106 {
107 return createIndex ( proxyIndex.row(), proxyIndex.column(),
108 proxyIndex.internalPointer() );
109 } else {
110 int row = mapProxyRowToSource ( proxyIndex.row() );
111 int column = mapProxyColumnToSource ( proxyIndex.column() );
112 return createIndex ( row, column, proxyIndex.internalPointer() );
113 }
114 }
77 {
78 return mapFromSource( sourceModel()->parent( child ) );
79 }
52 {
53 Q_ASSERT_X ( sourceModel(), "DatasetProxyModel::setDatasetColumnDescriptionVector",
54 "A source model must be set before the selection can be configured." );
55 initializeDatasetDecriptors ( configuration, sourceModel()->columnCount(mRootIndex),
56 mColSrcToProxyMap, mColProxyToSrcMap );
57 clear(); // clear emits layoutChanged()
58 }
63 {
64 setDatasetRowDescriptionVector( rowConfig );
65 setDatasetColumnDescriptionVector ( columnConfig );
66 }
42 {
43 Q_ASSERT_X ( sourceModel(), "DatasetProxyModel::setDatasetRowDescriptionVector",
44 "A source model must be set before the selection can be configured." );
45 initializeDatasetDecriptors ( configuration, sourceModel()->rowCount(mRootIndex),
46 mRowSrcToProxyMap, mRowProxyToSrcMap );
47 clear(); // clear emits layoutChanged()
48 }
262 {
263 QSortFilterProxyModel::setSourceModel ( sourceModel );
264 mRootIndex = QModelIndex();
265 connect ( sourceModel, SIGNAL ( layoutChanged() ),
266 SLOT( resetDatasetDescriptions() ) );
267
268 resetDatasetDescriptions();
269 }
272 {
273 mRootIndex = rootIdx;
274 resetDatasetDescriptions();
275 }
• KDChartDatasetProxyModel.h
• KDChartDatasetProxyModel.cpp
Public Attributes
37 : QFrame ( parent )
38 , mUi ( new Ui::DatasetSelector () )
39 , mSourceRowCount ( 0 )
40 , mSourceColumnCount ( 0 )
41 {
42 qWarning("For DatasetSelectorWidget to become useful, it has to be connected to the proxy model it
43
44 mUi->setupUi ( this );
45 setMinimumSize ( minimumSizeHint() );
46 }
Referenced by on_groupBox_toggled().
74 {
75 calculateMapping();
76 }
69 {
70 calculateMapping();
71 }
79 {
80 if ( state )
81 {
82 calculateMapping();
83 } else {
84 emit mappingDisabled();
85 }
86 }
59 {
60 calculateMapping();
61 }
64 {
65 calculateMapping();
66 }
54 {
55 calculateMapping();
56 }
99 {
100 if ( columnCount != mSourceColumnCount )
101 {
102 mSourceColumnCount = columnCount;
103 resetDisplayValues();
104 }
105 }
• KDChartDatasetSelector.h
• KDChartDatasetSelector.cpp
6.23.2.1 KDChart::DataValueAttributes::DataValueAttributes ()
6.23.2.3 KDChart::DataValueAttributes::∼DataValueAttributes ()
Returns:
The background attributes used for painting the data value labels area.
See also:
BackgroundAttributes
Referenced by operator<<().
Returns:
The string to be displayed instead of the data value text.
Referenced by KDChart::AbstractDiagram::paintDataValueText().
Returns:
The number of decimal digits displayed.
Returns:
The frame attributes used for painting the data value labels area.
See also:
FrameAttributes
Referenced by operator<<().
Returns:
Whether data value labels should be displayed.
Returns:
The marker attributes used for decorating the data values.
See also:
MarkerAttributes
Referenced by KDChart::AbstractDiagram::paintMarker().
Referenced by operator<<().
58 { return !operator==(other); }
Referenced by operator<<().
Referenced by operator<<().
Returns:
The string used as a prefix to the data value text.
Referenced by KDChart::AbstractDiagram::paintDataValueText().
Set the background attributes to use for the data value labels area.
Parameters:
a The background attributes to set.
See also:
BackgroundAttributes
Parameters:
label: the string to be displayed.
Set how many decimal digits to display when rendering the data value labels.
If there are no decimal digits it will not be displayed.
Parameters:
digits The number of decimal digits to use.
Set the frame attributes to use for the data value labels area.
Parameters:
a The frame attributes to set.
See also:
FrameAttributes
Parameters:
a The marker attributes to set.
See also:
MarkerAttributes
Parameters:
prefix The string to prepend.
Parameters:
suffix The string to append.
Set the text attributes to use for the data value labels.
Parameters:
a The text attributes to set.
See also:
TextAttributes
Parameters:
visible Whether data value labels should be displayed.
Referenced by operator<<().
Returns:
The string used as a suffix to the data value text.
Referenced by KDChart::AbstractDiagram::paintDataValueText().
Returns:
The text attributes used for painting data value labels.
• KDChartDataValueAttributes.h
A DiagramObserver watches the associated diagram for changes and deletion and emits corresponsing
signals.
Definition at line 43 of file KDChartDiagramObserver.h.
• void slotAttributesChanged ()
• void slotDataChanged ()
• void slotModelsChanged ()
• ∼DiagramObserver ()
Public Attributes
• Q_SIGNALS __pad0__: void diagramDestroyed( AbstractDiagram∗ diagram )
• private Q_SLOTS: void slotDestroyed()
6.24.2.2 DiagramObserver::∼DiagramObserver ()
49 {}
57 {
58 return m_diagram;
59 }
52 {
53 return m_diagram;
54 }
100 {
101 emit diagramAttributesChanged( m_diagram );
102 }
95 {
96 emit diagramDataChanged( m_diagram );
97 }
88 {
89 init();
90 slotDataChanged();
91 slotAttributesChanged();
92 }
• KDChartDiagramObserver.h
• KDChartDiagramObserver.cpp
6.25.1.1 KDChart::FrameAttributes::FrameAttributes ()
6.25.1.3 KDChart::FrameAttributes::∼FrameAttributes ()
Referenced by operator<<().
59 { return !operator==(other); }
Referenced by operator<<().
Referenced by operator<<().
The documentation for this class was generated from the following file:
• KDChartFrameAttributes.h
6.26.1.1 KDChart::GridAttributes::GridAttributes ()
6.26.1.3 KDChart::GridAttributes::∼GridAttributes ()
Referenced by KDChart::CartesianCoordinatePlane::getDataDimensionsList().
Referenced by operator<<().
Referenced by operator<<().
Referenced by operator<<().
79 { return !operator==(other); }
Referenced by operator<<().
Referenced by operator<<().
The documentation for this class was generated from the following file:
• KDChartGridAttributes.h
Public Types
• enum HeaderFooterType {
Header,
Footer }
Public Attributes
• Q_SIGNALS __pad0__: void destroyedHeaderFooter( HeaderFooter∗ )
Protected Attributes
• QWidget ∗ mParent
• QLayout ∗ mParentLayout
Enumeration values:
Header
Footer
54 { Header,
55 Footer };
55 :
56 TextArea( new Private() )
57 {
58 setParent( parent );
59 init();
60 }
63 {
64 emit destroyedHeaderFooter( this );
65 }
76 {
77 Q_UNUSED( position );
78 // PENDING(kalle) FIXME
79 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosi
80 }
Implements KDChart::AbstractAreaBase.
Definition at line 105 of file KDChartTextArea.cpp.
References KDChart::TextLayoutItem::geometry().
Referenced by KDChart::TextArea::paintAll().
106 {
107 return geometry();
108 }
123 {
124 return mAutoReferenceArea;
125 }
98 {
99 return d->backgroundAttributes;
100 }
92 {
93 HeaderFooter* headerFooter = new HeaderFooter( new Private( *d ), 0 );
94 headerFooter->setType( type() );
95 headerFooter->setPosition( position() );
96 headerFooter->setTextAttributes( textAttributes() );
97 return headerFooter;
98 }
163 {
164 return 0; // Grow neither vertically nor horizontally
165 }
88 {
89 return d->frameAttributes;
90 }
168 {
169 return mRect;
170 }
176 {
177 Q_ASSERT_X ( d != 0, "AbstractAreaBase::innerRect()",
178 "Private class was not initialized!" );
179
180 const int padding
181 = d->frameAttributes.isVisible()
182 ? qMax( d->frameAttributes.padding(), 0 ) : 0;
183 return
184 QRect( QPoint(0,0), areaGeometry().size() )
185 .adjusted( padding, padding, -padding, -padding );
186 }
249 {
250 if ( mAttributes.rotation() != other.mAttributes.rotation() )
251 {
252 // that’s the code for the common case: the rotation angles don’t need to match here
253 QPolygon myPolygon( rotatedCorners() );
254 QPolygon otherPolygon( other.rotatedCorners() );
255
256 // move the polygons to their positions
257 myPolygon.translate( myPos );
258 otherPolygon.translate( otherPos );
259
260 // create regions out of it
261 QRegion myRegion( myPolygon );
262 QRegion otherRegion( otherPolygon );
263
264 // now the question - do they intersect or not?
265 return ! myRegion.intersect( otherRegion ).isEmpty();
266
267 } else {
268 // and that’s the code for the special case: the rotation angles match, which is less time con
269 const qreal angle = mAttributes.rotation() * PI / 180.0;
270 // both sizes
271 const QSizeF mySize( unrotatedSizeHint() );
272 const QSizeF otherSize( other.unrotatedSizeHint() );
273
274 // that’s myP1 relative to myPos
275 QPointF myP1( mySize.height() * sin( angle ), 0.0 );
276 // that’s otherP1 to myPos
277 QPointF otherP1 = QPointF( otherSize.height() * sin( angle ), 0.0 ) + otherPos - myPos;
278
279 // now rotate both points the negative angle around myPos
280 myP1 = QPointF( myP1.x() * cos( -angle ), myP1.x() * sin( -angle ) );
281 qreal r = sqrt( otherP1.x() * otherP1.x() + otherP1.y() * otherP1.y() );
282 otherP1 = QPointF( r * cos( -angle ), r * sin( -angle ) );
283
284 // finally we look, whether both rectangles intersect or even not
285 return QRectF( myP1, mySize ).intersects( QRectF( otherP1, otherSize ) );
286 }
287 }
244 {
245 return intersects( other, myPos.toPoint(), otherPos.toPoint() );
246 }
173 {
174 return false; // never empty, otherwise the layout item would not exist
175 }
178 {
179 return sizeHint(); // PENDING(kalle) Review, quite inflexible
180 }
183 {
184 return sizeHint(); // PENDING(kalle) Review, quite inflexible
185 }
Implements KDChart::AbstractLayoutItem.
Definition at line 325 of file KDChartLayoutItems.cpp.
References KDChart::TextLayoutItem::geometry(), KDChart::TextAttributes::pen(), KDChart::Text-
Attributes::rotation(), and KDChart::TextLayoutItem::sizeHint().
Referenced by KDChart::TextArea::paintAll(), and KDChart::CartesianAxis::paintCtx().
326 {
327 // make sure, cached font is updated, if needed:
328 sizeHint();
329
330 if( !mRect.isValid() )
331 return;
332
333 PainterSaver painterSaver( painter );
334 painter->setFont( cachedFont );
335 painter->setPen( mAttributes.pen() );
336 QRectF rect = geometry();
337
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked
automatically.
Definition at line 83 of file KDChartTextArea.cpp.
References KDChart::TextArea::areaGeometry(), KDChart::TextLayoutItem::geometry(),
KDChart::AbstractAreaBase::innerRect(), KDChart::TextLayoutItem::paint(), KDChart::Abstract-
AreaBase::paintBackground(), KDChart::AbstractAreaBase::paintFrame(), and KDChart::TextLayout-
Item::setGeometry().
Referenced by KDChart::Chart::paint(), and KDChart::TextArea::paintIntoRect().
84 {
85 // Paint the background and frame
86 paintBackground( painter, geometry() );
87 paintFrame( painter, geometry() );
88
89 // temporarily adjust the widget size, to be sure all content gets calculated
90 // to fit into the inner rectangle
91 const QRect oldGeometry( areaGeometry() );
92 QRect inner( innerRect() );
93 inner.moveTo(
94 oldGeometry.left() + inner.left(),
95 oldGeometry.top() + inner.top() );
96 const bool needAdjustGeometry = oldGeometry != inner;
97 if( needAdjustGeometry )
98 setGeometry( inner );
99 paint( &painter );
100 if( needAdjustGeometry )
101 setGeometry( oldGeometry );
102 //qDebug() << "TextAreaWidget::paintAll() done.";
103 }
104 {
105 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
106 "Private class was not initialized!" );
107
108 #define attributes d->backgroundAttributes
109
110 if( !attributes.isVisible() ) return;
111
112 /* first draw the brush (may contain a pixmap)*/
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
6.27.3.19 void AbstractAreaBase::paintFrame (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
159 {
160 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
161 "Private class was not initialized!" );
162
163 #define attributes d->frameAttributes
164
165 if( !attributes.isVisible() ) return;
166
167 const QPen oldPen( painter.pen() );
168 painter.setPen( attributes.pen() );
169 painter.drawRect( rect );
170 painter.setPen( oldPen );
171 #undef attributes
172 }
6.27.3.20 void TextArea::paintIntoRect (QPainter & painter, const QRect & rect) [virtual,
inherited]
72 {
73 const QRect oldGeometry( geometry() );
74 if( oldGeometry != rect )
75 setGeometry( rect );
76 painter.translate( rect.left(), rect.top() );
77 paintAll( painter );
78 painter.translate( -rect.left(), -rect.top() );
79 if( oldGeometry != rect )
80 setGeometry( oldGeometry );
81 }
118 {
119 return d->position;
120 }
111 {
112 emit positionChanged( this );
113 }
221 {
222 realFontWasRecalculated(); // we can safely ignore the boolean return value
223 return cachedFont;
224 }
194 {
195 return qMax(
196 mAttributes.fontSize().calculatedValue(
197 mAutoReferenceArea,
198 mAutoReferenceOrientation ),
199 mAttributes.minimalFontSize().calculatedValue(
200 mAutoReferenceArea,
201 mAutoReferenceOrientation ) );
202 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
116 {
117 mAutoReferenceArea = area;
118 cachedSizeHint = QSize();
119 sizeHint();
120 }
93 {
94 d->backgroundAttributes = a;
95 }
83 {
84 d->frameAttributes = a;
85 }
188 {
189 mRect = r;
190 }
68 {
69 QObject::setParent( parent );
70 if( parent && ! autoReferenceArea() )
71 setAutoReferenceArea( parent );
72 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
112 {
113 d->position = position;
114 emit positionChanged( this );
115 }
128 {
129 mText = text;
130 cachedSizeHint = QSize();
131 sizeHint();
132 }
Use this to specify the text attributes to be used for this item.
See also:
textAttributes
145 {
146 mAttributes = a;
147 cachedSizeHint = QSize(); // invalidate size hint
148 sizeHint();
149 }
101 {
102 d->type = type;
103 emit positionChanged( this );
104 }
290 {
291 if( realFontWasRecalculated() )
292 {
293 cachedSizeHint = calcSizeHint( cachedFont );
294 sizeHintChanged();
295 }
296 //qDebug("cachedSizeHint.width(): %i",cachedSizeHint.width());
297 return cachedSizeHint;
298 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
135 {
136 return mText;
137 }
See also:
setTextAttributes
157 {
158 return mAttributes;
159 }
107 {
108 return d->type;
109 }
• KDChartHeaderFooter.h
• KDChartHeaderFooter.cpp
#include <KDChartLayoutItems.h>
Inheritance diagram for KDChart::HorizontalLineLayoutItem:Collaboration diagram for
KDChart::HorizontalLineLayoutItem:
• void removeFromParentLayout ()
• virtual void setGeometry (const QRect &r)
• void setParentLayout (QLayout ∗lay)
• virtual void setParentWidget (QWidget ∗widget)
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Protected Attributes
• QWidget ∗ mParent
• QLayout ∗ mParentLayout
6.28.1.1 KDChart::HorizontalLineLayoutItem::HorizontalLineLayoutItem ()
417 {
418 return Qt::Vertical|Qt::Horizontal; // Grow neither vertically nor horizontally
419 }
422 {
423 return mRect;
424 }
427 {
428 return false; // never empty, otherwise the layout item would not exist
429 }
432 {
433 return QSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX );
434 }
437 {
438 return QSize( 0, 0 );
439 }
Implements KDChart::AbstractLayoutItem.
Definition at line 452 of file KDChartLayoutItems.cpp.
453 {
454 if( !mRect.isValid() )
455 return;
456
457 painter->drawLine( QPointF( mRect.left(), mRect.center().y() ),
458 QPointF( mRect.right(), mRect.center().y() ) );
459 }
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
442 {
443 mRect = r;
444 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
447 {
448 return QSize( -1, 3 ); // see qframe.cpp
449 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
• KDChartLayoutItems.h
• KDChartLayoutItems.cpp
Project global class providing some enums needed both by KDChartParams and by KDChartCustomBox.
Definition at line 46 of file KDChartEnums.h.
Public Types
• enum GranularitySequence {
GranularitySequence_10_20,
GranularitySequence_10_50,
GranularitySequence_25_50,
GranularitySequenceIrregular }
GranularitySequence specifies the values, that may be applied, to determine a step width within a given
data range.
• enum MeasureCalculationMode {
MeasureCalculationModeAbsolute,
MeasureCalculationModeRelative,
MeasureCalculationModeAuto,
MeasureCalculationModeAutoArea,
MeasureCalculationModeAutoOrientation }
Measure calculation mode: the way how the absolute value of a KDChart::Measure is determined during
KD Chart’s internal geometry calculation time.
• enum MeasureOrientation {
MeasureOrientationAuto,
MeasureOrientationHorizontal,
MeasureOrientationVertical,
MeasureOrientationMinimum,
MeasureOrientationMaximum }
Measure orientation mode: the way how the absolute value of a KDChart::Measure is determined during
KD Chart’s internal geometry calculation time.
• enum PositionValue {
PositionUnknown = 0,
PositionCenter = 1,
PositionNorthWest = 2,
PositionNorth = 3,
PositionNorthEast = 4,
PositionEast = 5,
PositionSouthEast = 6,
PositionSouth = 7,
PositionSouthWest = 8,
PositionWest = 9 }
Numerical values of the static KDChart::Position instances, for using a Position::value() with a switch()
statement.
• enum TextLayoutPolicy {
LayoutJustOverwrite,
LayoutPolicyRotate,
LayoutPolicyShiftVertically,
LayoutPolicyShiftHorizontally,
LayoutPolicyShrinkFontSize }
Text layout policy: what to do if text that is to be drawn would cover neighboring text or neighboring areas.
GranularitySequence specifies the values, that may be applied, to determine a step width within a given
data range.
Note:
Granularity with can be set for Linear axis calculation mode only, there is no way to specify a step
width for Logarithmic axes.
Value occuring in the GranularitySequence names only are showing their respective relation ship. For real
data they will most times not be used directly, but be multiplied by positive (or negative, resp.) powers of
ten.
A granularity sequence is a sequence of values from the following set: 1, 2, 2.5, 5.
The reason for using one of the following three pre-defined granularity sequences (instead of just using the
best matching step width) is to follow a simple rule: If scaling becomes finer (== smaller step width) no
value, that has been on a grid line before, shall loose its line and be NOT on a grid line anymore!
This means: Smaller step width may not remove any grid lines, but it may add additional lines in between.
• GranularitySequence_10_20 Step widths can be 1, or 2, but they never can be 2.5 nor 5.
• GranularitySequence_10_50 Step widths can be 1, or 5, but they never can be 2, nor 2.5.
• GranularitySequence_25_50 Step widths can be 2.5, or 5, but they never can be 1, nor 2.
• GranularitySequenceIrregular Step widths can be all of these values: 1, or 2, or 2.5, or
5.
Note:
When ever possible, try to avoid using GranularitySequenceIrregular! Allowing all possible step val-
ues, using this granularity sequence involves a serious risk: Your users might be irritated due to ’jump-
ing’ grid lines, when step size is changed from 2.5 to 2 (or vice versa, resp.).
Since you probably like having the value 1 as an allowed step width, the granularity sequence decision
boils down to a boolean question:
Enumeration values:
GranularitySequence_10_20
GranularitySequence_10_50
GranularitySequence_25_50
GranularitySequenceIrregular
94 {
95 GranularitySequence_10_20,
96 GranularitySequence_10_50,
97 GranularitySequence_25_50,
98 GranularitySequenceIrregular };
Measure calculation mode: the way how the absolute value of a KDChart::Measure is determined during
KD Chart’s internal geometry calculation time.
KDChart::Measure values either are relative (calculated in relation to a given AbstractArea), or they are
absolute (used as fixed values).
Values stored in relative measure always are interpreted as per-mille of a reference area’s height (or width,
resp.) depending on the orientation set for the KDChart::Measure.
See also:
KDChart::Measure::setCalculationMode
Enumeration values:
MeasureCalculationModeAbsolute
MeasureCalculationModeRelative
MeasureCalculationModeAuto
MeasureCalculationModeAutoArea
MeasureCalculationModeAutoOrientation
215 { MeasureCalculationModeAbsolute,
216 MeasureCalculationModeRelative,
217 MeasureCalculationModeAuto,
218 MeasureCalculationModeAutoArea,
219 MeasureCalculationModeAutoOrientation };
Measure orientation mode: the way how the absolute value of a KDChart::Measure is determined during
KD Chart’s internal geometry calculation time.
KDChart::Measure values either are relative (calculated in relation to a given AbstractArea), or they are
absolute (used as fixed values).
Values stored in relative measure take into account the width (and/or the height, resp.) of a so-called
reference area, that is either specified by KDChart::Measure::setReferenceArea, or determined by KD
Chart automatically, respectively.
• MeasureOrientationAuto Value is calculated, based upon the width (or on the height, resp.)
of the reference area: KD Chart will automatically determie an appropriate way.
• MeasureOrientationHorizontal Value is calculated, based upon the width of the reference
area.
• MeasureOrientationVertical Value is calculated, based upon the height of the reference
area.
• MeasureOrientationMinimum Value is calculated, based upon the width (or on the height,
resp.) of the reference area - which ever is smaller.
• MeasureOrientationMaximum Value is calculated, based upon the width (or on the height,
resp.) of the reference area - which ever is smaller.
See also:
KDChart::Measure::setOrientationMode
Enumeration values:
MeasureOrientationAuto
MeasureOrientationHorizontal
MeasureOrientationVertical
MeasureOrientationMinimum
MeasureOrientationMaximum
284 { MeasureOrientationAuto,
285 MeasureOrientationHorizontal,
286 MeasureOrientationVertical,
287 MeasureOrientationMinimum,
288 MeasureOrientationMaximum };
Numerical values of the static KDChart::Position instances, for using a Position::value() with a switch()
statement.
See also:
Position
Enumeration values:
PositionUnknown
PositionCenter
PositionNorthWest
PositionNorth
PositionNorthEast
PositionEast
PositionSouthEast
PositionSouth
PositionSouthWest
PositionWest
187 {
188 PositionUnknown = 0,
189 PositionCenter = 1,
190 PositionNorthWest = 2,
191 PositionNorth = 3,
192 PositionNorthEast = 4,
193 PositionEast = 5,
194 PositionSouthEast = 6,
195 PositionSouth = 7,
196 PositionSouthWest = 8,
197 PositionWest = 9 };
Text layout policy: what to do if text that is to be drawn would cover neighboring text or neighboring areas.
• LayoutJustOverwrite Just ignore the layout collision and write the text nevertheless.
• LayoutPolicyRotate Try counter-clockwise rotation to make the text fit into the space.
• LayoutPolicyShiftVertically Shift the text baseline upwards (or downwards, resp.) and
draw a connector line between the text and its anchor.
• LayoutPolicyShiftHorizontally Shift the text baseline to the left (or to the right, resp.)
and draw a connector line between the text and its anchor.
See also:
KDChartParams::setPrintDataValues
Enumeration values:
LayoutJustOverwrite
LayoutPolicyRotate
LayoutPolicyShiftVertically
LayoutPolicyShiftHorizontally
LayoutPolicyShrinkFontSize
156 { LayoutJustOverwrite,
157 LayoutPolicyRotate,
158 LayoutPolicyShiftVertically,
159 LayoutPolicyShiftHorizontally,
160 LayoutPolicyShrinkFontSize };
Parameters:
type the granularity sequence enum to convert
Returns:
the string representation of the granularity sequence
107 {
108 switch( sequence ) {
109 case GranularitySequence_10_20:
110 return QString::fromLatin1("GranularitySequence_10_20");
111 case GranularitySequence_10_50:
112 return QString::fromLatin1("GranularitySequence_10_50");
113 case GranularitySequence_25_50:
114 return QString::fromLatin1("GranularitySequence_25_50");
115 case GranularitySequenceIrregular:
116 return QString::fromLatin1("GranularitySequenceIrregular");
117 default: // should not happen
118 qDebug( "Unknown granularity sequence" );
119 return QString::fromLatin1("GranularitySequence_10_20");
120 }
121 }
Parameters:
type the text layout policy to convert
Returns:
the string representation of the text layout policy enum
Parameters:
type the measure calculation mode to convert
Returns:
the string representation of the Measure calculation mode enum
228 {
229 switch( mode ) {
230 case MeasureCalculationModeAbsolute:
231 return QString::fromLatin1("MeasureCalculationModeAbsolute");
232 case MeasureCalculationModeAuto:
233 return QString::fromLatin1("MeasureCalculationModeAuto");
234 case MeasureCalculationModeAutoArea:
235 return QString::fromLatin1("MeasureCalculationModeAutoArea");
236 case MeasureCalculationModeAutoOrientation:
237 return QString::fromLatin1("MeasureCalculationModeAutoOrientation");
238 case MeasureCalculationModeRelative:
239 return QString::fromLatin1("MeasureCalculationModeRelative");
240 default: // should not happen
241 qDebug( "Unknown measure calculation mode" );
242 return QString::fromLatin1("MeasureCalculationModeAuto");
243 }
244 }
Parameters:
type the measure orientation to convert
Returns:
the string representation of the measure orientation enum
297 {
298 switch( mode ) {
299 case MeasureOrientationAuto:
300 return QString::fromLatin1("MeasureOrientationAuto");
301 case MeasureOrientationHorizontal:
302 return QString::fromLatin1("MeasureOrientationHorizontal");
303 case MeasureOrientationVertical:
304 return QString::fromLatin1("MeasureOrientationVertical");
305 case MeasureOrientationMinimum:
306 return QString::fromLatin1("MeasureOrientationMinimum");
307 case MeasureOrientationMaximum:
308 return QString::fromLatin1("MeasureOrientationMaximum");
309 default: // should not happen
310 qDebug( "Unknown measure orientation mode" );
311 return QString::fromLatin1("MeasureOrientationAuto");
312 }
313 }
Parameters:
string the string to convert
Returns:
the granularity sequence enum value
130 {
131 if( string == QString::fromLatin1("GranularitySequence_10_20") )
132 return GranularitySequence_10_20;
133 if( string == QString::fromLatin1("GranularitySequence_10_50") )
134 return GranularitySequence_10_50;
135 if( string == QString::fromLatin1("GranularitySequence_25_50") )
136 return GranularitySequence_25_50;
137 if( string == QString::fromLatin1("GranularitySequenceIrregular") )
138 return GranularitySequenceIrregular;
139 // default, should not happen
140 return GranularitySequence_10_20;
141 }
Parameters:
string the string to convert
Returns:
the text layout policy enum value
Parameters:
string the string to convert
Returns:
the measure calculation mode enum value
253 {
254 if( string == QString::fromLatin1("MeasureCalculationModeAbsolute") )
255 return MeasureCalculationModeAbsolute;
256 if( string == QString::fromLatin1("MeasureCalculationModeAuto") )
257 return MeasureCalculationModeAuto;
258 if( string == QString::fromLatin1("MeasureCalculationModeAutoArea") )
259 return MeasureCalculationModeAutoArea;
260 if( string == QString::fromLatin1("MeasureCalculationModeAutoOrientation") )
261 return MeasureCalculationModeAutoOrientation;
262 if( string == QString::fromLatin1("MeasureCalculationModeRelative") )
263 return MeasureCalculationModeRelative;
264 // default, should not happen
265 return MeasureCalculationModeAuto;
266 }
Parameters:
string the string to convert
Returns:
the measure orientation enum value
322 {
323 if( string == QString::fromLatin1("MeasureOrientationAuto") )
324 return MeasureOrientationAuto;
325 if( string == QString::fromLatin1("MeasureOrientationHorizontal") )
326 return MeasureOrientationHorizontal;
327 if( string == QString::fromLatin1("MeasureOrientationVertical") )
328 return MeasureOrientationVertical;
329 if( string == QString::fromLatin1("MeasureOrientationMinimum") )
330 return MeasureOrientationMinimum;
331 if( string == QString::fromLatin1("MeasureOrientationMaximum") )
332 return MeasureOrientationMaximum;
333 // default, should not happen
334 return MeasureOrientationAuto;
335 }
The documentation for this class was generated from the following file:
• KDChartEnums.h
#include <KDTextDocument.h>
Inheritance diagram for KDTextDocument:Collaboration diagram for KDTextDocument:
39 : QTextDocument( p ),
40 mHintValid( false ),
41 mSizeHint(),
42 mMinimumSizeHint()
43 {
44
45 }
48 : QTextDocument( text, p ),
49 mHintValid( false ),
50 mSizeHint(),
51 mMinimumSizeHint()
52 {
53
54 }
6.30.1.3 KDTextDocument::∼KDTextDocument ()
56 {}
67 {
68 /*
69 QTextCursor cursor( this );
70 if( ! cursor.atEnd() )
71 cursor.movePosition( QTextCursor::NextBlock );
72 qDebug() << "KDTextDocument::minimumSizeHint() found:" << cursor.block().text();
73 QSizeF s( documentLayout()->blockBoundingRect( cursor.block() ).size() );
74 qDebug() << "KDTextDocument::minimumSizeHint() found rect" << documentLayout()->blockBoundingRect(
75 return QSize( static_cast<int>(s.width()),
76 static_cast<int>(s.height()) );
77 */
78
79 if( mHintValid )
80 return mMinimumSizeHint;
81
82 mHintValid = true;
83 mSizeHint = sizeForWidth( -1 );
84 QSize sz(-1, -1);
85
86 // PENDING(kalle) Cache
87 sz.rwidth() = sizeForWidth( 0 ).width();
88 sz.rheight() = sizeForWidth( 32000 ).height();
89 if( mSizeHint.height() < sz.height())
90 sz.rheight() = mSizeHint.height();
91
92 mMinimumSizeHint = sz;
93 return sz;
94 }
60 {
61 if( !mHintValid )
62 (void)minimumSizeHint();
63 return mSizeHint;
64 }
The documentation for this class was generated from the following files:
• KDTextDocument.h
• KDTextDocument.cpp
Note:
Legend is different from all other classes ofd KD Chart, since it can be displayed outside of the Chart’s
area. If you want to, you can embedd the legend into your own widget, or into another part of a bigger
grid, into which you might have inserted the Chart.
On the other hand, please note that you MUST call Chart::addLegend to get your legend positioned into
the correct place of your chart - if you want to have the legend shown inside of the chart (that’s probably
true for most cases).
Definition at line 61 of file KDChartLegend.h.
• void removeDiagrams ()
Removes all of the diagram from the legend’s list of diagrams.
Public Attributes
• Q_SIGNALS __pad0__: void destroyedLegend( Legend∗ )
• private Q_SLOTS: void emitPositionChanged()
75 :
76 AbstractAreaWidget( new Private(), parent )
77 {
78 d->referenceArea = parent;
79 init();
80 }
82 :
83 AbstractAreaWidget( new Private(), parent )
84 {
85 d->referenceArea = parent;
86 init();
87 setDiagram( diagram );
88 }
91 {
92 emit destroyedLegend( this );
93 }
Parameters:
newDiagram The diagram to add.
See also:
diagram, diagrams, removeDiagram, removeDiagrams, replaceDiagram, setDiagram
205 {
206 if ( newDiagram )
207 {
208 DiagramObserver* observer = new DiagramObserver( newDiagram, this );
209
210 DiagramObserver* oldObs = d->findObserverForDiagram( newDiagram );
211 if( oldObs ){
212 delete oldObs;
213 d->observers[ d->observers.indexOf( oldObs ) ] = observer;
214 }else{
215 d->observers.append( observer );
216 }
217 connect( observer, SIGNAL( diagramDestroyed(AbstractDiagram*) ),
218 SLOT( resetDiagram(AbstractDiagram*) ));
219 connect( observer, SIGNAL( diagramDataChanged(AbstractDiagram*) ),
303 {
304 return d->alignment;
305 }
76 {
77 Q_UNUSED( position );
78 // PENDING(kalle) FIXME
79 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosi
80 }
Implements KDChart::AbstractAreaBase.
Definition at line 116 of file KDChartAbstractAreaWidget.cpp.
Referenced by buildLegend(), paint(), and KDChart::AbstractAreaWidget::paintAll().
117 {
118 return geometry();
119 }
98 {
99 return d->backgroundAttributes;
100 }
378 {
379 if( d->brushes.find( dataset ) != d->brushes.end() )
380 return d->brushes[ dataset ];
381 else
382 return d->modelBrushes[ dataset ];
383 }
583 {
584 #ifdef debug_legend_paint
585 qDebug() << "entering Legend::buildLegend()";
586 #endif
587 if( d->cachedGeometry == areaGeometry() ) {
588 #ifdef debug_legend_paint
589 qDebug() << "leaving Legend::buildLegend() with NO action (was already build)";
590 #endif
591 // Note: We do *not* need to send positionChanged here,
592 // because we send it in the resizeEvent, so layouting
593 // is done at the right time.
594 return;
595 }
596 d->cachedGeometry = areaGeometry();
597
598 #ifdef debug_legend_paint
599 qDebug() << " Legend::buildLegend() areaGeometry: " << areaGeometry();
600 #endif
601
602 Q_FOREACH( QLayoutItem* layoutItem, d->layoutItems ) {
603 d->layout->removeItem( layoutItem );
604 }
605 qDeleteAll( d->layoutItems );
606 d->layoutItems.clear();
607
608 if( orientation() == Qt::Vertical ) {
609 d->layout->setColumnStretch( 4, 1 );
610 } else {
611 d->layout->setColumnStretch( 4, 0 );
612 }
613
614 d->modelLabels.clear();
615 d->modelBrushes.clear();
616 d->modelPens.clear();
617 d->modelMarkers.clear();
618 for (int i = 0; i < d->observers.size(); ++i){
619 const AbstractDiagram* diagram = d->observers.at(i)->diagram();
620 //qDebug() << "Legend::buildLegend() adding to d->modelLabels :" << diagram->datasetLabels();
621 d->modelLabels += diagram->datasetLabels();
622 d->modelBrushes += diagram->datasetBrushes();
623 d->modelPens += diagram->datasetPens();
624 d->modelMarkers += diagram->datasetMarkers();
625 }
626 Q_ASSERT( d->modelLabels.count() == d->modelBrushes.count() );
627
628 // legend caption
629 if( !titleText().isEmpty() && titleTextAttributes().isVisible() ) {
630 // PENDING(kalle) Other properties!
631 KDChart::TextLayoutItem* titleItem =
632 new KDChart::TextLayoutItem( titleText(),
633 titleTextAttributes(),
634 referenceArea(),
635 (orientation() == Qt::Vertical)
636 ? KDChartEnums::MeasureOrientationMinimum
637 : KDChartEnums::MeasureOrientationHorizontal,
638 Qt::AlignCenter );
639 titleItem->setParentWidget( this );
640
641 d->layoutItems << titleItem;
642 if( orientation() == Qt::Vertical )
643 d->layout->addItem( titleItem, 0, 0, 1, 5, Qt::AlignCenter );
644 else
645 d->layout->addItem( titleItem, 0, 0, 1, d->modelLabels.count()*4, Qt::AlignCenter );
646
647 // The line between the title and the legend items, if any.
648 if( showLines() ) {
649 KDChart::HorizontalLineLayoutItem* lineItem = new KDChart::HorizontalLineLayoutItem();
650 d->layoutItems << lineItem;
651 if( orientation() == Qt::Vertical )
652 d->layout->addItem( lineItem, 1, 0, 1, 5, Qt::AlignCenter );
653 else
654 d->layout->addItem( lineItem, 1, 0, 1, d->modelLabels.count()*4, Qt::AlignCenter );
655 }
656 }
657
658 for ( int dataset = 0; dataset < d->modelLabels.count(); dataset++ ) {
659 // Note: We may use diagram() for all of the MarkerLayoutItem instances,
660 // since all they need the diagram for is to invoke mDiagram->paintMarker()
661 KDChart::MarkerLayoutItem* markerItem = new KDChart::MarkerLayoutItem( diagram(),
662 markerAttributes( datas
663 brush( dataset ),
664 pen( dataset ),
665 Qt::AlignLeft );
666 d->layoutItems << markerItem;
667 if( orientation() == Qt::Vertical )
668 d->layout->addItem( markerItem,
669 dataset*2+2, // first row is title, second is line
670 1,
671 1, 1, Qt::AlignCenter );
672 else
673 d->layout->addItem( markerItem,
674 2, // all in row two
675 dataset*4 );
676
677 // PENDING(kalle) Other properties!
678 KDChart::TextLayoutItem* labelItem =
679 new KDChart::TextLayoutItem( text( dataset ),
680 textAttributes(),
681 referenceArea(),
682 (orientation() == Qt::Vertical)
683 ? KDChartEnums::MeasureOrientationMinimum
684 : KDChartEnums::MeasureOrientationHorizontal,
685 Qt::AlignLeft );
686 labelItem->setParentWidget( this );
687
688 d->layoutItems << labelItem;
689 if( orientation() == Qt::Vertical )
690 d->layout->addItem( labelItem,
691 dataset*2+2, // first row is title, second is line
692 3 );
693 else
694 d->layout->addItem( labelItem,
695 2, // all in row two
696 dataset*4+1 );
697
698 // horizontal lines (only in vertical mode, and not after the last item)
699 if( orientation() == Qt::Vertical && showLines() && dataset != ( d->modelLabels.count()-1 ) )
700 KDChart::HorizontalLineLayoutItem* lineItem = new KDChart::HorizontalLineLayoutItem();
701 d->layoutItems << lineItem;
702 d->layout->addItem( lineItem,
703 dataset*2+1+2,
704 0,
705 1, 5, Qt::AlignCenter );
706 }
707
708 // vertical lines (only in horizontal mode, and not after the last item)
709 if( orientation() == Qt::Horizontal && showLines() && dataset != ( d->modelLabels.count()-1 )
710 KDChart::VerticalLineLayoutItem* lineItem = new KDChart::VerticalLineLayoutItem();
711 d->layoutItems << lineItem;
712 d->layout->addItem( lineItem,
713 2, // all in row two
714 dataset*4+2,
715 1, 1, Qt::AlignCenter );
716 }
717
718 if( orientation() != Qt::Vertical ) { // Horizontal needs a spacer
719 d->layout->addItem( new QSpacerItem( spacing(), qMax( markerItem->sizeHint().height(),
720 labelItem->sizeHint().height() ) ),
721 2, // all in row two
722 dataset*4+3 );
723 }
724 }
725
726 // vertical line (only in vertical mode)
727 if( orientation() == Qt::Vertical && showLines() ) {
728 KDChart::VerticalLineLayoutItem* lineItem = new KDChart::VerticalLineLayoutItem();
729 d->layoutItems << lineItem;
730 d->layout->addItem( lineItem, 2, 2, d->modelLabels.count()*2, 1 );
731 }
732
733 // This line is absolutely necessary, otherwise: #2516.
734 d->layout->activate();
735
736 // emit propertiesChanged();
737 d->layout->activate();
738 emit propertiesChanged();
739 //emit positionChanged( this );
740 //emitPositionChanged();
741 #ifdef debug_legend_paint
742 qDebug() << "leaving Legend::buildLegend()";
743 #endif
744 }
126 {
127 Legend* legend = new Legend( new Private( *d ), 0 );
128 legend->setTextAttributes( textAttributes() );
129 legend->setTitleTextAttributes( titleTextAttributes() );
130 legend->setFrameAttributes( frameAttributes() );
131 legend->setPosition( position() );
132 legend->setAlignment( alignment() );
133 return legend;
134 }
163 {
164 int modelLabelsCount = 0;
165 int modelBrushesCount = 0;
166 for (int i = 0; i < d->observers.size(); ++i) {
167 DiagramObserver * obs = d->observers.at(i);
168 modelLabelsCount += obs->diagram()->datasetLabels().count();
169 modelBrushesCount += obs->diagram()->datasetBrushes().count();
170 }
171 Q_ASSERT( modelLabelsCount == modelBrushesCount );
172 return modelLabelsCount;
173 }
The first diagram of the legend or 0 if there was none added to the legend.
Returns:
The first diagram of the legend or 0.
See also:
diagrams, addDiagram, removeDiagram, removeDiagrams, replaceDiagram, setDiagram
190 {
191 if( d->observers.isEmpty() )
192 return 0;
193 return d->observers.first()->diagram();
194 }
Returns:
The list of all diagrams associated with the legend.
See also:
diagram, addDiagram, removeDiagram, removeDiagrams, replaceDiagram, setDiagram
197 {
198 DiagramList list;
199 for (int i = 0; i < d->observers.size(); ++i)
200 list << d->observers.at(i)->diagram();
201 return list;
202 }
470 {
471 #ifdef debug_legend_paint
472 qDebug() << "entering Legend::forceRebuild()";
473 #endif
474 //setSpacing(d->layout->spacing());
475 setNeedRebuild();
476 buildLegend();
477 #ifdef debug_legend_paint
478 qDebug() << "leaving Legend::forceRebuild()";
479 #endif
480 }
88 {
89 return d->frameAttributes;
90 }
176 {
177 Q_ASSERT_X ( d != 0, "AbstractAreaBase::innerRect()",
178 "Private class was not initialized!" );
179
180 const int padding
181 = d->frameAttributes.isVisible()
182 ? qMax( d->frameAttributes.padding(), 0 ) : 0;
183 return
184 QRect( QPoint(0,0), areaGeometry().size() )
185 .adjusted( padding, padding, -padding, -padding );
186 }
425 {
426 if( d->markerAttributes.find( dataset ) != d->markerAttributes.end() )
427 return d->markerAttributes[ dataset ];
428 else if ( static_cast<uint>( d->modelMarkers.count() ) > dataset )
429 return d->modelMarkers[ dataset ];
430 return MarkerAttributes();
431 }
316 {
317 return d->orientation;
318 }
Note:
When overriding this method, please let your widget draw itself at the top/left corner of the painter.
You should call rect() (or width(), height(), resp.) to find the drawable area’s size: While the paint()
method is being executed the frame of the widget is outside of its rect(), so you can use all of rect() for
your custom drawing!
See also:
paint, paintIntoRect
Implements KDChart::AbstractAreaWidget.
Definition at line 137 of file KDChartLegend.cpp.
References KDChart::AbstractAreaWidget::areaGeometry(), buildLegend(), d, diagram(), and
KDChart::AbstractLayoutItem::paint().
138 {
139 #ifdef debug_legend_paint
140 qDebug() << "entering Legend::paint( QPainter* painter )";
141 #endif
142 // rule: We do not show a legend, if there is no diagram.
143 if( ! diagram() ) return;
144 #ifdef debug_legend_paint
145 qDebug() << " Legend::paint() areaGeometry: " << areaGeometry();
146 #endif
147
148 // re-calculate/adjust the Legend’s internal layout and contents, if needed:
149 buildLegend();
150
151 // PENDING(kalle) Support palette
152
153 Q_FOREACH( KDChart::AbstractLayoutItem* layoutItem, d->layoutItems ) {
154 layoutItem->paint( painter );
155 }
156 #ifdef debug_legend_paint
157 qDebug() << "leaving Legend::paint( QPainter* painter )";
158 #endif
159 }
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked
automatically.
Definition at line 89 of file KDChartAbstractAreaWidget.cpp.
References KDChart::AbstractAreaWidget::areaGeometry(), KDChart::AbstractAreaBase::inner-
Rect(), KDChart::AbstractAreaWidget::paint(), KDChart::AbstractAreaBase::paintBackground(), and
KDChart::AbstractAreaBase::paintFrame().
Referenced by KDChart::AbstractAreaWidget::paintEvent(), and KDChart::AbstractAreaWidget::paint-
IntoRect().
90 {
91 //qDebug() << "AbstractAreaWidget::paintAll() called";
92 // Paint the background and frame
93 paintBackground( painter, rect() );
94 paintFrame( painter, rect().adjusted(0,0,-1,-1) );
95
96 // adjust the widget’s content margins,
97 // to be sure all content gets calculated
98 // to fit into the inner rectangle
99 const QRect oldGeometry( areaGeometry() );
100 const QRect inner( innerRect() );
101 //qDebug() << "areaGeometry():" << oldGeometry
102 // << " contentsRect():" << contentsRect() << " inner:" << inner;
103 if( contentsRect() != inner ){
104 //qDebug() << "old contentsRect():" << contentsRect() << " new innerRect:" << inner;
105 setContentsMargins(
106 inner.left(),
107 inner.top(),
108 oldGeometry.width() -inner.width()-1,
109 oldGeometry.height()-inner.height()-1 );
110 //forceRebuild();
111 }
112 paint( &painter );
113 //qDebug() << "AbstractAreaWidget::paintAll() done.";
114 }
104 {
105 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
106 "Private class was not initialized!" );
107
108 #define attributes d->backgroundAttributes
109
110 if( !attributes.isVisible() ) return;
111
112 /* first draw the brush (may contain a pixmap)*/
113 if( Qt::NoBrush != attributes.brush().style() ) {
114 KDChart::PainterSaver painterSaver( &painter );
115 painter.setPen( Qt::NoPen );
116 const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
117 painter.setBrushOrigin( newTopLeft );
118 painter.setBrush( attributes.brush() );
119 painter.drawRect( rect );
120 }
121 /* next draw the backPixmap over the brush */
122 if( !attributes.pixmap().isNull() &&
123 attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) {
124 QPointF ol = rect.topLeft();
125 if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() )
126 {
127 ol.setX( rect.center().x() - attributes.pixmap().width() / 2 );
128 ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 );
129 painter.drawPixmap( ol, attributes.pixmap() );
130 } else {
131 QMatrix m;
132 double zW = (double)rect.width() / (double)attributes.pixmap().width();
133 double zH = (double)rect.height() / (double)attributes.pixmap().height();
134 switch( attributes.pixmapMode() ) {
135 case BackgroundAttributes::BackgroundPixmapModeScaled:
136 {
137 double z;
138 z = qMin( zW, zH );
139 m.scale( z, z );
140 }
141 break;
142 case BackgroundAttributes::BackgroundPixmapModeStretched:
143 m.scale( zW, zH );
144 break;
145 default:
146 ; // Cannot happen, previously checked
147 }
148 QPixmap pm = attributes.pixmap().transformed( m );
149 ol.setX( rect.center().x() - pm.width() / 2 );
150 ol.setY( rect.center().y() - pm.height()/ 2 );
151 painter.drawPixmap( ol, pm );
152 }
153 }
154 #undef attributes
155 }
See also:
paint
66 {
67 Q_UNUSED( event );
68 QPainter painter( this );
69 paintAll( painter );
70 }
6.31.3.21 void AbstractAreaBase::paintFrame (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
159 {
160 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
161 "Private class was not initialized!" );
162
163 #define attributes d->frameAttributes
164
165 if( !attributes.isVisible() ) return;
166
167 const QPen oldPen( painter.pen() );
168 painter.setPen( attributes.pen() );
169 painter.drawRect( rect );
170 painter.setPen( oldPen );
171 #undef attributes
172 }
6.31.3.22 void AbstractAreaWidget::paintIntoRect (QPainter & painter, const QRect & rect)
[virtual, inherited]
73 {
74 const QRect oldGeometry( geometry() );
75 if( oldGeometry != rect )
76 setGeometry( rect );
77 painter.translate( rect.left(), rect.top() );
78 paintAll( painter );
79 painter.translate( -rect.left(), -rect.top() );
80 if( oldGeometry != rect )
81 setGeometry( oldGeometry );
82 }
409 {
410 if( d->pens.find( dataset ) != d->pens.end() )
411 return d->pens[dataset];
412 else
413 return d->modelPens[ dataset ];
414 }
292 {
293 return d->position;
294 }
122 {
123 emit positionChanged( this );
124 }
Returns the reference area, that is used for font size of title text, and for font size of the item texts, IF
automatic area detection is set.
See also:
setReferenceArea
184 {
185 return (d->referenceArea ? d->referenceArea : static_cast<const QWidget*>(parent()));
186 }
See also:
diagram, diagrams, addDiagram, removeDiagrams, replaceDiagram, setDiagram
228 {
229 if( oldDiagram ){
230 DiagramObserver* oldObs = d->findObserverForDiagram( oldDiagram );
231 if( oldObs ){
232 delete oldObs;
233 d->observers.removeAt( d->observers.indexOf( oldObs ) );
234 }
235 setNeedRebuild();
236 }
237 }
See also:
diagram, diagrams, addDiagram, removeDiagram, replaceDiagram, setDiagram
240 {
241 for (int i = 0; i < d->observers.size(); ++i)
242 removeDiagram( d->observers.at(i)->diagram() );
243 }
Replaces the old diagram, or appends the new diagram, it there is none yet.
Parameters:
newDiagram The diagram to be used instead of the old one. If this parameter is zero, the first diagram
will just be removed.
oldDiagram The diagram to be removed by the new one. This diagram will be deleted automatically.
If the parameter is omitted, the very first diagram will be replaced. In case, there was no diagram
yet, the new diagram will just be added.
See also:
diagram, diagrams, addDiagram, removeDiagram, removeDiagrams, setDiagram
247 {
248 KDChart::AbstractDiagram* old = oldDiagram;
249 if( ! d->observers.isEmpty() && ! old )
250 old = d->observers.first()->diagram();
251 if( old )
252 removeDiagram( old );
253 if( newDiagram )
254 addDiagram( newDiagram );
255 }
263 {
264 removeDiagram( oldDiagram );
265 }
Removes all legend texts that might have been set by setText.
This resets the Legend to default behaviour: Texts are created automatically.
Definition at line 338 of file KDChartLegend.cpp.
References d, and setNeedRebuild().
339 {
340 if( ! d->texts.count() ) return;
341 d->texts.clear();
342 setNeedRebuild();
343 }
574 {
575 #ifdef debug_legend_paint
576 qDebug() << "Legend::resizeEvent() called";
577 #endif
578 forceRebuild();
579 QTimer::singleShot(0, this, SLOT(emitPositionChanged()));
580 }
297 {
298 d->alignment = alignment;
299 emitPositionChanged();
300 }
93 {
94 d->backgroundAttributes = a;
95 }
371 {
372 if( d->brushes[ dataset ] == brush ) return;
373 d->brushes[ dataset ] = brush;
374 setNeedRebuild();
375 }
387 {
388 bool bChangesDone = false;
389 QList<QBrush> datasetBrushes = diagram->datasetBrushes();
390 for( int i = 0; i < datasetBrushes.count(); i++ ){
391 if( d->brushes[ i ] != datasetBrushes[ i ] ){
392 d->brushes[ i ] = datasetBrushes[ i ];
393 bChangesDone = true;
394 }
395 }
396 if( bChangesDone )
397 setNeedRebuild();
398 }
364 {
365 if( d->brushes[ dataset ] == color ) return;
366 d->brushes[ dataset ] = color;
367 setNeedRebuild();
368 }
496 {
497 setColor( 0, Qt::red );
498 setColor( 1, Qt::green );
499 setColor( 2, Qt::blue );
500 setColor( 3, Qt::cyan );
501 setColor( 4, Qt::magenta );
See also:
diagram, diagrams, addDiagram, removeDiagram, removeDiagrams, replaceDiagram
258 {
259 replaceDiagram( newDiagram );
260 }
83 {
84 d->frameAttributes = a;
85 }
418 {
419 if( d->markerAttributes[dataset] == markerAttributes ) return;
420 d->markerAttributes[ dataset ] = markerAttributes;
421 setNeedRebuild();
422 }
274 {
275 d->cachedGeometry = QRectF();
276 }
308 {
309 if( d->orientation == orientation ) return;
310 d->orientation = orientation;
311 setNeedRebuild();
312 emitPositionChanged();
313 }
402 {
403 if( d->pens[dataset] == pen ) return;
404 d->pens[dataset] = pen;
405 setNeedRebuild();
406 }
279 {
280 d->position = position;
281 emitPositionChanged();
282 }
512 {
513 setColor( 0, QColor(255, 0,196) );
514 setColor( 1, QColor(255, 0, 96) );
515 setColor( 2, QColor(255, 128,64) );
516 setColor( 3, Qt::yellow );
517 setColor( 4, Qt::green );
518 setColor( 5, Qt::cyan );
519 setColor( 6, QColor( 96, 96,255) );
520 setColor( 7, QColor(160, 0,255) );
521 for( int i = 8; i < 16; ++i )
522 setColor( i, brush( i - 8 ).color().light() );
523 }
Specifies the reference area for font size of title text, and for font size of the item texts, IF automatic area
detection is set.
Note:
This parameter is ignored, if the Measure given for setTitleTextAttributes (or setTextAttributes, resp.)
is not specifying automatic area detection.
If no reference area is specified, but automatic area detection is set, then the size of the legend’s parent
widget will be used.
See also:
KDChart::Measure, KDChartEnums::MeasureCalculationMode
177 {
178 if( area == d->referenceArea ) return;
179 d->referenceArea = area;
180 setNeedRebuild();
181 }
321 {
322 if( d->showLines == legendShowLines ) return;
323 d->showLines = legendShowLines;
324 setNeedRebuild();
325 emitPositionChanged();
326 }
483 {
484 if( d->spacing == space && d->layout->spacing() == static_cast<int>(space) ) return;
485 d->spacing = space;
486 d->layout->setSpacing( space );
487 setNeedRebuild();
488 }
526 {
527 static const int NUM_SUBDUEDCOLORS = 18;
528 static const QColor SUBDUEDCOLORS[ NUM_SUBDUEDCOLORS ] = {
529 QColor( 0xe0,0x7f,0x70 ),
530 QColor( 0xe2,0xa5,0x6f ),
531 QColor( 0xe0,0xc9,0x70 ),
532 QColor( 0xd1,0xe0,0x70 ),
533 QColor( 0xac,0xe0,0x70 ),
534 QColor( 0x86,0xe0,0x70 ),
535 QColor( 0x70,0xe0,0x7f ),
536 QColor( 0x70,0xe0,0xa4 ),
537 QColor( 0x70,0xe0,0xc9 ),
538 QColor( 0x70,0xd1,0xe0 ),
539 QColor( 0x70,0xac,0xe0 ),
540 QColor( 0x70,0x86,0xe0 ),
541 QColor( 0x7f,0x70,0xe0 ),
542 QColor( 0xa4,0x70,0xe0 ),
543 QColor( 0xc9,0x70,0xe0 ),
544 QColor( 0xe0,0x70,0xd1 ),
545 QColor( 0xe0,0x70,0xac ),
546 QColor( 0xe0,0x70,0x86 ),
547 };
548 if( ordered )
549 for(int i=0; i<NUM_SUBDUEDCOLORS; ++i)
550 setColor( i, SUBDUEDCOLORS[i] );
551 else{
552 setColor( 0, SUBDUEDCOLORS[ 0] );
553 setColor( 1, SUBDUEDCOLORS[ 5] );
554 setColor( 2, SUBDUEDCOLORS[10] );
555 setColor( 3, SUBDUEDCOLORS[15] );
556 setColor( 4, SUBDUEDCOLORS[ 2] );
557 setColor( 5, SUBDUEDCOLORS[ 7] );
558 setColor( 6, SUBDUEDCOLORS[12] );
559 setColor( 7, SUBDUEDCOLORS[17] );
560 setColor( 8, SUBDUEDCOLORS[ 4] );
561 setColor( 9, SUBDUEDCOLORS[ 9] );
562 setColor(10, SUBDUEDCOLORS[14] );
563 setColor(11, SUBDUEDCOLORS[ 1] );
564 setColor(12, SUBDUEDCOLORS[ 6] );
565 setColor(13, SUBDUEDCOLORS[11] );
566 setColor(14, SUBDUEDCOLORS[16] );
567 setColor(15, SUBDUEDCOLORS[ 3] );
568 setColor(16, SUBDUEDCOLORS[ 8] );
569 setColor(17, SUBDUEDCOLORS[13] );
570 }
571 }
346 {
347 if( d->texts[ dataset ] == text ) return;
348 d->texts[ dataset ] = text;
349 setNeedRebuild();
350 }
434 {
435 if( d->textAttributes == a ) return;
436 d->textAttributes = a;
437 setNeedRebuild();
438 }
446 {
447 if( d->titleText == text ) return;
448 d->titleText = text;
449 setNeedRebuild();
450 }
458 {
459 if( d->titleTextAttributes == a ) return;
460 d->titleTextAttributes = a;
461 setNeedRebuild();
462 }
268 {
269 QWidget::setVisible( visible );
270 emit propertiesChanged();
271 }
329 {
330 return d->showLines;
331 }
491 {
492 return d->spacing;
493 }
353 {
354 if( d->texts.find( dataset ) != d->texts.end() ){
355 //qDebug() << "Legend::text(" << dataset << ") returning d->texts[" << dataset << "] :" << d->
356 return d->texts[ dataset ];
357 }else{
358 //qDebug() << "Legend::text(" << dataset << ") returning d->modelLabels[" << dataset << "] :"
359 return d->modelLabels[ dataset ];
360 }
361 }
441 {
442 return d->textAttributes;
443 }
453 {
454 return d->titleText;
455 }
465 {
466 return d->titleTextAttributes;
467 }
• KDChartLegend.h
• KDChartLegend.cpp
Public Types
• enum MissingValuesPolicy {
MissingValuesAreBridged,
MissingValuesHideSegments,
MissingValuesShownAsZero,
MissingValuesPolicyIgnored }
MissingValuesPolicy specifies how a missing value will be shown in a line diagram.
• MissingValuesAreBridged the default: No markers will be shown for missing values but the
line will be bridged if there is at least one valid cell before and after the missing value(s), otherwise
the segment will be hidden.
• MissingValuesHideSegments Line segments starting with a missing value will not be shown,
and no markers will be shown for missing values, so this will look like a piece of the line is missing.
• MissingValuesShownAsZero Missing value(s) will be treated like normal zero values, and
markers will shown for them too, so there will be no visible difference between a zero value and a
missing value.
Enumeration values:
MissingValuesAreBridged
MissingValuesHideSegments
MissingValuesShownAsZero
MissingValuesPolicyIgnored
55 {
56 MissingValuesAreBridged,
57 MissingValuesHideSegments,
58 MissingValuesShownAsZero,
59 MissingValuesPolicyIgnored };
6.32.2.1 KDChart::LineAttributes::LineAttributes ()
6.32.2.3 KDChart::LineAttributes::∼LineAttributes ()
Referenced by KDChart::LineDiagram::getCellValues().
79 { return !operator==(other); }
The documentation for this class was generated from the following file:
• KDChartLineAttributes.h
Public Types
• enum LineType {
Normal = 0,
Stacked = 1,
Percent = 2 }
The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to
have.
• void useRainbowColors ()
Set the palette to be used, for painting datasets to the rainbow palette.
• void useSubduedColors ()
Set the palette to be used, for painting datasets to the subdued palette.
• virtual ∼LineDiagram ()
• void paintDataValueText (QPainter ∗painter, const QModelIndex &index, const QPointF &pos, dou-
ble value)
• virtual void paintDataValueTexts (QPainter ∗painter)
• void paintEvent (QPaintEvent ∗)
• void paintMarker (QPainter ∗painter, const QModelIndex &index, const QPointF &pos)
• virtual void paintMarkers (QPainter ∗painter)
• void propertiesChanged ()
Emitted upon change of a property of the Diagram.
Protected Attributes
Enumeration values:
Normal
Stacked
Percent
57 {
58 Normal = 0,
59 Stacked = 1,
60 Percent = 2
61 };
59 :
60 AbstractCartesianDiagram( new Private(), parent, plane )
61 {
62 init();
63 }
70 {
71 }
See also:
takeAxis
67 {
68 if ( !d->axesList.contains( axis ) ) {
69 d->axesList.append( axis );
70 axis->createObserver( this );
71 layoutPlanes();
72 }
73 }
Returns:
Whether data value labels are allowed to overlap.
295 {
Returns:
Whether anti-aliasing is to be used for rendering this diagram.
306 {
Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel
181 {
182 return d->attributesModel;
183 }
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram.
Definition at line 204 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by calculateDataBoundaries(), KDChart::BarDiagram::calculateDataBoundaries(),
numberOfAbscissaSegments(), KDChart::BarDiagram::numberOfAbscissaSegments(), numberOf-
OrdinateSegments(), KDChart::BarDiagram::numberOfOrdinateSegments(), paint(), KDChart::Bar-
Diagram::paint(), and KDChart::AbstractDiagram::valueForCell().
210 {
86 {
87 return d->axesList;
88 }
Retrieve the brush to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The brush to use for painting.
638 :
QRect AbstractDiagram::visualRect(const QModelIndex &) const
Parameters:
dataset The dataset to retrieve the brush for.
Returns:
The brush to use for painting.
631 {
Returns:
The brush to use for painting.
623 {
[reimplemented]
Implements KDChart::AbstractDiagram.
Definition at line 229 of file KDChartLineDiagram.cpp.
References KDChart::AbstractDiagram::attributesModelRootIndex(), KDChart::AbstractDiagram::check-
Invariants(), d, KDChart::AbstractDiagram::datasetDimension(), type(), and valueForCellTesting().
230 {
231 if ( !checkInvariants( true ) ) return QPair<QPointF, QPointF>( QPointF( 0, 0 ), QPointF( 0, 0 ) )
232
233 const int rowCount = d->attributesModel->rowCount(attributesModelRootIndex());
234 const int colCount = d->attributesModel->columnCount(attributesModelRootIndex());
235 double xMin = 0;
236 double xMax = rowCount -1;
237 double yMin = 0, yMax = 0;
238 bool bStarting = true;
239 bool bOK;
240
241 // calculate boundaries for different line types Normal - Stacked - Percent - Default Normal
242 switch ( type() ){
746 {
747 Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
748 "There is no usable model set, for the diagram." );
749
750 Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
751 "There is no usable coordinate plane set, for the diagram." );
752 }
753 return model() && coordinatePlane();
754 }
755
756 int AbstractDiagram::datasetDimension( ) const
74 {
75 return new LineDiagram( new Private( *d ) );
76 }
217 {
126 {
127 return d->plane;
128 }
Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these
values).
This method returns a chached result of calculations done by calculateDataBoundaries. Classes derived
from AbstractDiagram must implement the calculateDataBoundaries function, to specify their own way of
calculating the data boundaries. If derived classes want to force recalculation of the data boundaries, they
can call setDataBoundariesDirty()
Returned value is in diagram coordinates.
Definition at line 130 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::calculateDataBoundaries(), and d.
Referenced by KDChart::CartesianCoordinatePlane::calculateRawDataBoundingRect(), KDChart::Polar-
CoordinatePlane::layoutDiagrams(), paint(), and KDChart::BarDiagram::paint().
131 {
132 if( d->databoundariesDirty ){
133 d->databoundaries = calculateDataBoundaries ();
134 d->databoundariesDirty = false;
135 }
136 return d->databoundaries;
137 }
[reimplemented]
Definition at line 232 of file KDChartAbstractDiagram.cpp.
References d.
232 {
233 // We are still too dumb to do intelligent updates...
234 d->databoundariesDirty = true;
235 scheduleDelayedItemsLayout();
236 }
237
238 void AbstractDiagram::setDataValueAttributes( const QModelIndex & index,
The set of dataset brushes currently used, for use in legends, etc.
Note:
Cell-level override brushes, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the brush, that is used for a single cell.
Returns:
The current set of dataset brushes.
712 {
713 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( i, Qt::Vertical, DatasetB
714 ret << brush;
715 }
716
717 return ret;
718 }
719
720 QList<QPen> AbstractDiagram::datasetPens() const
The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to
have.
For each dimension it will expect one column of values in the model. If the dimensionality is 1, automatic
values will be used for the abscissa.
For example a diagram with the default dimension of 1, will have one column per datapoint (the y values)
and will use automatic values for the x axis (1, 2, 3, ... n). If the dimension is 2, the diagram will use the
first, (and the third, fifth, etc) columns as X values, and the second, (and the fourth, sixth, etc) column as Y
values.
Returns:
The dataset dimension of the diagram.
762 {
The set of dataset labels currently displayed, for use in legends, etc.
Returns:
The set of dataset labels currently displayed.
704 }
705 return ret;
706 }
707
708 QList<QBrush> AbstractDiagram::datasetBrushes() const
The set of dataset markers currently used, for use in legends, etc.
Note:
Cell-level override markers, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the marker, that is shown for a single cell.
Returns:
The current set of dataset brushes.
735 {
736 DataValueAttributes a =
737 qVariantValue<DataValueAttributes>( attributesModel()->headerData( i, Qt::Vertical, DataVa
738 const MarkerAttributes &ma = a.markerAttributes();
739 ret << ma;
740 }
741 return ret;
742 }
743
744 bool AbstractDiagram::checkInvariants( bool justReturnTheStatus ) const
The set of dataset pens currently used, for use in legends, etc.
Note:
Cell-level override pens, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the pens, that is used for a single cell.
Returns:
The current set of dataset pens.
724 {
725 QPen pen = qVariantValue<QPen>( attributesModel()->headerData( i, Qt::Vertical, DatasetPenRole
726 ret << pen;
727 }
728 return ret;
729 }
730
731 QList<MarkerAttributes> AbstractDiagram::datasetMarkers() const
Parameters:
index The datapoint to retrieve the attributes for.
Returns:
The DataValueAttributes for the given index.
278 {
Parameters:
dataset The dataset to retrieve the attributes for.
Returns:
The DataValueAttributes for the given dataset.
271 {
Returns:
The global DataValueAttributes.
264 {
[reimplemented]
Definition at line 223 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::update().
223 {
224 d->plane->layoutDiagrams();
225 update();
226 }
227 QAbstractItemView::doItemsLayout();
228 }
229
230 void AbstractDiagram::dataChanged( const QModelIndex &topLeft,
395 {
396 LineAttributes::MissingValuesPolicy policy;
397
398 bool bOK = true;
399 valueX = ( datasetDimension() > 1 && column > 0 )
400 ? valueForCellTesting(row, column-1, bOK)
401 : row;
402 if( bOK )
403 valueY = valueForCellTesting(row, column, bOK);
404 if( bOK ){
405 policy = LineAttributes::MissingValuesPolicyIgnored;
406 }else{
407 // missing value: find out the policy
408 QModelIndex index = model()->index( row, column, rootIndex() );
409 LineAttributes la = lineAttributes( index );
410 policy = la.missingValuesPolicy();
411 }
412 return policy;
413 }
[reimplemented]
Definition at line 655 of file KDChartAbstractDiagram.cpp.
657 { return 0; }
[reimplemented]
Definition at line 649 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 661 of file KDChartAbstractDiagram.cpp.
663 {}
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Returns:
The set of item row labels currently displayed.
91 {
92 //qDebug() << "KDChart::AbstractCartesianDiagram::layoutPlanes()";
93 AbstractCoordinatePlane* plane = coordinatePlane();
94 if( plane ){
95 plane->layoutPlanes();
96 //qDebug() << "KDChart::AbstractCartesianDiagram::layoutPlanes() OK";
97 }
98 }
146 {
147 return qVariantValue<LineAttributes>(
148 d->attributesModel->data(
149 d->attributesModel->mapFromSource(index),
150 KDChart::LineAttributesRole ) );
151 }
137 {
138 return qVariantValue<LineAttributes>(
139 d->attributesModel->data(
140 d->attributesModel->mapFromSource( columnToIndex( column ) ),
141 KDChart::LineAttributesRole ) );
142 }
131 {
132 return qVariantValue<LineAttributes>(
133 d->attributesModel->data( KDChart::LineAttributesRole ) );
134 }
This signal is emitted, when either the model or the AttributesModel is replaced.
Referenced by KDChart::AbstractDiagram::setAttributesModel(), and KDChart::AbstractDiagram::set-
Model().
[reimplemented]
Definition at line 652 of file KDChartAbstractDiagram.cpp.
654 { return 0; }
Implements KDChart::AbstractCartesianDiagram.
Definition at line 711 of file KDChartLineDiagram.cpp.
References KDChart::AbstractDiagram::attributesModelRootIndex(), and d.
712 {
713 return d->attributesModel->rowCount(attributesModelRootIndex());
714 }
Implements KDChart::AbstractCartesianDiagram.
Definition at line 716 of file KDChartLineDiagram.cpp.
References KDChart::AbstractDiagram::attributesModelRootIndex(), and d.
717 {
718 return d->attributesModel->columnCount(attributesModelRootIndex());
719 }
Draw the diagram contents to the rectangle and painter, that are passed in as part of the paint context.
Parameters:
paintContext All information needed for painting.
Implements KDChart::AbstractDiagram.
Definition at line 420 of file KDChartLineDiagram.cpp.
References KDChart::AbstractDiagram::antiAliasing(), KDChart::AbstractDiagram::attributes-
ModelRootIndex(), KDChart::AbstractDiagram::checkInvariants(), KDChart::Abstract-
Diagram::coordinatePlane(), d, KDChart::AbstractDiagram::dataBoundaries(), KDChart::Abstract-
Diagram::datasetDimension(), KDChart::LineAttributes::displayArea(), getCellValues(), line-
Attributes(), KDChart::AbstractDiagram::paintDataValueText(), KDChart::PaintContext::painter(),
KDChart::AbstractDiagram::paintMarker(), KDChart::AbstractCoordinatePlane::translate(),
KDChart::LineAttributes::transparency(), type(), and KDChart::AbstractDiagram::valueForCell().
Referenced by paintEvent().
421 {
422 //qDebug() << " start diag::paint()";
423 if ( !checkInvariants( true ) ) return;
424 if ( !AbstractGrid::isBoundariesValid(dataBoundaries()) ) return;
425
426 //QTime t = QTime::currentTime();
427
428 //calculates and stores the values
429 const int rowCount = d->attributesModel->rowCount(attributesModelRootIndex());
430 const int colCount = d->attributesModel->columnCount(attributesModelRootIndex());
431 DataValueTextInfoList list;
432 LineAttributesInfoList lineList;
320 {
321 // paint one data series
322 DataValueAttributes a = dataValueAttributes(index);
323 if ( !a.isVisible() ) return;
324
325 // handle decimal digits
326 int decimalDigits = a.decimalDigits();
327 int decimalPos = QString::number( value ).indexOf( QLatin1Char( ’.’ ) );
328 QString roundedValue;
329 if ( a.dataLabel().isNull() ) {
330 if ( decimalPos > 0 && value != 0 )
331 roundedValue = roundValues ( value, decimalPos, decimalDigits );
332 else
333 roundedValue = QString::number( value );
334 } else
335 roundedValue = a.dataLabel();
336 // handle prefix and suffix
337 if ( !a.prefix().isNull() )
338 roundedValue.prepend( a.prefix() );
339
340 if ( !a.suffix().isNull() )
341 roundedValue.append( a.suffix() );
342
343 PainterSaver painterSaver( painter );
344 // FIXME draw the non-text bits, background, etc
345 const TextAttributes &ta = a.textAttributes();
346 if ( ta.isVisible() ) {
347 painter->setPen( ta.pen() );
348 painter->setFont( ta.font() );
349 painter->translate( pos );
350 painter->rotate( ta.rotation() );
351 painter->drawText( QPointF(0, 0), roundedValue );
352 }
353 }
354
355 QString AbstractDiagram::roundValues( double value,
385 {
386 for ( int j=0; j< rowCount; ++j ) {
387 const QModelIndex index = model()->index( j, i, rootIndex() );
388 double value = model()->data( index ).toDouble();
389 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
390 paintDataValueText( painter, index, pos, value );
391 }
392 }
393 }
394
395
368 {
369 //qDebug() << "starting LineDiagram::paintEvent ( QPaintEvent*)";
370 QPainter painter ( viewport() );
371 PaintContext ctx;
372 ctx.setPainter ( &painter );
373 ctx.setRectangle ( QRectF ( 0, 0, width(), height() ) );
374 paint ( &ctx );
375 //qDebug() << " LineDiagram::paintEvent ( QPaintEvent*) ended.";
376 }
399 {
400
401 if ( !checkInvariants() ) return;
402 DataValueAttributes a = dataValueAttributes(index);
403 if ( !a.isVisible() ) return;
404 const MarkerAttributes &ma = a.markerAttributes();
405 if ( !ma.isVisible() ) return;
406
407 PainterSaver painterSaver( painter );
408 QSizeF maSize( ma.markerSize() );
409 QBrush indexBrush( brush( index ) );
410 QPen indexPen( ma.pen() );
411 if ( ma.markerColor().isValid() )
412 indexBrush.setColor( ma.markerColor() );
413
414 paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
415 }
416
417
References KDChart::MarkerAttributes::markerStyle().
Referenced by paint(), KDChart::MarkerLayoutItem::paint(), and KDChart::AbstractDiagram::paint-
Marker().
424 {
425 PainterSaver painterSaver( painter );
426 painter->setBrush( brush );
427 painter->setPen( pen );
428 painter->setRenderHint ( QPainter::Antialiasing );
429 painter->translate( pos );
430 switch ( markerAttributes.markerStyle() ) {
431 case MarkerAttributes::MarkerCircle:
432 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
433 maSize.height(), maSize.width()) );
434 break;
435 case MarkerAttributes::MarkerSquare:
436 {
437 QRectF rect( 0 - maSize.height()/2, 0 - maSize.width()/2,
438 maSize.height(), maSize.width() );
439 painter->drawRect( rect );
440 painter->fillRect( rect, painter->brush() );
441 break;
442 }
443 case MarkerAttributes::MarkerDiamond:
444 {
445 QVector <QPointF > diamondPoints;
446 QPointF top, left, bottom, right;
447 top = QPointF( 0, 0 - maSize.height()/2 );
448 left = QPointF( 0 - maSize.width()/2, 0 );
449 bottom = QPointF( 0, maSize.height()/2 );
450 right = QPointF( maSize.width()/2, 0 );
451 diamondPoints << top << left << bottom << right;
452 painter->drawPolygon( diamondPoints );
453 break;
454 }
455 //Pending Michel: do we need that? Ask: What is the idea about
456 // Marker1Pixel and Marker4Pixels.
457 case MarkerAttributes::Marker1Pixel:
458 {
459 QSizeF pSize(4,4);
460 QPen pen1Pixel;
461 pen1Pixel.setColor( painter->background().color() );
462 QRectF centerRect( -pSize.height()/2, -pSize.width()/2,
463 pSize.height(), pSize.width() );
464 painter->setPen( pen1Pixel );
465 painter->drawEllipse( centerRect );
466 break;
467 }
468 case MarkerAttributes::Marker4Pixels:
469 {
470 QSizeF pSize(8, 8);
471 QPen pen4Pixel;
472 pen4Pixel.setColor( painter->background().color() );
473 QRectF centerRect( -pSize.height()/2, -pSize.width()/2,
474 pSize.height(), pSize.width() );
475 painter->setPen( pen4Pixel );
476 painter->drawEllipse( centerRect );
477 break;
478 }
479 case MarkerAttributes::MarkerRing:
480 {
481 painter->setBrush( Qt::NoBrush );
482 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
483 maSize.height(), maSize.width()) );
484 break;
485 }
535 {
536 for ( int j=0; j< rowCount; ++j ) {
537 const QModelIndex index = model()->index( j, i, rootIndex() );
538 double value = model()->data( index ).toDouble();
539 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
540 paintMarker( painter, index, pos );
541 }
542 }
543 }
544
545
Retrieve the pen to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The pen to use for painting.
593 {
Parameters:
dataset The dataset to retrieve the pen for.
Returns:
The pen to use for painting.
585 {
Returns:
The pen to use for painting.
577 {
320 {
124 {
125 return d->referenceDiagram;
126 }
129 {
130 return d->referenceDiagramOffset;
131 }
Parameters:
area
Implements KDChart::AbstractDiagram.
Definition at line 707 of file KDChartLineDiagram.cpp.
708 {
709 }
226 {
227 }
[reimplemented]
Definition at line 646 of file KDChartAbstractDiagram.cpp.
Parameters:
allow True means that overlapping labels are allowed.
290 {
Parameters:
enabled True means that AA is enabled.
301 {
Wrong:
diagram1->setAttributesModel( diagram2->attributesModel() );
Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel
161 {
162 if( amodel->sourceModel() != model() ) {
163 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
164 "Trying to set an attributesmodel which works on a different "
165 "model than the diagram.");
166 return;
167 }
168 if( qobject_cast<PrivateAttributesModel*>(amodel) ) {
169 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
170 "Trying to set an attributesmodel that is private to another diagram.");
171 return;
172 }
173 d->setAttributesModel(amodel);
174 scheduleDelayedItemsLayout();
175 d->databoundariesDirty = true;
176 emit modelsChanged();
177 }
Set the brush to be used, for painting all datasets in the model.
Parameters:
brush The brush to use.
608 {
6.33.3.61 void AbstractDiagram::setBrush (int dataset, const QBrush & brush) [inherited]
Parameters:
dataset The dataset’s column in the model.
617 {
6.33.3.62 void AbstractDiagram::setBrush (const QModelIndex & index, const QBrush & brush)
[inherited]
Set the brush to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
brush The brush to use.
601 {
Returns:
The coordinate plane associated with the diagram.
101 {
102 if( coordinatePlane() ) disconnect( coordinatePlane() );
103 AbstractDiagram::setCoordinatePlane(plane);
104
105 // show the axes, after all have been adjusted
106 // (because they might be dependend on each other)
107 /*
108 if( plane )
109 Q_FOREACH( CartesianAxis* axis, d->axesList )
110 axis->show();
111 else
112 Q_FOREACH( CartesianAxis* axis, d->axesList )
113 axis->hide();
114 */
115 }
140 {
141 d->databoundariesDirty = true;
142 }
See also:
datasetDimension.
Parameters:
dimension
770 {
Parameters:
a The attributes to set.
284 {
Parameters:
dataset The dataset to set the attributes for.
259 {
Parameters:
index The datapoint to set the attributes for.
a The attributes to set.
240 {
241 d->attributesModel->setData(
242 d->attributesModel->mapFromSource( index ),
243 qVariantFromValue( a ),
244 DataValueLabelAttributesRole );
245 emit propertiesChanged();
246 }
247
248
122 {
123 d->attributesModel->setData(
124 d->attributesModel->mapFromSource(index),
125 qVariantFromValue( ta ),
126 LineAttributesRole );
127 emit propertiesChanged();
128 }
110 {
111 d->attributesModel->setHeaderData(
112 column,
113 Qt::Vertical,
114 qVariantFromValue( ta ),
115 LineAttributesRole );
116 emit propertiesChanged();
117 }
100 {
101 d->attributesModel->setModelData(
102 qVariantFromValue( ta ),
103 LineAttributesRole );
104 emit propertiesChanged();
105 }
145 {
146 QAbstractItemView::setModel( newModel );
147 AttributesModel* amodel = new PrivateAttributesModel( newModel, this );
148 amodel->initFrom( d->attributesModel );
149 d->setAttributesModel(amodel);
150 scheduleDelayedItemsLayout();
151 d->databoundariesDirty = true;
152 emit modelsChanged();
153 }
Set the pen to be used, for painting all datasets in the model.
Parameters:
pen The pen to use.
562 {
6.33.3.74 void AbstractDiagram::setPen (int dataset, const QPen & pen) [inherited]
Parameters:
dataset The dataset’s row in the model.
pen The pen to use.
571 {
6.33.3.75 void AbstractDiagram::setPen (const QModelIndex & index, const QPen & pen)
[inherited]
Set the pen to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
pen The pen to use.
555 {
312 {
118 {
119 d->referenceDiagram = diagram;
120 d->referenceDiagramOffset = offset;
121 }
Set the root index in the model, where the diagram starts referencing data for display.
[reimplemented]
Definition at line 188 of file KDChartAbstractDiagram.cpp.
References d.
[reimplemented]
Definition at line 664 of file KDChartAbstractDiagram.cpp.
179 {
180 setDataBoundariesDirty();
181 d->attributesModel->setData(
182 d->attributesModel->mapFromSource(index),
183 qVariantFromValue( ta ),
184 ThreeDLineAttributesRole );
185 emit propertiesChanged();
186 }
166 {
167 setDataBoundariesDirty();
168 d->attributesModel->setHeaderData(
169 column,
170 Qt::Vertical,
171 qVariantFromValue( ta ),
172 ThreeDLineAttributesRole );
173 emit propertiesChanged();
174 }
155 {
156 setDataBoundariesDirty();
157 d->attributesModel->setModelData(
158 qVariantFromValue( ta ),
159 ThreeDLineAttributesRole );
160 emit propertiesChanged();
161 }
79 {
80 if ( d->lineType == type ) return;
81 if ( type != LineDiagram::Normal && datasetDimension() > 1 ) {
82 Q_ASSERT_X ( false, "setType()",
83 "This line chart type can’t be used with multi-dimensional data." );
84 return;
85 }
86 d->lineType = type;
87 // AbstractAxis settings - see AbstractDiagram and CartesianAxis
88 setPercentMode( type == LineDiagram::Percent );
89 setDataBoundariesDirty();
90 emit layoutChanged( this );
91 emit propertiesChanged();
92 }
See also:
addAxis
76 {
77 const int idx = d->axesList.indexOf( axis );
78 if( idx != -1 )
79 d->axesList.takeAt( idx );
80 axis->deleteObserver( this );
81 axis->setParentWidget( 0 );
82 layoutPlanes();
83 }
Implements KDChart::AbstractCartesianDiagram.
Definition at line 216 of file KDChartLineDiagram.cpp.
References d.
217 {
218 return qVariantValue<ThreeDLineAttributes>(
219 d->attributesModel->headerData (
220 column,
221 Qt::Vertical,
222 KDChart::ThreeDLineAttributesRole ) ).validDepth();
223 }
Implements KDChart::AbstractCartesianDiagram.
Definition at line 211 of file KDChartLineDiagram.cpp.
References threeDLineAttributes(), and KDChart::AbstractThreeDAttributes::validDepth().
212 {
213 return threeDLineAttributes( index ).validDepth();
214 }
204 {
205 return qVariantValue<ThreeDLineAttributes>(
206 d->attributesModel->data(
207 d->attributesModel->mapFromSource( index ),
208 KDChart::ThreeDLineAttributesRole ) );
209 }
195 {
196 return qVariantValue<ThreeDLineAttributes>(
197 d->attributesModel->data(
198 d->attributesModel->mapFromSource( columnToIndex( column ) ),
199 KDChart::ThreeDLineAttributesRole ) );
200 }
189 {
190 return qVariantValue<ThreeDLineAttributes>(
191 d->attributesModel->data( KDChart::ThreeDLineAttributesRole ) );
192 }
95 {
96 return d->lineType;
97 }
Set the palette to be used, for painting datasets to the default palette.
See also:
KDChart::Palette. FIXME: fold into one usePalette (KDChart::Palette&) method
675 {
Set the palette to be used, for painting datasets to the rainbow palette.
See also:
KDChart::Palette.
685 {
Set the palette to be used, for painting datasets to the subdued palette.
See also:
KDChart::Palette.
680 {
Helper method, retrieving the data value (DisplayRole) for a given row and column.
Parameters:
row The row to query.
column The column to query.
Returns:
The value of the display role at the given row and column as a double.
776 {
6.33.3.96 double LineDiagram::valueForCellTesting (int row, int column, bool & bOK) const
[protected]
380 {
381 double value =
382 d->attributesModel->data(
383 d->attributesModel->index( row, column, attributesModelRootIndex() )
384 ).toDouble( &bOK );
385 if( ! bOK )
386 value = 0.0;
387
388 return value;
389 }
[reimplemented]
Definition at line 658 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 641 of file KDChartAbstractDiagram.cpp.
645 {}
[reimplemented]
Definition at line 667 of file KDChartAbstractDiagram.cpp.
• KDChartLineDiagram.h
• KDChartLineDiagram.cpp
Public Types
• enum MarkerStyle {
MarkerCircle = 0,
MarkerSquare = 1,
MarkerDiamond = 2,
Marker1Pixel = 3,
Marker4Pixels = 4,
MarkerRing = 5,
MarkerCross = 6,
MarkerFastCross = 7 }
• typedef QMap< uint, MarkerStyle > MarkerStylesMap
Enumeration values:
MarkerCircle
MarkerSquare
MarkerDiamond
Marker1Pixel
Marker4Pixels
MarkerRing
MarkerCross
MarkerFastCross
53 { MarkerCircle = 0,
54 MarkerSquare = 1,
55 MarkerDiamond = 2,
56 Marker1Pixel = 3,
57 Marker4Pixels = 4,
58 MarkerRing = 5,
59 MarkerCross = 6,
60 MarkerFastCross = 7 };
6.34.3.1 KDChart::MarkerAttributes::MarkerAttributes ()
6.34.3.3 KDChart::MarkerAttributes::∼MarkerAttributes ()
Referenced by operator<<().
Referenced by operator!=().
The documentation for this class was generated from the following file:
• KDChartMarkerAttributes.h
• void removeFromParentLayout ()
• virtual void setGeometry (const QRect &r)
• void setParentLayout (QLayout ∗lay)
• virtual void setParentWidget (QWidget ∗widget)
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Protected Attributes
• QWidget ∗ mParent
• QLayout ∗ mParentLayout
357 {
358 return 0; // Grow neither vertically nor horizontally
359 }
362 {
363 return mRect;
364 }
367 {
368 return false; // never empty, otherwise the layout item would not exist
369 }
372 {
373 return sizeHint(); // PENDING(kalle) Review, quite inflexible
374 }
377 {
378 return sizeHint(); // PENDING(kalle) Review, quite inflexible
379 }
Implements KDChart::AbstractLayoutItem.
Definition at line 391 of file KDChartLayoutItems.cpp.
References geometry(), KDChart::AbstractDiagram::paintMarker(), and sizeHint().
392 {
393 if( !mRect.isValid() )
394 return;
395
396 // The layout management may assign a larger rect than what we
397 // wanted. We need to adjust the position.
398 QPointF pos = geometry().topLeft();
399 pos += QPointF( static_cast<qreal>(( geometry().width() - sizeHint().width()) / 2.0 ),
400 static_cast<qreal>(( geometry().height() - sizeHint().height()) / 2.0 ) );
401
402 // And finally, drawMarker() assumes the position to be the center
403 // of the marker, adjust again.
404 pos += QPointF( static_cast<qreal>( sizeHint().width() ) / 2.0,
405 static_cast<qreal>( sizeHint().height() )/ 2.0 );
406
407 mDiagram->paintMarker( painter, mMarker, mBrush, mPen, pos.toPoint(), sizeHint() );
408 }
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
382 {
383 mRect = r;
384 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
387 {
388 return mMarker.markerSize().toSize();
389 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
• KDChartLayoutItems.h
• KDChartLayoutItems.cpp
6.36.1.1 KDChart::Measure::Measure ()
42 : mValue( 0.0 ),
43 mMode( KDChartEnums::MeasureCalculationModeAuto ),
44 mArea( 0 ),
45 mOrientation( KDChartEnums::MeasureOrientationAuto )
46 {
47 // this bloc left empty intentionally
48 }
53 : mValue( value ),
54 mMode( mode ),
55 mArea( 0 ),
56 mOrientation( orientation )
57 {
58 // this bloc left empty intentionally
59 }
62 : mValue( r.value() ),
63 mMode( r.calculationMode() ),
64 mArea( r.referenceArea() ),
65 mOrientation( r.referenceOrientation() )
66 {
67 // this bloc left empty intentionally
68 }
The reference area must either be derived from AbstractArea or be derived from QWidget, so e.g.
it could be derived from AbstractAreaWidget too.
Definition at line 83 of file KDChartMeasure.cpp.
References value().
Referenced by KDChart::TextLayoutItem::realFontSize().
85 {
86 if( mMode == KDChartEnums::MeasureCalculationModeAbsolute ){
87 return mValue;
88 }else{
89 qreal value = 0.0;
90 const QObject* area = mArea ? mArea : autoArea;
91 KDChartEnums::MeasureOrientation orientation = mOrientation;
92 switch( mMode ){
93 case KDChartEnums::MeasureCalculationModeAuto:
94 area = autoArea;
95 orientation = autoOrientation;
96 break;
97 case KDChartEnums::MeasureCalculationModeAutoArea:
98 area = autoArea;
99 break;
100 case KDChartEnums::MeasureCalculationModeAutoOrientation:
101 orientation = autoOrientation;
102 break;
57 { return mMode; }
95 { return !operator==(other); }
71 {
72 if( this != &r ){
73 mValue = r.value();
74 mMode = r.calculationMode();
75 mArea = r.referenceArea();
76 mOrientation = r.referenceOrientation();
77 }
78
79 return *this;
80 }
145 {
146 return( mValue == r.value() &&
147 mMode == r.calculationMode() &&
148 mArea == r.referenceArea() &&
149 mOrientation == r.referenceOrientation() );
150 }
The returned reference area will either be derived from AbstractArea or be derived from QWidget.
Definition at line 82 of file KDChartMeasure.h.
Referenced by operator<<(), operator=(), and operator==().
82 { return mArea; }
85 { return mOrientation; }
56 { mMode = mode; }
The reference area must either be derived from AbstractArea or be derived from QWidget, so e.g.
it could be derived from AbstractAreaWidget too.
Definition at line 77 of file KDChartMeasure.h.
77 { mArea = area; }
84 { mOrientation = orientation; }
The reference area must either be derived from AbstractArea or be derived from QWidget, so e.g.
it could be derived from AbstractAreaWidget too.
Definition at line 64 of file KDChartMeasure.h.
66 {
67 mMode = KDChartEnums::MeasureCalculationModeRelative;
68 mArea = area;
69 mOrientation = orientation;
70 }
53 { mValue = val; }
54 { return mValue; }
The documentation for this class was generated from the following files:
• KDChartMeasure.h
• KDChartMeasure.cpp
6.37.1.1 KDChart::PaintContext::PaintContext ()
Referenced by KDChart::CartesianAxis::paintCtx().
• KDChartPaintContext.h
A Palette is a set of brushes (or colors) to be used for painting data sets.
The palette class encapsulates a colletion of brushes, which in the simplest case are colors, to be used for
painting a series of data sets. When asked for the m-th color, a palette of size n will wrap around and thus
cycle through the available colors.
Three builtin palettes are provided for convenience, one with a default set of colors, one with a subdued
color selection, one with rainbow colors.
When a palette changes, it emits a changed() signal. Hook up to it, if you want to repaint when the color
selection changes.
Definition at line 55 of file KDChartPalette.h.
• ∼Palette ()
Public Attributes
• Q_SIGNALS __pad0__: void changed()
6.38.2.3 KDChart::Palette::∼Palette ()
6.38.3.1 void KDChart::Palette::addBrush (const QBrush & brush, int position = -1)
Provide access to the three builtin palettes, one with standard bright colors, one with more subdued colors,
and one with rainbow colors.
Referenced by KDChart::AttributesModel::headerData().
Referenced by KDChart::AttributesModel::headerData().
Parameters:
position,if there is one.
Referenced by KDChart::AttributesModel::headerData().
• KDChartPalette.h
• ∼PieAttributes ()
6.39.1.1 PieAttributes::PieAttributes ()
6.39.1.3 PieAttributes::∼PieAttributes ()
66 {
67 delete _d; _d = 0;
68 }
Returns:
whether the respective pie piece(s) will be exploded.
91 {
92 return (d->explodeFactor != 0.0);
93 }
Returns:
the explode factor set by setExplode or by setExplodeFactor.
101 {
102 return d->explodeFactor;
103 }
72 { return !operator==(other); }
56 {
57 if( this == &r )
58 return *this;
59
60 *d = *r.d;
61
62 return *this;
63 }
72 {
73 if( explodeFactor() == r.explodeFactor() )
74 return true;
75 else
76 return false;
77 }
Note:
This is a convenience function: Calling setExplode( true ) does the same as calling setExplodeFactor(
0.1 ), and calling setExplode( false ) does the same as calling setExplodeFactor( 0.0 ).
See also:
setExplodeFactor
86 {
87 d->explodeFactor = (enabled ? 0.1 : 0.0);
88 }
See also:
setExplode
96 {
97 d->explodeFactor = factor;
98 }
The documentation for this class was generated from the following files:
• KDChartPieAttributes.h
• KDChartPieAttributes.cpp
• void useRainbowColors ()
Set the palette to be used, for painting datasets to the rainbow palette.
• void useSubduedColors ()
Set the palette to be used, for painting datasets to the subdued palette.
• virtual ∼PieDiagram ()
• void paintDataValueText (QPainter ∗painter, const QModelIndex &index, const QPointF &pos, dou-
ble value)
• virtual void paintDataValueTexts (QPainter ∗painter)
• void paintEvent (QPaintEvent ∗)
• void paintMarker (QPainter ∗painter, const QModelIndex &index, const QPointF &pos)
• virtual void paintMarkers (QPainter ∗painter)
• void propertiesChanged ()
Emitted upon change of a property of the Diagram.
Protected Attributes
• Q_SIGNALS __pad0__: void layoutChanged( AbstractDiagram∗ )
52 :
53 AbstractPieDiagram( new Private(), parent, plane )
54 {
55 init();
56 }
59 {
60 }
Returns:
Whether data value labels are allowed to overlap.
295 {
Returns:
Whether anti-aliasing is to be used for rendering this diagram.
306 {
Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel
181 {
182 return d->attributesModel;
183 }
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram.
Definition at line 204 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::LineDiagram::calculateDataBoundaries(), KDChart::BarDiagram::calculate-
DataBoundaries(), KDChart::LineDiagram::numberOfAbscissaSegments(), KDChart::Bar-
Diagram::numberOfAbscissaSegments(), KDChart::LineDiagram::numberOfOrdinateSegments(),
KDChart::BarDiagram::numberOfOrdinateSegments(), KDChart::LineDiagram::paint(), KDChart::Bar-
Diagram::paint(), and KDChart::AbstractDiagram::valueForCell().
210 {
Retrieve the brush to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The brush to use for painting.
638 :
QRect AbstractDiagram::visualRect(const QModelIndex &) const
Parameters:
dataset The dataset to retrieve the brush for.
Returns:
The brush to use for painting.
631 {
Returns:
The brush to use for painting.
623 {
[reimplemented]
Implements KDChart::AbstractDiagram.
Definition at line 71 of file KDChartPieDiagram.cpp.
References KDChart::AbstractDiagram::checkInvariants(), KDChart::AbstractPolarDiagram::column-
Count(), KDChart::PieAttributes::explode(), KDChart::PieAttributes::explodeFactor(), and
KDChart::AbstractPieDiagram::pieAttributes().
72 {
73 if ( !checkInvariants( true ) ) return QPair<QPointF, QPointF>( QPointF( 0, 0 ), QPointF( 0, 0 ) );
74
75 const PieAttributes attrs( pieAttributes( model()->index( 0, 0, rootIndex() ) ) );
76
77 QPointF bottomLeft ( QPointF( 0, 0 ) );
78 QPointF topRight;
79 // If we explode, we need extra space for the pie slice that has
80 // the largest explosion distance.
81 if ( attrs.explode() ) {
82 const int colCount = columnCount();
83 qreal maxExplode = 0.0;
84 for( int j = 0; j < colCount; ++j ){
85 const PieAttributes columnAttrs( pieAttributes( model()->index( 0, j, rootIndex() ) ) );
86 maxExplode = qMax( maxExplode, columnAttrs.explodeFactor() );
87 }
88 topRight = QPointF( 1.0+maxExplode, 1.0+maxExplode );
89 }else{
90 topRight = QPointF( 1.0, 1.0 );
91 }
92 return QPair<QPointF, QPointF> ( bottomLeft, topRight );
93 }
746 {
747 Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
748 "There is no usable model set, for the diagram." );
749
750 Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
751 "There is no usable coordinate plane set, for the diagram." );
752 }
753 return model() && coordinatePlane();
754 }
755
756 int AbstractDiagram::datasetDimension( ) const
67 {
68 return new PieDiagram( new Private( *d ) );
69 }
59 {
60 return static_cast<int>( numberOfValuesPerDataset() );
61 }
217 {
Returns:
The coordinate plane associated with the diagram.
126 {
127 return d->plane;
128 }
Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these
values).
This method returns a chached result of calculations done by calculateDataBoundaries. Classes derived
from AbstractDiagram must implement the calculateDataBoundaries function, to specify their own way of
calculating the data boundaries. If derived classes want to force recalculation of the data boundaries, they
can call setDataBoundariesDirty()
Returned value is in diagram coordinates.
Definition at line 130 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::calculateDataBoundaries(), and d.
Referenced by KDChart::CartesianCoordinatePlane::calculateRawDataBoundingRect(), KDChart::Polar-
CoordinatePlane::layoutDiagrams(), KDChart::LineDiagram::paint(), and KDChart::BarDiagram::paint().
131 {
132 if( d->databoundariesDirty ){
133 d->databoundaries = calculateDataBoundaries ();
134 d->databoundariesDirty = false;
135 }
136 return d->databoundaries;
137 }
[reimplemented]
Definition at line 232 of file KDChartAbstractDiagram.cpp.
References d.
232 {
233 // We are still too dumb to do intelligent updates...
234 d->databoundariesDirty = true;
235 scheduleDelayedItemsLayout();
236 }
237
238 void AbstractDiagram::setDataValueAttributes( const QModelIndex & index,
The set of dataset brushes currently used, for use in legends, etc.
Note:
Cell-level override brushes, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the brush, that is used for a single cell.
Returns:
The current set of dataset brushes.
712 {
713 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( i, Qt::Vertical, DatasetB
714 ret << brush;
715 }
716
717 return ret;
718 }
719
720 QList<QPen> AbstractDiagram::datasetPens() const
The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to
have.
For each dimension it will expect one column of values in the model. If the dimensionality is 1, automatic
values will be used for the abscissa.
For example a diagram with the default dimension of 1, will have one column per datapoint (the y values)
and will use automatic values for the x axis (1, 2, 3, ... n). If the dimension is 2, the diagram will use the
first, (and the third, fifth, etc) columns as X values, and the second, (and the fourth, sixth, etc) column as Y
values.
Returns:
The dataset dimension of the diagram.
762 {
The set of dataset labels currently displayed, for use in legends, etc.
Returns:
The set of dataset labels currently displayed.
The set of dataset markers currently used, for use in legends, etc.
Note:
Cell-level override markers, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the marker, that is shown for a single cell.
Returns:
The current set of dataset brushes.
735 {
736 DataValueAttributes a =
737 qVariantValue<DataValueAttributes>( attributesModel()->headerData( i, Qt::Vertical, DataVa
738 const MarkerAttributes &ma = a.markerAttributes();
739 ret << ma;
740 }
741 return ret;
742 }
743
744 bool AbstractDiagram::checkInvariants( bool justReturnTheStatus ) const
The set of dataset pens currently used, for use in legends, etc.
Note:
Cell-level override pens, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the pens, that is used for a single cell.
Returns:
The current set of dataset pens.
724 {
725 QPen pen = qVariantValue<QPen>( attributesModel()->headerData( i, Qt::Vertical, DatasetPenRole
726 ret << pen;
727 }
728 return ret;
729 }
730
731 QList<MarkerAttributes> AbstractDiagram::datasetMarkers() const
Parameters:
index The datapoint to retrieve the attributes for.
Returns:
The DataValueAttributes for the given index.
278 {
Parameters:
dataset The dataset to retrieve the attributes for.
Returns:
The DataValueAttributes for the given dataset.
271 {
Returns:
The global DataValueAttributes.
264 {
[reimplemented]
Definition at line 223 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::update().
223 {
224 d->plane->layoutDiagrams();
225 update();
226 }
227 QAbstractItemView::doItemsLayout();
228 }
229
230 void AbstractDiagram::dataChanged( const QModelIndex &topLeft,
Returns:
the granularity.
82 {
83 return (d->granularity < 0.05 || d->granularity > 36.0)
84 ? 1.0
85 : d->granularity;
86 }
[reimplemented]
Definition at line 655 of file KDChartAbstractDiagram.cpp.
657 { return 0; }
[reimplemented]
Definition at line 649 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 661 of file KDChartAbstractDiagram.cpp.
663 {}
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Returns:
The set of item row labels currently displayed.
This signal is emitted, when either the model or the AttributesModel is replaced.
Referenced by KDChart::AbstractDiagram::setAttributesModel(), and KDChart::AbstractDiagram::set-
Model().
[reimplemented]
Definition at line 652 of file KDChartAbstractDiagram.cpp.
654 { return 0; }
[reimplemented]
Implements KDChart::AbstractPolarDiagram.
Definition at line 1105 of file KDChartPieDiagram.cpp.
1106 {
1107 return 1;
1108 }
[reimplemented]
Implements KDChart::AbstractPolarDiagram.
Definition at line 1099 of file KDChartPieDiagram.cpp.
1100 {
1101 return model()->columnCount( rootIndex() );
1102 }
[reimplemented]
Implements KDChart::AbstractDiagram.
Definition at line 169 of file KDChartPieDiagram.cpp.
References KDChart::AbstractDiagram::brush(), buildReferenceRect(), KDChart::Abstract-
Diagram::checkInvariants(), KDChart::AbstractPolarDiagram::columnCount(), d, KDChart::Abstract-
ThreeDAttributes::depth(), KDChart::PieAttributes::explodeFactor(), KDChart::AbstractPie-
Diagram::granularity(), KDChart::AbstractThreeDAttributes::isEnabled(), KDChart::Paint-
Context::painter(), KDChart::AbstractDiagram::pen(), KDChart::AbstractPieDiagram::pieAttributes(),
KDChart::AbstractPolarDiagram::polarCoordinatePlane(), KDChart::PaintContext::rectangle(),
KDChart::AbstractPieDiagram::startPosition(), KDChart::AbstractPieDiagram::threeDPieAttributes(),
and valueTotals().
Referenced by paintEvent().
170 {
171 if ( !checkInvariants() )
172 return;
173
174 const PieAttributes attrs( pieAttributes() );
175 const ThreeDPieAttributes threeDAttrs( threeDPieAttributes( model()->index( 0, 0, rootIndex() ) )
176
177 const int colCount = columnCount();
178
179 QRectF contentsRect( buildReferenceRect( polarCoordinatePlane() ) );
180 contentsRect = ctx->rectangle();
181 // contentsRect = geometry();
182 //qDebug() << contentsRect;
183 if( contentsRect.isEmpty() )
184 return;
185
320 {
321 // paint one data series
322 DataValueAttributes a = dataValueAttributes(index);
323 if ( !a.isVisible() ) return;
324
325 // handle decimal digits
326 int decimalDigits = a.decimalDigits();
327 int decimalPos = QString::number( value ).indexOf( QLatin1Char( ’.’ ) );
328 QString roundedValue;
329 if ( a.dataLabel().isNull() ) {
330 if ( decimalPos > 0 && value != 0 )
331 roundedValue = roundValues ( value, decimalPos, decimalDigits );
332 else
333 roundedValue = QString::number( value );
334 } else
335 roundedValue = a.dataLabel();
336 // handle prefix and suffix
337 if ( !a.prefix().isNull() )
338 roundedValue.prepend( a.prefix() );
339
340 if ( !a.suffix().isNull() )
341 roundedValue.append( a.suffix() );
342
343 PainterSaver painterSaver( painter );
344 // FIXME draw the non-text bits, background, etc
345 const TextAttributes &ta = a.textAttributes();
346 if ( ta.isVisible() ) {
347 painter->setPen( ta.pen() );
348 painter->setFont( ta.font() );
349 painter->translate( pos );
350 painter->rotate( ta.rotation() );
351 painter->drawText( QPointF(0, 0), roundedValue );
352 }
353 }
354
355 QString AbstractDiagram::roundValues( double value,
385 {
386 for ( int j=0; j< rowCount; ++j ) {
387 const QModelIndex index = model()->index( j, i, rootIndex() );
388 double value = model()->data( index ).toDouble();
389 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
390 paintDataValueText( painter, index, pos, value );
391 }
392 }
393 }
394
395
97 {
98 QPainter painter ( viewport() );
99 PaintContext ctx;
100 ctx.setPainter ( &painter );
101 ctx.setRectangle( QRectF ( 0, 0, width(), height() ) );
102 paint ( &ctx );
103 }
399 {
400
401 if ( !checkInvariants() ) return;
402 DataValueAttributes a = dataValueAttributes(index);
403 if ( !a.isVisible() ) return;
404 const MarkerAttributes &ma = a.markerAttributes();
405 if ( !ma.isVisible() ) return;
406
407 PainterSaver painterSaver( painter );
408 QSizeF maSize( ma.markerSize() );
409 QBrush indexBrush( brush( index ) );
424 {
425 PainterSaver painterSaver( painter );
426 painter->setBrush( brush );
427 painter->setPen( pen );
428 painter->setRenderHint ( QPainter::Antialiasing );
429 painter->translate( pos );
430 switch ( markerAttributes.markerStyle() ) {
431 case MarkerAttributes::MarkerCircle:
432 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
433 maSize.height(), maSize.width()) );
434 break;
435 case MarkerAttributes::MarkerSquare:
436 {
437 QRectF rect( 0 - maSize.height()/2, 0 - maSize.width()/2,
438 maSize.height(), maSize.width() );
439 painter->drawRect( rect );
440 painter->fillRect( rect, painter->brush() );
441 break;
442 }
443 case MarkerAttributes::MarkerDiamond:
444 {
445 QVector <QPointF > diamondPoints;
446 QPointF top, left, bottom, right;
447 top = QPointF( 0, 0 - maSize.height()/2 );
448 left = QPointF( 0 - maSize.width()/2, 0 );
449 bottom = QPointF( 0, maSize.height()/2 );
450 right = QPointF( maSize.width()/2, 0 );
451 diamondPoints << top << left << bottom << right;
452 painter->drawPolygon( diamondPoints );
453 break;
454 }
455 //Pending Michel: do we need that? Ask: What is the idea about
456 // Marker1Pixel and Marker4Pixels.
457 case MarkerAttributes::Marker1Pixel:
458 {
459 QSizeF pSize(4,4);
460 QPen pen1Pixel;
461 pen1Pixel.setColor( painter->background().color() );
462 QRectF centerRect( -pSize.height()/2, -pSize.width()/2,
463 pSize.height(), pSize.width() );
464 painter->setPen( pen1Pixel );
465 painter->drawEllipse( centerRect );
466 break;
467 }
535 {
536 for ( int j=0; j< rowCount; ++j ) {
537 const QModelIndex index = model()->index( j, i, rootIndex() );
538 double value = model()->data( index ).toDouble();
539 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
540 paintMarker( painter, index, pos );
541 }
542 }
543 }
544
545
Retrieve the pen to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The pen to use for painting.
593 {
Parameters:
dataset The dataset to retrieve the pen for.
Returns:
The pen to use for painting.
585 {
Returns:
The pen to use for painting.
577 {
320 {
123 {
124 return qVariantValue<PieAttributes>(
125 d->attributesModel->data(
126 d->attributesModel->mapFromSource( index ),
127 PieAttributesRole ) );
128 }
115 {
116 return qVariantValue<PieAttributes>(
117 d->attributesModel->data(
118 d->attributesModel->mapFromSource( columnToIndex( column ) ).column(),
119 PieAttributesRole ) );
120 }
106 {
107 return qVariantValue<PieAttributes>(
108 d->attributesModel->data( PieAttributesRole ) );
109 }
54 {
55 return dynamic_cast<const PolarCoordinatePlane*>( coordinatePlane() );
56 }
[reimplemented]
Implements KDChart::AbstractDiagram.
Definition at line 109 of file KDChartPieDiagram.cpp.
110 {
111 }
106 {
107 }
[reimplemented]
Definition at line 646 of file KDChartAbstractDiagram.cpp.
Parameters:
allow True means that overlapping labels are allowed.
290 {
Parameters:
enabled True means that AA is enabled.
301 {
Wrong:
diagram1->setAttributesModel( diagram2->attributesModel() );
Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel
161 {
162 if( amodel->sourceModel() != model() ) {
163 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
164 "Trying to set an attributesmodel which works on a different "
165 "model than the diagram.");
166 return;
167 }
168 if( qobject_cast<PrivateAttributesModel*>(amodel) ) {
169 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
170 "Trying to set an attributesmodel that is private to another diagram.");
171 return;
172 }
173 d->setAttributesModel(amodel);
174 scheduleDelayedItemsLayout();
175 d->databoundariesDirty = true;
176 emit modelsChanged();
177 }
Set the brush to be used, for painting all datasets in the model.
Parameters:
brush The brush to use.
608 {
6.40.2.58 void AbstractDiagram::setBrush (int dataset, const QBrush & brush) [inherited]
Parameters:
dataset The dataset’s column in the model.
617 {
6.40.2.59 void AbstractDiagram::setBrush (const QModelIndex & index, const QBrush & brush)
[inherited]
Set the brush to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
brush The brush to use.
601 {
Returns:
The coordinate plane associated with the diagram.
Reimplemented in KDChart::AbstractCartesianDiagram.
Definition at line 218 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::AbstractCartesian-
Diagram::setCoordinatePlane(), and KDChart::AbstractCoordinatePlane::takeDiagram().
222 {
140 {
141 d->databoundariesDirty = true;
142 }
See also:
datasetDimension.
Parameters:
dimension
770 {
Parameters:
a The attributes to set.
284 {
Parameters:
dataset The dataset to set the attributes for.
a The attributes to set.
259 {
Parameters:
index The datapoint to set the attributes for.
a The attributes to set.
240 {
241 d->attributesModel->setData(
242 d->attributesModel->mapFromSource( index ),
243 qVariantFromValue( a ),
244 DataValueLabelAttributesRole );
245 emit propertiesChanged();
246 }
247
248
Set the granularity: the smaller the granularity the more your diagram segments will show facettes instead
of rounded segments.
Parameters:
value the granularity value between 0.05 (one twentieth of a degree) and 36.0 (one tenth of a full
circle), other values will be interpreted as 1.0.
77 {
78 d->granularity = value;
79 }
145 {
146 QAbstractItemView::setModel( newModel );
147 AttributesModel* amodel = new PrivateAttributesModel( newModel, this );
148 amodel->initFrom( d->attributesModel );
149 d->setAttributesModel(amodel);
150 scheduleDelayedItemsLayout();
151 d->databoundariesDirty = true;
152 emit modelsChanged();
153 }
Set the pen to be used, for painting all datasets in the model.
Parameters:
pen The pen to use.
562 {
6.40.2.69 void AbstractDiagram::setPen (int dataset, const QPen & pen) [inherited]
Parameters:
dataset The dataset’s row in the model.
pen The pen to use.
571 {
6.40.2.70 void AbstractDiagram::setPen (const QModelIndex & index, const QPen & pen)
[inherited]
Set the pen to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
pen The pen to use.
555 {
312 {
96 {
97 d->attributesModel->setHeaderData(
98 column, Qt::Vertical, qVariantFromValue( attrs ), PieAttributesRole );
99 emit layoutChanged( this );
100 }
90 {
91 d->attributesModel->setModelData( qVariantFromValue( attrs ), PieAttributesRole );
92 emit layoutChanged( this );
93 }
Set the root index in the model, where the diagram starts referencing data for display.
[reimplemented]
Definition at line 188 of file KDChartAbstractDiagram.cpp.
References d.
[reimplemented]
Definition at line 664 of file KDChartAbstractDiagram.cpp.
66 {
67 d->startPosition = degrees;
68 }
145 {
146 model()->setData( index, qVariantFromValue( tda ), ThreeDPieAttributesRole );
147 emit layoutChanged( this );
148 }
138 {
139 d->attributesModel->setHeaderData(
140 column, Qt::Vertical, qVariantFromValue( tda ), ThreeDPieAttributesRole );
141 emit layoutChanged( this );
142 }
132 {
133 d->attributesModel->setModelData( qVariantFromValue( tda ), ThreeDPieAttributesRole );
134 emit layoutChanged( this );
135 }
Returns:
the starting angle for the first dataset.
71 {
72 return d->startPosition;
73 }
171 {
172 return qVariantValue<ThreeDPieAttributes>(
173 d->attributesModel->data(
174 d->attributesModel->mapFromSource( index ),
175 ThreeDPieAttributesRole ) );
176 }
163 {
164 return qVariantValue<ThreeDPieAttributes>(
165 d->attributesModel->data(
166 d->attributesModel->mapFromSource( columnToIndex( column ) ).column(),
167 ThreeDPieAttributesRole ) );
168 }
154 {
155 return qVariantValue<ThreeDPieAttributes>(
156 d->attributesModel->data( ThreeDPieAttributesRole ) );
157 }
Set the palette to be used, for painting datasets to the default palette.
See also:
KDChart::Palette. FIXME: fold into one usePalette (KDChart::Palette&) method
675 {
Set the palette to be used, for painting datasets to the rainbow palette.
See also:
KDChart::Palette.
685 {
Set the palette to be used, for painting datasets to the subdued palette.
See also:
KDChart::Palette.
680 {
Helper method, retrieving the data value (DisplayRole) for a given row and column.
Parameters:
row The row to query.
column The column to query.
Returns:
The value of the display role at the given row and column as a double.
776 {
[reimplemented]
Implements KDChart::AbstractPolarDiagram.
Definition at line 1087 of file KDChartPieDiagram.cpp.
References KDChart::AbstractPolarDiagram::columnCount().
Referenced by paint().
1088 {
1089 const int colCount = columnCount();
1090 double total = 0.0;
1091 for ( int j = 0; j < colCount; ++j ) {
1092 total += qAbs(model()->data( model()->index( 0, j, rootIndex() ) ).toDouble());
1093 //qDebug() << model()->data( model()->index( 0, j, rootIndex() ) ).toDouble();
1094 }
1095 return total;
1096 }
[reimplemented]
Definition at line 658 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 641 of file KDChartAbstractDiagram.cpp.
645 {}
[reimplemented]
Definition at line 667 of file KDChartAbstractDiagram.cpp.
• KDChartPieDiagram.h
• KDChartPieDiagram.cpp
Public Types
• enum AxesCalcMode {
Linear,
Logarithmic }
• typedef QList< CoordinateTransformation > CoordinateTransformationList
• void layoutPlanes ()
Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes().
• void needLayoutPlanes ()
Emitted when plane needs to trigger the Chart’s layouting of the coord.
• void needRelayout ()
Emitted when plane needs to trigger the Chart’s layouting.
• void needUpdate ()
Emitted when plane needs to update its drawings.
• void relayout ()
Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout().
• void removeFromParentLayout ()
• virtual void replaceDiagram (AbstractDiagram ∗diagram, AbstractDiagram ∗oldDiagram=0)
Replaces the old diagram, or appends the diagram, it there is none yet.
Public Attributes
• Q_SIGNALS __pad0__: void destroyedCoordinatePlane( AbstractCoordinatePlane∗ )
Protected Attributes
• QWidget ∗ mParent
• QLayout ∗ mParentLayout
• protected Q_SLOTS: void slotLayoutChanged( AbstractDiagram∗ diagram )
Enumeration values:
Linear
Logarithmic
55 { Linear, Logarithmic };
6.41.3.2 PolarCoordinatePlane::∼PolarCoordinatePlane ()
121 {
122 // this bloc left empty intentionally
123 }
Parameters:
diagram The diagram to add.
See also:
replaceDiagram, takeDiagram
131 {
132 Q_ASSERT_X ( dynamic_cast<AbstractPolarDiagram*> ( diagram ),
133 "PolarCoordinatePlane::addDiagram", "Only polar"
134 "diagrams can be added to a polar coordinate plane!" );
135 AbstractCoordinatePlane::addDiagram ( diagram );
136 connect ( diagram, SIGNAL ( layoutChanged ( AbstractDiagram* ) ),
137 SLOT ( slotLayoutChanged ( AbstractDiagram* ) ) );
138
139 }
76 {
77 Q_UNUSED( position );
78 // PENDING(kalle) FIXME
79 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosi
80 }
293 {
294 Q_ASSERT_X ( d->currentTransformation != 0, "PolarCoordinatePlane::translate",
295 "Only call translate() from within paint()." );
296 return d->currentTransformation->angleUnit;
297 }
Implements KDChart::AbstractAreaBase.
Definition at line 105 of file KDChartAbstractArea.cpp.
Referenced by KDChart::CartesianCoordinatePlane::drawingArea(), layoutDiagrams(),
KDChart::CartesianAxis::paint(), KDChart::AbstractArea::paintAll(), and KDChart::Cartesian-
Axis::paintCtx().
106 {
107 return geometry();
108 }
98 {
99 return d->backgroundAttributes;
100 }
Returns:
The first diagram associated with this coordinate plane.
114 {
115 if ( d->diagrams.isEmpty() )
116 {
117 return 0;
118 } else {
119 return d->diagrams.first();
120 }
121 }
Returns:
The list of diagrams associated with this coordinate plane.
129 {
130 ConstAbstractDiagramList list;
131 #ifndef QT_NO_STL
132 qCopy( d->diagrams.begin(), d->diagrams.end(), std::back_inserter( list ) );
133 #else
134 Q_FOREACH( AbstractDiagram * a, d->diagrams )
135 list.push_back( a );
136 #endif
137 return list;
138 }
Returns:
The list of diagrams associated with this coordinate plane.
124 {
125 return d->diagrams;
126 }
201 {
202 return Qt::Vertical | Qt::Horizontal;
203 }
88 {
89 return d->frameAttributes;
90 }
238 {
239 return d->geometry;
240 }
Implements KDChart::AbstractCoordinatePlane.
Definition at line 335 of file KDChartPolarCoordinatePlane.cpp.
References KDChart::DataDimensionsList.
336 {
337 DataDimensionsList l;
338
339 //FIXME(khz): do the real calculation
340
341 return l;
342 }
Returns:
The grid attributes used by this coordinate plane.
See also:
setGlobalGridAttributes
CartesianCoordinatePlane::gridAttributes
158 {
159 return d->gridAttributes;
160 }
Returns:
The attributes used for grid lines drawn in circular direction (or in sagittal direction, resp.).
Note:
This function always returns a valid set of grid attributes: If no special grid attributes were set for
this direction the global attributes are returned, as returned by AbstractCoordinatePlane::globalGrid-
Attributes.
See also:
setGridAttributes
resetGridAttributes
AbstractCoordinatePlane::globalGridAttributes
hasOwnGridAttributes
366 {
367 if( hasOwnGridAttributes( circular ) ){
368 if( circular )
369 return d->gridAttributesCircular;
370 else
371 return d->gridAttributesSagittal;
372 }else{
373 return globalGridAttributes();
374 }
375 }
Note:
Returned list will contain different numbers of DataDimension, depending on the kind of coordinate
plane used. For CartesianCoordinatePlane two DataDimension are returned: the first representing
grid lines in X direction (matching the Abscissa axes) and the second indicating vertical grid lines (or
Ordinate axes, resp.).
Returns:
The dimensions used for drawing the grid lines.
See also:
DataDimension
163 {
164 return d->grid->updateData( this );
165 }
Returns:
Returns whether the grid attributes have been set for the respective direction via setGridAttributes(
bool circular ).
If false, the grid will use the global attributes set by AbstractCoordinatePlane::globalGridAttributes (or the
default attributes, resp.)
See also:
setGridAttributes
resetGridAttributes
AbstractCoordinatePlane::globalGridAttributes
389 {
390 return
391 ( circular )
392 ? d->hasOwnGridAttributesCircular
393 : d->hasOwnGridAttributesSagittal;
394 }
176 {
177 Q_ASSERT_X ( d != 0, "AbstractAreaBase::innerRect()",
178 "Private class was not initialized!" );
179
180 const int padding
181 = d->frameAttributes.isVisible()
182 ? qMax( d->frameAttributes.padding(), 0 ) : 0;
183 return
184 QRect( QPoint(0,0), areaGeometry().size() )
185 .adjusted( padding, padding, -padding, -padding );
186 }
194 {
195 return false; // never empty!
196 // coordinate planes with no associated diagrams
197 // are showing a default grid of ()1..10, 1..10) stepWidth 1
198 }
239 {
240 // the rectangle the diagrams cover in the *plane*:
241 // (Why -3? We save 1px on each side for the antialiased drawing, and
242 // respect the way QPainter calculates the width of a painted rect (the
243 // size is the rectangle size plus the pen width). This way, most clipping
244 // for regular pens should be avoided. When pens with a penWidth or larger
245 // than 1 are used, this may not b sufficient.
246 const QRect rect( areaGeometry() );
247 d->contentRect = QRectF ( 1, 1, rect.width() - 3, rect.height() - 3 );
248
249 // FIXME distribute space according to options:
250 d->coordinateTransformations.clear();
251 Q_FOREACH( AbstractDiagram* diagram, diagrams() )
252 {
253 AbstractPolarDiagram *polarDiagram = dynamic_cast<AbstractPolarDiagram*>( diagram );
254 Q_ASSERT( polarDiagram );
255 QPair<QPointF, QPointF> dataBoundariesPair = polarDiagram->dataBoundaries();
256
257 const double angleUnit = 360 / polarDiagram->valueTotals();
258 //qDebug() << "--------------------------------------------------------";
259 const double radius = dataBoundariesPair.second.y();
260 //qDebug() << radius <<"="<<dataBoundariesPair.second.y();
261 const double diagramWidth = radius * 2; // == height
262 const double planeWidth = d->contentRect.width();
263 const double planeHeight = d->contentRect.height();
264 const double radiusUnit = qMin( planeWidth, planeHeight ) / diagramWidth;
265 //qDebug() << radiusUnit <<"=" << "qMin( "<<planeWidth<<","<< planeHeight <<") / "<<diagramWidth;
266 QPointF coordinateOrigin = QPointF ( planeWidth / 2, planeHeight / 2 );
267 coordinateOrigin += d->contentRect.topLeft();
268
269 CoordinateTransformation diagramTransposition;
270 diagramTransposition.originTranslation = coordinateOrigin;
271 diagramTransposition.radiusUnit = radiusUnit;
272 diagramTransposition.angleUnit = angleUnit;
273 diagramTransposition.zoom = ZoomParameters();
274 d->coordinateTransformations.append( diagramTransposition );
275 }
276 }
255 {
256 //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
257 emit needLayoutPlanes();
258 }
206 {
207 if( d->parent )
208 return d->parent->size();
209 // Note: At external layut calculation time the coord.plane *will*
210 // have a parent widget, so returning a default size here
211 // will not affect its real drawing size.
212 return QSize(1000, 1000);
213 }
216 {
217 return QSize(60, 60); // this default can be overwritten by derived classes
218 }
[reimplemented]
Definition at line 140 of file KDChartAbstractCoordinatePlane.cpp.
141 {
142 return QSize( 200, 200 );
143 }
Emitted when plane needs to trigger the Chart’s layouting of the coord.
planes.
Referenced by KDChart::AbstractCoordinatePlane::layoutPlanes().
reimpl
Implements KDChart::AbstractLayoutItem.
Definition at line 141 of file KDChartPolarCoordinatePlane.cpp.
References KDChart::AbstractDiagramList, d, KDChart::AbstractCoordinatePlane::diagrams(),
KDChart::AbstractCoordinatePlane::geometry(), KDChart::PaintContext::setCoordinatePlane(),
KDChart::PaintContext::setPainter(), and KDChart::PaintContext::setRectangle().
142 {
143 AbstractDiagramList diags = diagrams();
144 if ( d->coordinateTransformations.size() == diags.size() )
145 {
146 PaintContext ctx;
147 ctx.setPainter ( painter );
148 ctx.setCoordinatePlane ( this );
149 ctx.setRectangle ( geometry() /*d->contentRect*/ );
150
151 // paint the coordinate system rulers:
152 d->currentTransformation = & ( d->coordinateTransformations[0] );
153 d->grid->drawGrid( &ctx );
154
155 // paint the diagrams:
156 for ( int i = 0; i < diags.size(); i++ )
157 {
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked
automatically.
Definition at line 83 of file KDChartAbstractArea.cpp.
References KDChart::AbstractArea::areaGeometry(), KDChart::AbstractAreaBase::innerRect(),
KDChart::AbstractLayoutItem::paint(), KDChart::AbstractAreaBase::paintBackground(), and
KDChart::AbstractAreaBase::paintFrame().
Referenced by KDChart::Chart::paint(), and KDChart::AbstractArea::paintIntoRect().
84 {
85 // Paint the background and frame
86 paintBackground( painter, geometry() );
87 paintFrame( painter, geometry() );
88
89 // temporarily adjust the widget size, to be sure all content gets calculated
90 // to fit into the inner rectangle
91 const QRect oldGeometry( areaGeometry() );
92 QRect inner( innerRect() );
93 inner.moveTo(
94 oldGeometry.left() + inner.left(),
95 oldGeometry.top() + inner.top() );
96 const bool needAdjustGeometry = oldGeometry != inner;
97 if( needAdjustGeometry )
98 setGeometry( inner );
99 paint( &painter );
100 if( needAdjustGeometry )
101 setGeometry( oldGeometry );
102 //qDebug() << "AbstractAreaWidget::paintAll() done.";
103 }
104 {
105 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
106 "Private class was not initialized!" );
107
108 #define attributes d->backgroundAttributes
109
110 if( !attributes.isVisible() ) return;
111
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
6.41.4.32 void AbstractAreaBase::paintFrame (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
159 {
160 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
161 "Private class was not initialized!" );
162
163 #define attributes d->frameAttributes
164
165 if( !attributes.isVisible() ) return;
166
167 const QPen oldPen( painter.pen() );
168 painter.setPen( attributes.pen() );
169 painter.drawRect( rect );
170 painter.setPen( oldPen );
171 #undef attributes
172 }
6.41.4.33 void AbstractArea::paintIntoRect (QPainter & painter, const QRect & rect)
[virtual, inherited]
72 {
73 const QRect oldGeometry( geometry() );
74 if( oldGeometry != rect )
75 setGeometry( rect );
76 painter.translate( rect.left(), rect.top() );
77 paintAll( painter );
78 painter.translate( -rect.left(), -rect.top() );
79 if( oldGeometry != rect )
80 setGeometry( oldGeometry );
81 }
183 {
184 return d->parent;
185 }
188 {
189 return d->parent;
190 }
111 {
112 emit positionChanged( this );
113 }
Emitted upon change of a property of the Coordinate Plane or any of its components.
Referenced by KDChart::CartesianCoordinatePlane::addDiagram(), KDChart::Cartesian-
CoordinatePlane::setAxesCalcModes(), KDChart::CartesianCoordinatePlane::setAxesCalcModeX(),
KDChart::CartesianCoordinatePlane::setAxesCalcModeY(), setGridAttributes(), KDChart::Cartesian-
CoordinatePlane::setGridAttributes(), KDChart::CartesianCoordinatePlane::setHorizontalRange(),
KDChart::CartesianCoordinatePlane::setIsometricScaling(), KDChart::CartesianCoordinatePlane::set-
VerticalRange(), KDChart::CartesianCoordinatePlane::setZoomCenter(), KDChart::CartesianCoordinate-
Plane::setZoomFactorX(), and KDChart::CartesianCoordinatePlane::setZoomFactorY().
There are two ways, in which planes can be caused to interact, in where they are put layouting wise: The
first is the reference plane.
If such a reference plane is set, on a plane, it will use the same cell in the layout as that one. In addition
to this, planes can share an axis. In that case they will be layed out in relation to each other as suggested
by the position of the axis. If, for example Plane1 and Plane2 share an axis at position Left, that will result
in the layout: Axis Plane1 Plane 2, vertically. If Plane1 also happens to be Plane2’s reference plane, both
planes are drawn over each other. The reference plane concept allows two planes to share the same space
even if neither has any axis, and in case there are shared axis, it is used to decided, whether the planes
should be painted on top of each other or layed out vertically or horizontally next to each other.
Returns:
The reference coordinate plane associated with this one.
173 {
174 return d->referenceCoordinatePlane;
175 }
249 {
250 //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
251 emit needRelayout();
252 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
Replaces the old diagram, or appends the diagram, it there is none yet.
Parameters:
diagram The diagram to be used instead of the old diagram. This parameter must not be zero, or the
method will do nothing.
oldDiagram The diagram to be removed by the new diagram. This diagram will be deleted automat-
ically. If the parameter is omitted, the very first diagram will be replaced. In case, there was no
diagram yet, the new diagram will just be added.
Note:
If you want to re-use the old diagram, call takeDiagram and addDiagram, instead of using replace-
Diagram.
See also:
addDiagram, takeDiagram
83 {
84 if( diagram && oldDiagram_ != diagram ){
85 AbstractDiagram* oldDiagram = oldDiagram_;
86 if( d->diagrams.count() ){
87 if( ! oldDiagram )
88 oldDiagram = d->diagrams.first();
89 takeDiagram( oldDiagram );
90 }
91 delete oldDiagram;
92 addDiagram( diagram );
93 layoutDiagrams();
94 layoutPlanes(); // there might be new axes, etc
95 update();
96 }
97 }
Reset the attributes to be used for grid lines drawn in circular direction (or in sagittal direction, resp.).
By calling this method you specify that the global attributes set by AbstractCoordinatePlane::setGlobal-
GridAttributes be used.
See also:
setGridAttributes, gridAttributes
AbstractCoordinatePlane::globalGridAttributes
hasOwnGridAttributes
359 {
360 setHasOwnGridAttributes( circular, false );
361 update();
362 }
233 {
234 d->initialResizeEventReceived = true;
235 layoutDiagrams();
236 }
93 {
94 d->backgroundAttributes = a;
95 }
83 {
84 d->frameAttributes = a;
85 }
Note:
Do not call this function directly, unless you know exactly what you are doing. Geometry management
is done by KD Chart’s internal layouting measures.
228 {
229 // qDebug() << "KDChart::AbstractCoordinatePlane::setGeometry(" << r << ") called";
230 if( d->geometry != r ){
231 d->geometry = r;
232 // Note: We do *not* call update() here
233 // because it would invoke KDChart::update() recursively.
234 }
235 }
GridAttributes ga = plane->globalGridAttributes();
ga.setGlobalGridVisible( false );
plane->setGlobalGridAttributes( ga );
See also:
globalGridAttributes
CartesianCoordinatePlane::setGridAttributes
152 {
153 d->gridAttributes = a;
154 update();
155 }
Set the attributes to be used for grid lines drawn in circular direction (or in sagittal direction, resp.).
To disable circular grid painting, for example, your code should like this:
Note:
setGridAttributes overwrites the global attributes that were set by AbstractCoordinatePlane::setGlobal-
GridAttributes. To re-activate these global attributes you can call resetGridAttributes.
See also:
resetGridAttributes, gridAttributes
AbstractCoordinatePlane::setGlobalGridAttributes
hasOwnGridAttributes
347 {
348 if( circular )
349 d->gridAttributesCircular = a;
350 else
351 d->gridAttributesSagittal = a;
352 setHasOwnGridAttributes( circular, true );
353 update();
354 emit propertiesChanged();
355 }
178 {
179 d->parent = parent;
180 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
Set another coordinate plane to be used as the reference plane for this one.
Parameters:
plane The coordinate plane to be used the reference plane for this one.
See also:
referenceCoordinatePlane
168 {
169 d->referenceCoordinatePlane = plane;
170 }
Set the point (in value coordinates) to be used as the center point in zoom operations.
Parameters:
center The point to use.
330 {
331 d->coordinateTransformations[0].zoom.xCenter = center.x();
332 d->coordinateTransformations[0].zoom.yCenter = center.y();
333 }
Sets the zoom factor in horizontal direction, that is applied to all coordinate transformations.
Reimplemented from KDChart::AbstractCoordinatePlane.
Definition at line 314 of file KDChartPolarCoordinatePlane.cpp.
References d.
315 {
316 d->coordinateTransformations[0].zoom.xFactor = factor;
317 }
Sets the zoom factor in vertical direction, that is applied to all coordinate transformations.
Reimplemented from KDChart::AbstractCoordinatePlane.
Definition at line 319 of file KDChartPolarCoordinatePlane.cpp.
References d.
320 {
321 d->coordinateTransformations[0].zoom.yFactor = factor;
322 }
221 {
222 // we return our maxiumu (which is the full size of the Chart)
223 // even if we know the plane will be smaller
224 return maximumSize();
225 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
[reimplemented]
Definition at line 146 of file KDChartAbstractCoordinatePlane.cpp.
147 {
148 return QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
149 }
See also:
addDiagram, replaceDiagram
101 {
102 const int idx = d->diagrams.indexOf( diagram );
103 if( idx != -1 ){
104 d->diagrams.removeAt( idx );
105 diagram->setParent( 0 );
106 diagram->setCoordinatePlane( 0 );
107 layoutDiagrams();
108 update();
109 }
110 }
Translate the given point in value space coordinates to a position in pixel space.
Parameters:
diagramPoint The point in value coordinates.
Returns:
The translated point.
Implements KDChart::AbstractCoordinatePlane.
Definition at line 278 of file KDChartPolarCoordinatePlane.cpp.
References d.
Referenced by buildReferenceRect().
279 {
280 Q_ASSERT_X ( d->currentTransformation != 0, "PolarCoordinatePlane::translate",
281 "Only call translate() from within paint()." );
282 return d->currentTransformation->translate ( diagramPoint );
283 }
286 {
287 Q_ASSERT_X ( d->currentTransformation != 0, "PolarCoordinatePlane::translate",
288 "Only call translate() from within paint()." );
289 return d->currentTransformation->translatePolar ( diagramPoint );
290 }
Returns:
The center point (in value coordinates) of the coordinate plane, that is used for zoom operations.
325 {
326 return QPointF( d->coordinateTransformations[0].zoom.xCenter, d->coordinateTransformations[0].zoom
327 }
Returns:
The zoom factor in horizontal direction, that is applied to all coordinate transformations.
305 {
306 return d->coordinateTransformations[0].zoom.xFactor;
307 }
Returns:
The zoom factor in vertical direction, that is applied to all coordinate transformations.
310 {
311 return d->coordinateTransformations[0].zoom.yFactor;
312 }
• KDChartPolarCoordinatePlane.h
• KDChartPolarCoordinatePlane.cpp
• void useRainbowColors ()
Set the palette to be used, for painting datasets to the rainbow palette.
• void useSubduedColors ()
Set the palette to be used, for painting datasets to the subdued palette.
[reimplemented]
• void paintDataValueText (QPainter ∗painter, const QModelIndex &index, const QPointF &pos, dou-
ble value)
• virtual void paintDataValueTexts (QPainter ∗painter)
• void paintEvent (QPaintEvent ∗)
• void paintMarker (QPainter ∗painter, const QModelIndex &index, const QPointF &pos)
• virtual void paintMarkers (QPainter ∗painter)
• virtual void paintPolarMarkers (PaintContext ∗ctx, const QPolygonF &polygon)
• void propertiesChanged ()
Emitted upon change of a property of the Diagram.
Protected Attributes
• Q_SIGNALS __pad0__: void layoutChanged( AbstractDiagram∗ )
49 :
50 AbstractPolarDiagram( new Private( ), parent, plane )
51 {
52 }
55 {
56 }
Returns:
Whether data value labels are allowed to overlap.
295 {
Returns:
Whether anti-aliasing is to be used for rendering this diagram.
306 {
Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel
181 {
182 return d->attributesModel;
183 }
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram.
Definition at line 204 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::LineDiagram::calculateDataBoundaries(), KDChart::BarDiagram::calculate-
DataBoundaries(), KDChart::LineDiagram::numberOfAbscissaSegments(), KDChart::Bar-
Diagram::numberOfAbscissaSegments(), KDChart::LineDiagram::numberOfOrdinateSegments(),
KDChart::BarDiagram::numberOfOrdinateSegments(), KDChart::LineDiagram::paint(), KDChart::Bar-
Diagram::paint(), and KDChart::AbstractDiagram::valueForCell().
210 {
Retrieve the brush to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The brush to use for painting.
638 :
QRect AbstractDiagram::visualRect(const QModelIndex &) const
Parameters:
dataset The dataset to retrieve the brush for.
Returns:
The brush to use for painting.
631 {
Returns:
The brush to use for painting.
623 {
[reimplemented]
Implements KDChart::AbstractDiagram.
Definition at line 91 of file KDChartPolarDiagram.cpp.
References KDChart::AbstractDiagram::checkInvariants().
92 {
93 if ( !checkInvariants() ) return QPair<QPointF, QPointF>( QPointF( 0, 0 ), QPointF( 0, 0 ) );
94 const int rowCount = model()->rowCount(rootIndex());
95 const int colCount = model()->columnCount(rootIndex());
96 double xMin = 0.0;
97 double xMax = colCount;
98 double yMin = 0, yMax = 0;
99 for ( int j=0; j<colCount; ++j ) {
100 for ( int i=0; i< rowCount; ++i ) {
101 double value = model()->data( model()->index( i, j, rootIndex() ) ).toDouble();
102 yMax = qMax( yMax, value );
103 }
104 }
105 QPointF bottomLeft ( QPointF( xMin, yMin ) );
106 QPointF topRight ( QPointF( xMax, yMax ) );
107 return QPair<QPointF, QPointF> ( bottomLeft, topRight );
108 }
746 {
747 Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
748 "There is no usable model set, for the diagram." );
749
750 Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
751 "There is no usable coordinate plane set, for the diagram." );
752 }
753 return model() && coordinatePlane();
754 }
755
756 int AbstractDiagram::datasetDimension( ) const
83 {
84 PolarDiagram* newDiagram = new PolarDiagram( new Private( *d ) );
85 // This needs to be copied after the fact
86 newDiagram->d->showDelimitersAtPosition = d->showDelimitersAtPosition;
87 newDiagram->d->showLabelsAtPosition = d->showLabelsAtPosition;
88 return newDiagram;
89 }
59 {
60 return static_cast<int>( numberOfValuesPerDataset() );
61 }
217 {
Returns:
The coordinate plane associated with the diagram.
126 {
127 return d->plane;
128 }
Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these
values).
This method returns a chached result of calculations done by calculateDataBoundaries. Classes derived
from AbstractDiagram must implement the calculateDataBoundaries function, to specify their own way of
calculating the data boundaries. If derived classes want to force recalculation of the data boundaries, they
can call setDataBoundariesDirty()
Returned value is in diagram coordinates.
Definition at line 130 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::calculateDataBoundaries(), and d.
Referenced by KDChart::CartesianCoordinatePlane::calculateRawDataBoundingRect(), KDChart::Polar-
CoordinatePlane::layoutDiagrams(), KDChart::LineDiagram::paint(), and KDChart::BarDiagram::paint().
131 {
132 if( d->databoundariesDirty ){
133 d->databoundaries = calculateDataBoundaries ();
134 d->databoundariesDirty = false;
135 }
136 return d->databoundaries;
137 }
[reimplemented]
Definition at line 232 of file KDChartAbstractDiagram.cpp.
References d.
232 {
233 // We are still too dumb to do intelligent updates...
234 d->databoundariesDirty = true;
235 scheduleDelayedItemsLayout();
236 }
237
238 void AbstractDiagram::setDataValueAttributes( const QModelIndex & index,
The set of dataset brushes currently used, for use in legends, etc.
Note:
Cell-level override brushes, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the brush, that is used for a single cell.
Returns:
The current set of dataset brushes.
712 {
713 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( i, Qt::Vertical, DatasetB
714 ret << brush;
715 }
716
717 return ret;
718 }
719
720 QList<QPen> AbstractDiagram::datasetPens() const
The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to
have.
For each dimension it will expect one column of values in the model. If the dimensionality is 1, automatic
values will be used for the abscissa.
For example a diagram with the default dimension of 1, will have one column per datapoint (the y values)
and will use automatic values for the x axis (1, 2, 3, ... n). If the dimension is 2, the diagram will use the
first, (and the third, fifth, etc) columns as X values, and the second, (and the fourth, sixth, etc) column as Y
values.
Returns:
The dataset dimension of the diagram.
762 {
The set of dataset labels currently displayed, for use in legends, etc.
Returns:
The set of dataset labels currently displayed.
The set of dataset markers currently used, for use in legends, etc.
Note:
Cell-level override markers, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the marker, that is shown for a single cell.
Returns:
The current set of dataset brushes.
735 {
736 DataValueAttributes a =
737 qVariantValue<DataValueAttributes>( attributesModel()->headerData( i, Qt::Vertical, DataVa
738 const MarkerAttributes &ma = a.markerAttributes();
739 ret << ma;
740 }
741 return ret;
742 }
743
744 bool AbstractDiagram::checkInvariants( bool justReturnTheStatus ) const
The set of dataset pens currently used, for use in legends, etc.
Note:
Cell-level override pens, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the pens, that is used for a single cell.
Returns:
The current set of dataset pens.
724 {
725 QPen pen = qVariantValue<QPen>( attributesModel()->headerData( i, Qt::Vertical, DatasetPenRole
726 ret << pen;
727 }
728 return ret;
729 }
730
731 QList<MarkerAttributes> AbstractDiagram::datasetMarkers() const
Parameters:
index The datapoint to retrieve the attributes for.
Returns:
The DataValueAttributes for the given index.
278 {
Parameters:
dataset The dataset to retrieve the attributes for.
Returns:
The DataValueAttributes for the given dataset.
271 {
Returns:
The global DataValueAttributes.
264 {
[reimplemented]
Definition at line 223 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::update().
223 {
224 d->plane->layoutDiagrams();
225 update();
226 }
227 QAbstractItemView::doItemsLayout();
228 }
229
230 void AbstractDiagram::dataChanged( const QModelIndex &topLeft,
[reimplemented]
Definition at line 655 of file KDChartAbstractDiagram.cpp.
657 { return 0; }
[reimplemented]
Definition at line 649 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 661 of file KDChartAbstractDiagram.cpp.
663 {}
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Returns:
The set of item row labels currently displayed.
This signal is emitted, when either the model or the AttributesModel is replaced.
Referenced by KDChart::AbstractDiagram::setAttributesModel(), and KDChart::AbstractDiagram::set-
Model().
[reimplemented]
Definition at line 652 of file KDChartAbstractDiagram.cpp.
654 { return 0; }
[reimplemented]
Implements KDChart::AbstractPolarDiagram.
Definition at line 189 of file KDChartPolarDiagram.cpp.
190 {
191 return 5; // FIXME
192 }
[reimplemented]
Implements KDChart::AbstractPolarDiagram.
Definition at line 183 of file KDChartPolarDiagram.cpp.
184 {
185 return model()->rowCount(rootIndex());
186 }
[reimplemented]
Implements KDChart::AbstractDiagram.
Definition at line 136 of file KDChartPolarDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::check-
Invariants(), KDChart::AbstractDiagram::coordinatePlane(), KDChart::AttributesModel::headerData(),
KDChart::AbstractDiagram::paintDataValueText(), KDChart::PaintContext::painter(), paintPolar-
Markers(), KDChart::PaintContext::rectangle(), and KDChart::AbstractCoordinatePlane::translate().
Referenced by paintEvent().
137 {
138 if ( !checkInvariants() )
139 return;
140 const int rowCount = model()->rowCount( rootIndex() );
141 const int colCount = model()->columnCount( rootIndex() );
142 DataValueTextInfoList list;
143
144 for ( int j=0; j < colCount; ++j ) {
145 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( j, Qt::Vertical, KDChart:
146 QPolygonF polygon;
147 for ( int i=0; i < rowCount; ++i ) {
148 QModelIndex index = model()->index( i, j, rootIndex() );
149 const double value = model()->data( index ).toDouble();
150 QPointF point = coordinatePlane()->translate( QPointF( value, i ) );
151 polygon.append( point );
152 list.append( DataValueTextInfo( index, point, value ) );
153 }
154 PainterSaver painterSaver( ctx->painter() );
155 ctx->painter()->setRenderHint ( QPainter::Antialiasing );
156 ctx->painter()->setBrush( brush );
157 QPen p( ctx->painter()->pen() );
158 p.setColor( brush.color() ); // FIXME use DatasetPenRole
159 p.setWidth( 2 );// FIXME properties
160 ctx->painter()->setPen( p );
161 polygon.translate( ctx->rectangle().topLeft() );
162 ctx->painter()->drawPolyline( polygon );
163 paintPolarMarkers( ctx, polygon );
164 }
165 DataValueTextInfoListIterator it( list );
166 while ( it.hasNext() ) {
167 const DataValueTextInfo& info = it.next();
168 paintDataValueText( ctx->painter(), info.index, info.pos, info.value );
169 }
170 }
320 {
321 // paint one data series
322 DataValueAttributes a = dataValueAttributes(index);
323 if ( !a.isVisible() ) return;
324
325 // handle decimal digits
326 int decimalDigits = a.decimalDigits();
327 int decimalPos = QString::number( value ).indexOf( QLatin1Char( ’.’ ) );
328 QString roundedValue;
329 if ( a.dataLabel().isNull() ) {
330 if ( decimalPos > 0 && value != 0 )
331 roundedValue = roundValues ( value, decimalPos, decimalDigits );
332 else
333 roundedValue = QString::number( value );
334 } else
335 roundedValue = a.dataLabel();
336 // handle prefix and suffix
337 if ( !a.prefix().isNull() )
338 roundedValue.prepend( a.prefix() );
339
340 if ( !a.suffix().isNull() )
341 roundedValue.append( a.suffix() );
342
343 PainterSaver painterSaver( painter );
344 // FIXME draw the non-text bits, background, etc
345 const TextAttributes &ta = a.textAttributes();
346 if ( ta.isVisible() ) {
347 painter->setPen( ta.pen() );
348 painter->setFont( ta.font() );
349 painter->translate( pos );
350 painter->rotate( ta.rotation() );
351 painter->drawText( QPointF(0, 0), roundedValue );
352 }
353 }
354
355 QString AbstractDiagram::roundValues( double value,
385 {
386 for ( int j=0; j< rowCount; ++j ) {
387 const QModelIndex index = model()->index( j, i, rootIndex() );
388 double value = model()->data( index ).toDouble();
389 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
390 paintDataValueText( painter, index, pos, value );
391 }
392 }
393 }
394
395
113 {
399 {
400
401 if ( !checkInvariants() ) return;
402 DataValueAttributes a = dataValueAttributes(index);
403 if ( !a.isVisible() ) return;
404 const MarkerAttributes &ma = a.markerAttributes();
405 if ( !ma.isVisible() ) return;
406
407 PainterSaver painterSaver( painter );
408 QSizeF maSize( ma.markerSize() );
409 QBrush indexBrush( brush( index ) );
410 QPen indexPen( ma.pen() );
411 if ( ma.markerColor().isValid() )
412 indexBrush.setColor( ma.markerColor() );
413
414 paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
415 }
416
417
424 {
425 PainterSaver painterSaver( painter );
426 painter->setBrush( brush );
427 painter->setPen( pen );
428 painter->setRenderHint ( QPainter::Antialiasing );
429 painter->translate( pos );
430 switch ( markerAttributes.markerStyle() ) {
431 case MarkerAttributes::MarkerCircle:
432 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
433 maSize.height(), maSize.width()) );
434 break;
435 case MarkerAttributes::MarkerSquare:
436 {
437 QRectF rect( 0 - maSize.height()/2, 0 - maSize.width()/2,
438 maSize.height(), maSize.width() );
439 painter->drawRect( rect );
440 painter->fillRect( rect, painter->brush() );
441 break;
442 }
443 case MarkerAttributes::MarkerDiamond:
444 {
445 QVector <QPointF > diamondPoints;
446 QPointF top, left, bottom, right;
447 top = QPointF( 0, 0 - maSize.height()/2 );
448 left = QPointF( 0 - maSize.width()/2, 0 );
449 bottom = QPointF( 0, maSize.height()/2 );
450 right = QPointF( maSize.width()/2, 0 );
451 diamondPoints << top << left << bottom << right;
452 painter->drawPolygon( diamondPoints );
453 break;
454 }
455 //Pending Michel: do we need that? Ask: What is the idea about
456 // Marker1Pixel and Marker4Pixels.
457 case MarkerAttributes::Marker1Pixel:
458 {
459 QSizeF pSize(4,4);
460 QPen pen1Pixel;
461 pen1Pixel.setColor( painter->background().color() );
462 QRectF centerRect( -pSize.height()/2, -pSize.width()/2,
463 pSize.height(), pSize.width() );
464 painter->setPen( pen1Pixel );
465 painter->drawEllipse( centerRect );
466 break;
467 }
468 case MarkerAttributes::Marker4Pixels:
469 {
470 QSizeF pSize(8, 8);
471 QPen pen4Pixel;
472 pen4Pixel.setColor( painter->background().color() );
473 QRectF centerRect( -pSize.height()/2, -pSize.width()/2,
474 pSize.height(), pSize.width() );
475 painter->setPen( pen4Pixel );
476 painter->drawEllipse( centerRect );
477 break;
478 }
479 case MarkerAttributes::MarkerRing:
480 {
481 painter->setBrush( Qt::NoBrush );
482 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
483 maSize.height(), maSize.width()) );
484 break;
485 }
486 case MarkerAttributes::MarkerCross:
487 {
488 QVector <QPointF > crossPoints;
489 QPointF leftTop, leftBottom, centerBottomLeft, bottomLeft, bottomRight,
490 centerBottomRight,rightBottom, rightTop, centerTopRight, topRight, topLeft,
491 centerTopLeft;
492 leftTop = QPointF( -maSize.width()/2, -maSize.height()/4 );
493 leftBottom = QPointF( -maSize.width()/2, maSize.height()/4 );
494 centerBottomLeft = QPointF( -maSize.width()/4, maSize.height()/4 );
495 bottomLeft = QPointF( -maSize.width()/4, maSize.height()/2 );
496 bottomRight = QPointF( maSize.width()/4, maSize.height()/2 );
497 centerBottomRight = QPointF( maSize.width()/4, maSize.height()/4 );
498 rightBottom = QPointF( maSize.width()/2, maSize.height()/4 );
499 rightTop = QPointF( maSize.width()/2, -maSize.height()/4 );
500 centerTopRight = QPointF( maSize.width()/4, -maSize.height()/4 );
535 {
536 for ( int j=0; j< rowCount; ++j ) {
537 const QModelIndex index = model()->index( j, i, rootIndex() );
538 double value = model()->data( index ).toDouble();
539 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
540 paintMarker( painter, index, pos );
541 }
542 }
543 }
544
545
126 {
127 const double markerSize = 4; // FIXME use real markers
128 for ( int i=0; i<polygon.size(); ++i ) {
Retrieve the pen to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The pen to use for painting.
593 {
Parameters:
dataset The dataset to retrieve the pen for.
Returns:
The pen to use for painting.
585 {
Returns:
The pen to use for painting.
577 {
320 {
54 {
55 return dynamic_cast<const PolarCoordinatePlane*>( coordinatePlane() );
56 }
[reimplemented]
Implements KDChart::AbstractDiagram.
Definition at line 172 of file KDChartPolarDiagram.cpp.
173 {
174 }
122 {
123 }
210 {
211 return d->rotateCircularLabels;
212 }
[reimplemented]
Definition at line 646 of file KDChartAbstractDiagram.cpp.
Parameters:
allow True means that overlapping labels are allowed.
290 {
Parameters:
enabled True means that AA is enabled.
301 {
Wrong:
diagram1->setAttributesModel( diagram2->attributesModel() );
Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel
161 {
162 if( amodel->sourceModel() != model() ) {
163 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
164 "Trying to set an attributesmodel which works on a different "
165 "model than the diagram.");
166 return;
167 }
168 if( qobject_cast<PrivateAttributesModel*>(amodel) ) {
169 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
170 "Trying to set an attributesmodel that is private to another diagram.");
171 return;
172 }
173 d->setAttributesModel(amodel);
174 scheduleDelayedItemsLayout();
175 d->databoundariesDirty = true;
176 emit modelsChanged();
177 }
Set the brush to be used, for painting all datasets in the model.
Parameters:
brush The brush to use.
608 {
6.42.2.56 void AbstractDiagram::setBrush (int dataset, const QBrush & brush) [inherited]
Parameters:
dataset The dataset’s column in the model.
pen The brush to use.
617 {
6.42.2.57 void AbstractDiagram::setBrush (const QModelIndex & index, const QBrush & brush)
[inherited]
Set the brush to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
brush The brush to use.
601 {
Returns:
The coordinate plane associated with the diagram.
Reimplemented in KDChart::AbstractCartesianDiagram.
Definition at line 218 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::AbstractCartesian-
Diagram::setCoordinatePlane(), and KDChart::AbstractCoordinatePlane::takeDiagram().
222 {
140 {
141 d->databoundariesDirty = true;
142 }
See also:
datasetDimension.
Parameters:
dimension
770 {
Parameters:
a The attributes to set.
284 {
Parameters:
dataset The dataset to set the attributes for.
259 {
Parameters:
index The datapoint to set the attributes for.
a The attributes to set.
240 {
241 d->attributesModel->setData(
242 d->attributesModel->mapFromSource( index ),
243 qVariantFromValue( a ),
244 DataValueLabelAttributesRole );
245 emit propertiesChanged();
246 }
247
248
145 {
146 QAbstractItemView::setModel( newModel );
147 AttributesModel* amodel = new PrivateAttributesModel( newModel, this );
148 amodel->initFrom( d->attributesModel );
149 d->setAttributesModel(amodel);
150 scheduleDelayedItemsLayout();
151 d->databoundariesDirty = true;
152 emit modelsChanged();
153 }
Set the pen to be used, for painting all datasets in the model.
Parameters:
pen The pen to use.
562 {
6.42.2.66 void AbstractDiagram::setPen (int dataset, const QPen & pen) [inherited]
Parameters:
dataset The dataset’s row in the model.
pen The pen to use.
571 {
6.42.2.67 void AbstractDiagram::setPen (const QModelIndex & index, const QPen & pen)
[inherited]
Set the pen to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
pen The pen to use.
555 {
312 {
Set the root index in the model, where the diagram starts referencing data for display.
[reimplemented]
Definition at line 188 of file KDChartAbstractDiagram.cpp.
References d.
205 {
206 d->rotateCircularLabels = rotateCircularLabels;
207 }
[reimplemented]
Definition at line 664 of file KDChartAbstractDiagram.cpp.
216 {
217 d->showDelimitersAtPosition[position.value()] = showDelimiters;
218 }
222 {
223 d->showLabelsAtPosition[position.value()] = showLabels;
224 }
195 {
196 d->zeroDegreePosition = degrees;
197 }
227 {
228 return d->showDelimitersAtPosition[position.value()];
229 }
232 {
233 return d->showLabelsAtPosition[position.value()];
234 }
Set the palette to be used, for painting datasets to the default palette.
See also:
KDChart::Palette. FIXME: fold into one usePalette (KDChart::Palette&) method
675 {
Set the palette to be used, for painting datasets to the rainbow palette.
See also:
KDChart::Palette.
685 {
Set the palette to be used, for painting datasets to the subdued palette.
See also:
KDChart::Palette.
680 {
Helper method, retrieving the data value (DisplayRole) for a given row and column.
Parameters:
row The row to query.
column The column to query.
Returns:
The value of the display role at the given row and column as a double.
776 {
[reimplemented]
Implements KDChart::AbstractPolarDiagram.
Definition at line 177 of file KDChartPolarDiagram.cpp.
178 {
179 return model()->rowCount(rootIndex());
180 }
[reimplemented]
Definition at line 658 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 641 of file KDChartAbstractDiagram.cpp.
645 {}
[reimplemented]
Definition at line 667 of file KDChartAbstractDiagram.cpp.
200 {
201 return d->zeroDegreePosition;
202 }
• KDChartPolarDiagram.h
• KDChartPolarDiagram.cpp
switch( yourPosition().value() ) {
case KDChartEnums::PositionNorthWest:
// your code ...
break;
case KDChartEnums::PositionNorth:
// your code ...
break;
}
See also:
RelativePosition, KDChartEnums::PositionValue
Public Types
• enum Option {
IncludeCenter = 0,
ExcludeCenter = 1 }
• Position ()
Default constructor.
Enumeration values:
IncludeCenter
ExcludeCenter
6.43.3.1 Position::Position ()
Default constructor.
Creates a new Position, defaulting it to Position::Unknown.
Definition at line 97 of file KDChartPosition.cpp.
Referenced by fromName(), and printableNames().
98 : m_value( KDChartEnums::PositionUnknown )
99 {
100
101 }
Constructor.
Creates a new Position, defaulting it to the respective value.
Valid values ranging from zero (unknown value) to 10. If invalid value is passed, a Position::Unknown is
created.
Note:
Normally there is no need to call this constructor, but you would rather use one of the nine pre-defined,
static values, e.g. like this:
230 {
231 return fromName( name.data() );
232 }
223 {
224 for( int i=1; i<=maxPositionValue; ++i)
225 if ( !qstricmp( name, staticPositionNames[i] ) )
226 return Position(i);
227 return Position(0);
228 }
161 {
162 return m_value == Position::NorthWest.value() ||
163 m_value == Position::NorthEast.value() ||
164 m_value == Position::SouthEast.value() ||
165 m_value == Position::SouthWest.value();
166 }
148 {
149 return m_value == Position::NorthEast.value() ||
150 m_value == Position::East.value() ||
151 m_value == Position::SouthEast.value();
152 }
142 {
143 return m_value == Position::NorthWest.value() ||
144 m_value == Position::North.value() ||
145 m_value == Position::NorthEast.value();
146 }
168 {
169 return m_value == Position::North.value() ||
170 m_value == Position::South.value();
171 }
154 {
155 return m_value == Position::SouthWest.value() ||
156 m_value == Position::South.value() ||
157 m_value == Position::SouthEast.value();
158 }
136 {
137 return m_value == Position::SouthWest.value() ||
138 m_value == Position::West.value() ||
139 m_value == Position::NorthWest.value();
140 }
177 {
178 return staticPositionNames[m_value];
179 }
Parameters:
options if set to ExcludeCenter, the returned list does not contain the Center position.
198 {
199 QList<QByteArray> list;
200 const int start = ( options & IncludeCenter ) ? 1 : 2;
201 for( int i=start; i<=maxPositionValue; ++i)
202 list.append( staticPositionNames[i] );
203 return list;
204 }
241 {
242 return ( value() == value_ );
243 }
235 {
236 return ( value() == r.value() );
237 }
185 {
186 return tr(staticPositionNames[m_value]);
187 }
Parameters:
options if set to ExcludeCenter, the returned list does not contain the Center position.
214 {
215 QStringList list;
216 const int start = ( options & IncludeCenter ) ? 1 : 2;
217 for( int i=start; i<=maxPositionValue; ++i)
218 list.append( Position(i).printableName() );
219 return list;
220 }
131 {
132 return static_cast<KDChartEnums::PositionValue>( m_value );
133 }
• KDChartPosition.h
• KDChartPosition.cpp
• KDChartAbstractDiagram.h
• KDChartAbstractProxyModel.h
• KDChartDatasetSelector.h
• KDChartLayoutItems.h
• KDChartAbstractArea.h
• KDChartDatasetProxyModel.h
• KDTextDocument.h
• KDChartAbstractAreaWidget.h
Defines relative position information: reference area, position in this area, horizontal / vertical padding,
and rotating.
Using RelativePosition you can specify the relative parts of some position information, and you can specify
the absolute parts: the reference area, and the position in this area. To get an absolute position, you will
need to declare both, the relative and the absolute parts, otherwise the specification is incomplete and KD
Chart will ignore it.
Definition at line 56 of file KDChartRelativePosition.h.
6.52.2.1 KDChart::RelativePosition::RelativePosition ()
6.52.2.3 KDChart::RelativePosition::∼RelativePosition ()
Referenced by operator<<().
Referenced by operator<<().
Referenced by operator!=().
Referenced by operator<<().
Referenced by operator<<().
Referenced by operator<<().
Referenced by operator<<().
The documentation for this class was generated from the following file:
• KDChartRelativePosition.h
• void useRainbowColors ()
Set the palette to be used, for painting datasets to the rainbow palette.
• void useSubduedColors ()
Set the palette to be used, for painting datasets to the subdued palette.
• virtual ∼RingDiagram ()
• void paintDataValueText (QPainter ∗painter, const QModelIndex &index, const QPointF &pos, dou-
ble value)
• virtual void paintDataValueTexts (QPainter ∗painter)
• void paintEvent (QPaintEvent ∗)
• void paintMarker (QPainter ∗painter, const QModelIndex &index, const QPointF &pos)
• virtual void paintMarkers (QPainter ∗painter)
• void propertiesChanged ()
Emitted upon change of a property of the Diagram.
Protected Attributes
• Q_SIGNALS __pad0__: void layoutChanged( AbstractDiagram∗ )
50 :
51 AbstractPieDiagram( new Private(), parent, plane )
52 {
53 init();
54 }
57 {
58 }
Returns:
Whether data value labels are allowed to overlap.
295 {
Returns:
Whether anti-aliasing is to be used for rendering this diagram.
306 {
Returns:
The AttributesModel associated with the diagram.
See also:
setAttributesModel
181 {
182 return d->attributesModel;
183 }
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the diagram.
Definition at line 204 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::LineDiagram::calculateDataBoundaries(), KDChart::BarDiagram::calculate-
DataBoundaries(), KDChart::LineDiagram::numberOfAbscissaSegments(), KDChart::Bar-
Diagram::numberOfAbscissaSegments(), KDChart::LineDiagram::numberOfOrdinateSegments(),
KDChart::BarDiagram::numberOfOrdinateSegments(), KDChart::LineDiagram::paint(), KDChart::Bar-
Diagram::paint(), and KDChart::AbstractDiagram::valueForCell().
210 {
Retrieve the brush to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The brush to use for painting.
638 :
QRect AbstractDiagram::visualRect(const QModelIndex &) const
Parameters:
dataset The dataset to retrieve the brush for.
Returns:
The brush to use for painting.
631 {
Returns:
The brush to use for painting.
623 {
[reimplemented]
Implements KDChart::AbstractDiagram.
Definition at line 79 of file KDChartRingDiagram.cpp.
References KDChart::AbstractDiagram::checkInvariants().
80 {
81 if ( !checkInvariants() ) return QPair<QPointF, QPointF>( QPointF( 0, 0 ), QPointF( 0, 0 ) );
82
83 QPointF bottomLeft ( QPointF( 0, 0 ) );
84 QPointF topRight ( QPointF( 1, 1 ) );
85 return QPair<QPointF, QPointF> ( bottomLeft, topRight );
86 }
746 {
747 Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
748 "There is no usable model set, for the diagram." );
749
750 Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
751 "There is no usable coordinate plane set, for the diagram." );
752 }
753 return model() && coordinatePlane();
754 }
755
756 int AbstractDiagram::datasetDimension( ) const
65 {
66 return new RingDiagram( new Private( *d ) );
67 }
59 {
60 return static_cast<int>( numberOfValuesPerDataset() );
61 }
217 {
Returns:
The coordinate plane associated with the diagram.
126 {
127 return d->plane;
128 }
Return the bottom left and top right data point, that the diagram will display (unless the grid adjusts these
values).
This method returns a chached result of calculations done by calculateDataBoundaries. Classes derived
from AbstractDiagram must implement the calculateDataBoundaries function, to specify their own way of
calculating the data boundaries. If derived classes want to force recalculation of the data boundaries, they
can call setDataBoundariesDirty()
Returned value is in diagram coordinates.
Definition at line 130 of file KDChartAbstractDiagram.cpp.
References KDChart::AbstractDiagram::calculateDataBoundaries(), and d.
Referenced by KDChart::CartesianCoordinatePlane::calculateRawDataBoundingRect(), KDChart::Polar-
CoordinatePlane::layoutDiagrams(), KDChart::LineDiagram::paint(), and KDChart::BarDiagram::paint().
131 {
132 if( d->databoundariesDirty ){
133 d->databoundaries = calculateDataBoundaries ();
134 d->databoundariesDirty = false;
135 }
136 return d->databoundaries;
137 }
[reimplemented]
Definition at line 232 of file KDChartAbstractDiagram.cpp.
References d.
232 {
233 // We are still too dumb to do intelligent updates...
234 d->databoundariesDirty = true;
235 scheduleDelayedItemsLayout();
236 }
237
238 void AbstractDiagram::setDataValueAttributes( const QModelIndex & index,
The set of dataset brushes currently used, for use in legends, etc.
Note:
Cell-level override brushes, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the brush, that is used for a single cell.
Returns:
The current set of dataset brushes.
712 {
713 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( i, Qt::Vertical, DatasetB
714 ret << brush;
715 }
716
717 return ret;
718 }
719
720 QList<QPen> AbstractDiagram::datasetPens() const
The dataset dimension of a diagram determines, how many value dimensions it expects each datapoint to
have.
For each dimension it will expect one column of values in the model. If the dimensionality is 1, automatic
values will be used for the abscissa.
For example a diagram with the default dimension of 1, will have one column per datapoint (the y values)
and will use automatic values for the x axis (1, 2, 3, ... n). If the dimension is 2, the diagram will use the
first, (and the third, fifth, etc) columns as X values, and the second, (and the fourth, sixth, etc) column as Y
values.
Returns:
The dataset dimension of the diagram.
762 {
The set of dataset labels currently displayed, for use in legends, etc.
Returns:
The set of dataset labels currently displayed.
The set of dataset markers currently used, for use in legends, etc.
Note:
Cell-level override markers, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the marker, that is shown for a single cell.
Returns:
The current set of dataset brushes.
735 {
736 DataValueAttributes a =
737 qVariantValue<DataValueAttributes>( attributesModel()->headerData( i, Qt::Vertical, DataVa
738 const MarkerAttributes &ma = a.markerAttributes();
739 ret << ma;
740 }
741 return ret;
742 }
743
744 bool AbstractDiagram::checkInvariants( bool justReturnTheStatus ) const
The set of dataset pens currently used, for use in legends, etc.
Note:
Cell-level override pens, if set, take precedence over the dataset values, so you might need to check
these too, in order to find the pens, that is used for a single cell.
Returns:
The current set of dataset pens.
724 {
725 QPen pen = qVariantValue<QPen>( attributesModel()->headerData( i, Qt::Vertical, DatasetPenRole
726 ret << pen;
727 }
728 return ret;
729 }
730
731 QList<MarkerAttributes> AbstractDiagram::datasetMarkers() const
Parameters:
index The datapoint to retrieve the attributes for.
Returns:
The DataValueAttributes for the given index.
278 {
Parameters:
dataset The dataset to retrieve the attributes for.
Returns:
The DataValueAttributes for the given dataset.
271 {
Returns:
The global DataValueAttributes.
264 {
[reimplemented]
Definition at line 223 of file KDChartAbstractDiagram.cpp.
References d, and KDChart::AbstractDiagram::update().
223 {
224 d->plane->layoutDiagrams();
225 update();
226 }
227 QAbstractItemView::doItemsLayout();
228 }
229
230 void AbstractDiagram::dataChanged( const QModelIndex &topLeft,
Returns:
the granularity.
82 {
83 return (d->granularity < 0.05 || d->granularity > 36.0)
84 ? 1.0
85 : d->granularity;
86 }
[reimplemented]
Definition at line 655 of file KDChartAbstractDiagram.cpp.
657 { return 0; }
[reimplemented]
Definition at line 649 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 661 of file KDChartAbstractDiagram.cpp.
663 {}
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Returns:
The set of item row labels currently displayed.
This signal is emitted, when either the model or the AttributesModel is replaced.
Referenced by KDChart::AbstractDiagram::setAttributesModel(), and KDChart::AbstractDiagram::set-
Model().
[reimplemented]
Definition at line 652 of file KDChartAbstractDiagram.cpp.
654 { return 0; }
[reimplemented]
Implements KDChart::AbstractPolarDiagram.
Definition at line 146 of file KDChartRingDiagram.cpp.
147 {
148 return 1;
149 }
[reimplemented]
Implements KDChart::AbstractPolarDiagram.
Definition at line 140 of file KDChartRingDiagram.cpp.
141 {
142 return model()->columnCount(rootIndex());
143 }
[reimplemented]
Implements KDChart::AbstractDiagram.
Definition at line 101 of file KDChartRingDiagram.cpp.
References KDChart::AbstractDiagram::attributesModel(), KDChart::AbstractDiagram::check-
Invariants(), KDChart::AttributesModel::headerData(), KDChart::AbstractDiagram::paintDataValue-
Text(), and KDChart::PaintContext::painter().
Referenced by paintEvent().
102 {
103 if ( !checkInvariants() ) return;
104 const int colCount = model()->columnCount(rootIndex());
105 DataValueTextInfoList list;
106 for ( int j=0; j<colCount; ++j ) {
107 QBrush brush = qVariantValue<QBrush>( attributesModel()->headerData( j, Qt::Vertical, KDChart:
108 PainterSaver painterSaver( ctx->painter() );
109 ctx->painter()->setRenderHint ( QPainter::Antialiasing );
110 ctx->painter()->setBrush( brush );
111 QPen p( ctx->painter()->pen() );
112 p.setColor( brush.color() );
113 p.setWidth( 2 );// FIXME properties, use DatasetPenRole
114 ctx->painter()->setPen( p );
115 //ctx->painter()->drawPolyline( polygon );
116 }
117 DataValueTextInfoListIterator it( list );
118 while ( it.hasNext() ) {
119 const DataValueTextInfo& info = it.next();
120 paintDataValueText( ctx->painter(), info.index, info.pos, info.value );
121 }
122 }
320 {
321 // paint one data series
322 DataValueAttributes a = dataValueAttributes(index);
323 if ( !a.isVisible() ) return;
324
325 // handle decimal digits
326 int decimalDigits = a.decimalDigits();
327 int decimalPos = QString::number( value ).indexOf( QLatin1Char( ’.’ ) );
328 QString roundedValue;
329 if ( a.dataLabel().isNull() ) {
330 if ( decimalPos > 0 && value != 0 )
331 roundedValue = roundValues ( value, decimalPos, decimalDigits );
332 else
333 roundedValue = QString::number( value );
334 } else
335 roundedValue = a.dataLabel();
336 // handle prefix and suffix
337 if ( !a.prefix().isNull() )
338 roundedValue.prepend( a.prefix() );
339
340 if ( !a.suffix().isNull() )
341 roundedValue.append( a.suffix() );
342
343 PainterSaver painterSaver( painter );
344 // FIXME draw the non-text bits, background, etc
345 const TextAttributes &ta = a.textAttributes();
346 if ( ta.isVisible() ) {
347 painter->setPen( ta.pen() );
348 painter->setFont( ta.font() );
349 painter->translate( pos );
350 painter->rotate( ta.rotation() );
351 painter->drawText( QPointF(0, 0), roundedValue );
352 }
353 }
354
355 QString AbstractDiagram::roundValues( double value,
385 {
386 for ( int j=0; j< rowCount; ++j ) {
387 const QModelIndex index = model()->index( j, i, rootIndex() );
388 double value = model()->data( index ).toDouble();
389 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
390 paintDataValueText( painter, index, pos, value );
391 }
392 }
393 }
394
395
89 {
90 QPainter painter ( viewport() );
91 PaintContext ctx;
92 ctx.setPainter ( &painter );
93 ctx.setRectangle( QRectF ( 0, 0, width(), height() ) );
94 paint ( &ctx );
95 }
399 {
400
401 if ( !checkInvariants() ) return;
402 DataValueAttributes a = dataValueAttributes(index);
403 if ( !a.isVisible() ) return;
404 const MarkerAttributes &ma = a.markerAttributes();
405 if ( !ma.isVisible() ) return;
406
407 PainterSaver painterSaver( painter );
408 QSizeF maSize( ma.markerSize() );
409 QBrush indexBrush( brush( index ) );
410 QPen indexPen( ma.pen() );
411 if ( ma.markerColor().isValid() )
412 indexBrush.setColor( ma.markerColor() );
413
414 paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
415 }
416
417
424 {
425 PainterSaver painterSaver( painter );
426 painter->setBrush( brush );
427 painter->setPen( pen );
428 painter->setRenderHint ( QPainter::Antialiasing );
429 painter->translate( pos );
430 switch ( markerAttributes.markerStyle() ) {
431 case MarkerAttributes::MarkerCircle:
432 painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
535 {
536 for ( int j=0; j< rowCount; ++j ) {
537 const QModelIndex index = model()->index( j, i, rootIndex() );
538 double value = model()->data( index ).toDouble();
539 const QPointF pos = coordinatePlane()->translate( QPointF( j, value ) );
540 paintMarker( painter, index, pos );
541 }
542 }
543 }
544
545
Retrieve the pen to be used, for painting the datapoint at the given index in the model.
Parameters:
index The index of the datapoint in the model.
Returns:
The pen to use for painting.
593 {
Parameters:
dataset The dataset to retrieve the pen for.
Returns:
The pen to use for painting.
585 {
Returns:
The pen to use for painting.
577 {
320 {
123 {
124 return qVariantValue<PieAttributes>(
125 d->attributesModel->data(
126 d->attributesModel->mapFromSource( index ),
127 PieAttributesRole ) );
128 }
115 {
116 return qVariantValue<PieAttributes>(
117 d->attributesModel->data(
118 d->attributesModel->mapFromSource( columnToIndex( column ) ).column(),
119 PieAttributesRole ) );
120 }
106 {
107 return qVariantValue<PieAttributes>(
108 d->attributesModel->data( PieAttributesRole ) );
109 }
54 {
55 return dynamic_cast<const PolarCoordinatePlane*>( coordinatePlane() );
56 }
75 {
76 return d->relativeThickness;
77 }
[reimplemented]
Implements KDChart::AbstractDiagram.
Definition at line 124 of file KDChartRingDiagram.cpp.
125 {
126 }
98 {
99 }
[reimplemented]
Definition at line 646 of file KDChartAbstractDiagram.cpp.
Parameters:
allow True means that overlapping labels are allowed.
290 {
Parameters:
enabled True means that AA is enabled.
301 {
Wrong:
diagram1->setAttributesModel( diagram2->attributesModel() );
Parameters:
model The AttributesModel to use for this diagram.
See also:
AttributesModel
161 {
162 if( amodel->sourceModel() != model() ) {
163 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
164 "Trying to set an attributesmodel which works on a different "
165 "model than the diagram.");
166 return;
167 }
168 if( qobject_cast<PrivateAttributesModel*>(amodel) ) {
169 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
170 "Trying to set an attributesmodel that is private to another diagram.");
171 return;
172 }
173 d->setAttributesModel(amodel);
174 scheduleDelayedItemsLayout();
175 d->databoundariesDirty = true;
176 emit modelsChanged();
177 }
Set the brush to be used, for painting all datasets in the model.
Parameters:
brush The brush to use.
608 {
6.53.2.59 void AbstractDiagram::setBrush (int dataset, const QBrush & brush) [inherited]
Parameters:
dataset The dataset’s column in the model.
pen The brush to use.
617 {
6.53.2.60 void AbstractDiagram::setBrush (const QModelIndex & index, const QBrush & brush)
[inherited]
Set the brush to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
brush The brush to use.
601 {
Returns:
The coordinate plane associated with the diagram.
Reimplemented in KDChart::AbstractCartesianDiagram.
Definition at line 218 of file KDChartAbstractDiagram.cpp.
References d.
Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::AbstractCartesian-
Diagram::setCoordinatePlane(), and KDChart::AbstractCoordinatePlane::takeDiagram().
222 {
140 {
141 d->databoundariesDirty = true;
142 }
See also:
datasetDimension.
Parameters:
dimension
770 {
Parameters:
a The attributes to set.
284 {
Parameters:
dataset The dataset to set the attributes for.
a The attributes to set.
259 {
Parameters:
index The datapoint to set the attributes for.
a The attributes to set.
240 {
241 d->attributesModel->setData(
242 d->attributesModel->mapFromSource( index ),
243 qVariantFromValue( a ),
244 DataValueLabelAttributesRole );
245 emit propertiesChanged();
246 }
247
248
Set the granularity: the smaller the granularity the more your diagram segments will show facettes instead
of rounded segments.
Parameters:
value the granularity value between 0.05 (one twentieth of a degree) and 36.0 (one tenth of a full
circle), other values will be interpreted as 1.0.
77 {
78 d->granularity = value;
79 }
145 {
146 QAbstractItemView::setModel( newModel );
147 AttributesModel* amodel = new PrivateAttributesModel( newModel, this );
148 amodel->initFrom( d->attributesModel );
149 d->setAttributesModel(amodel);
150 scheduleDelayedItemsLayout();
151 d->databoundariesDirty = true;
152 emit modelsChanged();
153 }
Set the pen to be used, for painting all datasets in the model.
Parameters:
pen The pen to use.
562 {
6.53.2.70 void AbstractDiagram::setPen (int dataset, const QPen & pen) [inherited]
Parameters:
dataset The dataset’s row in the model.
571 {
6.53.2.71 void AbstractDiagram::setPen (const QModelIndex & index, const QPen & pen)
[inherited]
Set the pen to be used, for painting the datapoint at the given index.
Parameters:
index The datapoint’s index in the model.
pen The pen to use.
555 {
312 {
96 {
97 d->attributesModel->setHeaderData(
98 column, Qt::Vertical, qVariantFromValue( attrs ), PieAttributesRole );
99 emit layoutChanged( this );
100 }
90 {
91 d->attributesModel->setModelData( qVariantFromValue( attrs ), PieAttributesRole );
92 emit layoutChanged( this );
93 }
70 {
71 d->relativeThickness = relativeThickness;
72 }
Set the root index in the model, where the diagram starts referencing data for display.
[reimplemented]
Definition at line 188 of file KDChartAbstractDiagram.cpp.
References d.
[reimplemented]
Definition at line 664 of file KDChartAbstractDiagram.cpp.
66 {
67 d->startPosition = degrees;
68 }
145 {
146 model()->setData( index, qVariantFromValue( tda ), ThreeDPieAttributesRole );
147 emit layoutChanged( this );
148 }
138 {
139 d->attributesModel->setHeaderData(
140 column, Qt::Vertical, qVariantFromValue( tda ), ThreeDPieAttributesRole );
141 emit layoutChanged( this );
142 }
132 {
133 d->attributesModel->setModelData( qVariantFromValue( tda ), ThreeDPieAttributesRole );
134 emit layoutChanged( this );
135 }
Returns:
the starting angle for the first dataset.
71 {
72 return d->startPosition;
73 }
171 {
172 return qVariantValue<ThreeDPieAttributes>(
173 d->attributesModel->data(
174 d->attributesModel->mapFromSource( index ),
175 ThreeDPieAttributesRole ) );
176 }
163 {
164 return qVariantValue<ThreeDPieAttributes>(
165 d->attributesModel->data(
166 d->attributesModel->mapFromSource( columnToIndex( column ) ).column(),
167 ThreeDPieAttributesRole ) );
168 }
154 {
155 return qVariantValue<ThreeDPieAttributes>(
156 d->attributesModel->data( ThreeDPieAttributesRole ) );
157 }
Set the palette to be used, for painting datasets to the default palette.
See also:
KDChart::Palette. FIXME: fold into one usePalette (KDChart::Palette&) method
675 {
Set the palette to be used, for painting datasets to the rainbow palette.
See also:
KDChart::Palette.
685 {
Set the palette to be used, for painting datasets to the subdued palette.
See also:
KDChart::Palette.
680 {
Helper method, retrieving the data value (DisplayRole) for a given row and column.
Parameters:
row The row to query.
column The column to query.
Returns:
The value of the display role at the given row and column as a double.
776 {
[reimplemented]
Implements KDChart::AbstractPolarDiagram.
Definition at line 129 of file KDChartRingDiagram.cpp.
130 {
131 double total = 0;
132 const int colCount = model()->columnCount(rootIndex());
133 for ( int j=0; j<colCount; ++j ) {
134 total += model()->data( model()->index( 0, j, rootIndex() ) ).toDouble();
135 }
136 return total;
137 }
[reimplemented]
Definition at line 658 of file KDChartAbstractDiagram.cpp.
[reimplemented]
Definition at line 641 of file KDChartAbstractDiagram.cpp.
645 {}
[reimplemented]
Definition at line 667 of file KDChartAbstractDiagram.cpp.
• KDChartRingDiagram.h
• KDChartRingDiagram.cpp
Note:
This class inherits from AbstractAreaBase, TextLayoutItem, QObject. The reason for this tripple
inheritance is that neither AbstractAreaBase nor TextLayoutItem are QObject.
• virtual bool intersects (const TextLayoutItem &other, const QPoint &myPos, const QPoint &other-
Pos) const
• virtual bool intersects (const TextLayoutItem &other, const QPointF &myPos, const QPointF
&otherPos) const
• virtual bool isEmpty () const
pure virtual in QLayoutItem
Default impl: Paint the complete item using its layouted position and size.
• virtual ∼TextArea ()
Protected Attributes
• Q_SIGNALS __pad0__: void positionChanged( TextArea ∗ )
• QWidget ∗ mParent
• QLayout ∗ mParentLayout
61 {
62 // this bloc left empty intentionally
63 }
53 : QObject()
54 , KDChart::AbstractAreaBase()
55 , KDChart::TextLayoutItem()
56 {
57 // this bloc left empty intentionally
58 }
76 {
77 Q_UNUSED( position );
78 // PENDING(kalle) FIXME
79 qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosi
80 }
Implements KDChart::AbstractAreaBase.
Definition at line 105 of file KDChartTextArea.cpp.
References KDChart::TextLayoutItem::geometry().
Referenced by paintAll().
106 {
107 return geometry();
108 }
123 {
124 return mAutoReferenceArea;
125 }
98 {
99 return d->backgroundAttributes;
100 }
163 {
164 return 0; // Grow neither vertically nor horizontally
165 }
88 {
89 return d->frameAttributes;
90 }
168 {
169 return mRect;
170 }
176 {
177 Q_ASSERT_X ( d != 0, "AbstractAreaBase::innerRect()",
178 "Private class was not initialized!" );
179
180 const int padding
181 = d->frameAttributes.isVisible()
182 ? qMax( d->frameAttributes.padding(), 0 ) : 0;
183 return
184 QRect( QPoint(0,0), areaGeometry().size() )
185 .adjusted( padding, padding, -padding, -padding );
186 }
249 {
250 if ( mAttributes.rotation() != other.mAttributes.rotation() )
251 {
252 // that’s the code for the common case: the rotation angles don’t need to match here
253 QPolygon myPolygon( rotatedCorners() );
254 QPolygon otherPolygon( other.rotatedCorners() );
255
256 // move the polygons to their positions
257 myPolygon.translate( myPos );
258 otherPolygon.translate( otherPos );
259
260 // create regions out of it
261 QRegion myRegion( myPolygon );
262 QRegion otherRegion( otherPolygon );
263
264 // now the question - do they intersect or not?
265 return ! myRegion.intersect( otherRegion ).isEmpty();
266
267 } else {
268 // and that’s the code for the special case: the rotation angles match, which is less time con
269 const qreal angle = mAttributes.rotation() * PI / 180.0;
270 // both sizes
271 const QSizeF mySize( unrotatedSizeHint() );
272 const QSizeF otherSize( other.unrotatedSizeHint() );
273
274 // that’s myP1 relative to myPos
275 QPointF myP1( mySize.height() * sin( angle ), 0.0 );
276 // that’s otherP1 to myPos
277 QPointF otherP1 = QPointF( otherSize.height() * sin( angle ), 0.0 ) + otherPos - myPos;
278
279 // now rotate both points the negative angle around myPos
280 myP1 = QPointF( myP1.x() * cos( -angle ), myP1.x() * sin( -angle ) );
281 qreal r = sqrt( otherP1.x() * otherP1.x() + otherP1.y() * otherP1.y() );
282 otherP1 = QPointF( r * cos( -angle ), r * sin( -angle ) );
283
284 // finally we look, whether both rectangles intersect or even not
285 return QRectF( myP1, mySize ).intersects( QRectF( otherP1, otherSize ) );
286 }
287 }
244 {
245 return intersects( other, myPos.toPoint(), otherPos.toPoint() );
246 }
173 {
174 return false; // never empty, otherwise the layout item would not exist
175 }
178 {
179 return sizeHint(); // PENDING(kalle) Review, quite inflexible
180 }
183 {
184 return sizeHint(); // PENDING(kalle) Review, quite inflexible
185 }
Implements KDChart::AbstractLayoutItem.
Definition at line 325 of file KDChartLayoutItems.cpp.
References KDChart::TextLayoutItem::geometry(), KDChart::TextAttributes::pen(), KDChart::Text-
Attributes::rotation(), and KDChart::TextLayoutItem::sizeHint().
Referenced by paintAll(), and KDChart::CartesianAxis::paintCtx().
326 {
327 // make sure, cached font is updated, if needed:
328 sizeHint();
329
330 if( !mRect.isValid() )
331 return;
332
333 PainterSaver painterSaver( painter );
334 painter->setFont( cachedFont );
335 painter->setPen( mAttributes.pen() );
336 QRectF rect = geometry();
337
338 painter->translate( rect.center() );
339 rect.moveTopLeft( QPointF( - rect.width() / 2, - rect.height() / 2 ) );
340 painter->rotate( mAttributes.rotation() );
341 painter->drawText( rect, Qt::AlignHCenter | Qt::AlignVCenter, mText );
342 }
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked
automatically.
Definition at line 83 of file KDChartTextArea.cpp.
References areaGeometry(), KDChart::TextLayoutItem::geometry(), KDChart::AbstractArea-
Base::innerRect(), KDChart::TextLayoutItem::paint(), KDChart::AbstractAreaBase::paintBackground(),
KDChart::AbstractAreaBase::paintFrame(), and KDChart::TextLayoutItem::setGeometry().
Referenced by KDChart::Chart::paint(), and paintIntoRect().
84 {
85 // Paint the background and frame
86 paintBackground( painter, geometry() );
87 paintFrame( painter, geometry() );
88
89 // temporarily adjust the widget size, to be sure all content gets calculated
90 // to fit into the inner rectangle
91 const QRect oldGeometry( areaGeometry() );
92 QRect inner( innerRect() );
93 inner.moveTo(
94 oldGeometry.left() + inner.left(),
95 oldGeometry.top() + inner.top() );
96 const bool needAdjustGeometry = oldGeometry != inner;
97 if( needAdjustGeometry )
98 setGeometry( inner );
99 paint( &painter );
100 if( needAdjustGeometry )
101 setGeometry( oldGeometry );
102 //qDebug() << "TextAreaWidget::paintAll() done.";
103 }
104 {
105 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
106 "Private class was not initialized!" );
107
108 #define attributes d->backgroundAttributes
109
110 if( !attributes.isVisible() ) return;
111
112 /* first draw the brush (may contain a pixmap)*/
113 if( Qt::NoBrush != attributes.brush().style() ) {
114 KDChart::PainterSaver painterSaver( &painter );
115 painter.setPen( Qt::NoPen );
116 const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
117 painter.setBrushOrigin( newTopLeft );
118 painter.setBrush( attributes.brush() );
119 painter.drawRect( rect );
120 }
121 /* next draw the backPixmap over the brush */
122 if( !attributes.pixmap().isNull() &&
123 attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) {
124 QPointF ol = rect.topLeft();
125 if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() )
126 {
127 ol.setX( rect.center().x() - attributes.pixmap().width() / 2 );
128 ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 );
129 painter.drawPixmap( ol, attributes.pixmap() );
130 } else {
131 QMatrix m;
132 double zW = (double)rect.width() / (double)attributes.pixmap().width();
133 double zH = (double)rect.height() / (double)attributes.pixmap().height();
134 switch( attributes.pixmapMode() ) {
135 case BackgroundAttributes::BackgroundPixmapModeScaled:
136 {
137 double z;
138 z = qMin( zW, zH );
139 m.scale( z, z );
140 }
141 break;
142 case BackgroundAttributes::BackgroundPixmapModeStretched:
143 m.scale( zW, zH );
144 break;
145 default:
146 ; // Cannot happen, previously checked
147 }
148 QPixmap pm = attributes.pixmap().transformed( m );
149 ol.setX( rect.center().x() - pm.width() / 2 );
150 ol.setY( rect.center().y() - pm.height()/ 2 );
151 painter.drawPixmap( ol, pm );
152 }
153 }
154 #undef attributes
155 }
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
6.54.3.18 void AbstractAreaBase::paintFrame (QPainter & painter, const QRect & rectangle)
[virtual, inherited]
159 {
160 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
161 "Private class was not initialized!" );
162
163 #define attributes d->frameAttributes
164
165 if( !attributes.isVisible() ) return;
166
167 const QPen oldPen( painter.pen() );
168 painter.setPen( attributes.pen() );
169 painter.drawRect( rect );
170 painter.setPen( oldPen );
171 #undef attributes
172 }
6.54.3.19 void TextArea::paintIntoRect (QPainter & painter, const QRect & rect) [virtual]
72 {
73 const QRect oldGeometry( geometry() );
74 if( oldGeometry != rect )
75 setGeometry( rect );
76 painter.translate( rect.left(), rect.top() );
77 paintAll( painter );
111 {
112 emit positionChanged( this );
113 }
221 {
222 realFontWasRecalculated(); // we can safely ignore the boolean return value
223 return cachedFont;
224 }
194 {
195 return qMax(
196 mAttributes.fontSize().calculatedValue(
197 mAutoReferenceArea,
198 mAutoReferenceOrientation ),
199 mAttributes.minimalFontSize().calculatedValue(
200 mAutoReferenceArea,
201 mAutoReferenceOrientation ) );
202 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
116 {
117 mAutoReferenceArea = area;
118 cachedSizeHint = QSize();
119 sizeHint();
120 }
93 {
94 d->backgroundAttributes = a;
95 }
83 {
84 d->frameAttributes = a;
85 }
188 {
189 mRect = r;
190 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
128 {
129 mText = text;
130 cachedSizeHint = QSize();
131 sizeHint();
132 }
Use this to specify the text attributes to be used for this item.
See also:
textAttributes
145 {
146 mAttributes = a;
147 cachedSizeHint = QSize(); // invalidate size hint
148 sizeHint();
149 }
290 {
291 if( realFontWasRecalculated() )
292 {
293 cachedSizeHint = calcSizeHint( cachedFont );
294 sizeHintChanged();
295 }
296 //qDebug("cachedSizeHint.width(): %i",cachedSizeHint.width());
297 return cachedSizeHint;
298 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
135 {
136 return mText;
137 }
See also:
setTextAttributes
157 {
158 return mAttributes;
159 }
Reimplemented in KDChart::HeaderFooter.
Definition at line 86 of file KDChartTextArea.h.
• KDChartTextArea.h
• KDChartTextArea.cpp
6.55.2.1 KDChart::TextAttributes::TextAttributes ()
6.55.2.3 KDChart::TextAttributes::∼TextAttributes ()
Returns:
Whether text is automatically rotated when space is constrained.
Referenced by operator<<().
Returns:
Whether text is automatically shrunk if space is constraint.
Referenced by operator<<().
Returns:
The font that is used for rendering text.
Returns:
The measure used for the font size.
Returns:
Whether the text has an absolute font size set.
Returns:
Whether the text is visible.
Returns:
The measure used for the minimal font size.
58 { return !operator==(other); }
Returns:
The pen used for rendering the text.
Returns:
The rotation angle used for rendering the text.
Set whether the text should be automatically rotated as needed when space is constraint.
Parameters:
autoRotate Whether text should be automatically rotated.
Parameters:
autoShrink Whether text should be auto-shrunk.
Parameters:
font The font to use.
Parameters:
measure The measure to use.
See also:
Measure
Referenced by KDChart::CartesianAxis::titleTextAttributes().
Set the minimal size of the font used for rendering text.
Parameters:
measure The measure to use.
See also:
Measure
Parameters:
rotation The pen to use.
Parameters:
rotation The rotation angle.
Parameters:
visible Whether the text is visible.
The documentation for this class was generated from the following file:
• KDChartTextAttributes.h
• virtual bool intersects (const TextLayoutItem &other, const QPoint &myPos, const QPoint &other-
Pos) const
• virtual bool intersects (const TextLayoutItem &other, const QPointF &myPos, const QPointF
&otherPos) const
• virtual bool isEmpty () const
pure virtual in QLayoutItem
• TextLayoutItem (const QString &text, const TextAttributes &attributes, const QObject ∗auto-
ReferenceArea, KDChartEnums::MeasureOrientation autoReferenceOrientation, Qt::Alignment
alignment=0)
• TextLayoutItem ()
Protected Attributes
• QWidget ∗ mParent
• QLayout ∗ mParentLayout
6.56.1.1 KDChart::TextLayoutItem::TextLayoutItem ()
91 : AbstractLayoutItem( alignment )
92 , mText( text )
93 , mAttributes( attributes )
94 , mAutoReferenceArea( area )
95 , mAutoReferenceOrientation( orientation )
96 , cachedSizeHint() // default this to invalid to force just-in-time calculation before first use of
97 , cachedFontSize( 0.0 )
98 , cachedFont( mAttributes.font() )
99 {
100 }
123 {
124 return mAutoReferenceArea;
125 }
163 {
164 return 0; // Grow neither vertically nor horizontally
165 }
168 {
169 return mRect;
170 }
249 {
250 if ( mAttributes.rotation() != other.mAttributes.rotation() )
251 {
252 // that’s the code for the common case: the rotation angles don’t need to match here
253 QPolygon myPolygon( rotatedCorners() );
254 QPolygon otherPolygon( other.rotatedCorners() );
255
256 // move the polygons to their positions
257 myPolygon.translate( myPos );
258 otherPolygon.translate( otherPos );
259
260 // create regions out of it
244 {
245 return intersects( other, myPos.toPoint(), otherPos.toPoint() );
246 }
173 {
174 return false; // never empty, otherwise the layout item would not exist
175 }
178 {
179 return sizeHint(); // PENDING(kalle) Review, quite inflexible
180 }
183 {
184 return sizeHint(); // PENDING(kalle) Review, quite inflexible
185 }
Implements KDChart::AbstractLayoutItem.
Definition at line 325 of file KDChartLayoutItems.cpp.
References geometry(), KDChart::TextAttributes::pen(), KDChart::TextAttributes::rotation(), and size-
Hint().
Referenced by KDChart::TextArea::paintAll(), and KDChart::CartesianAxis::paintCtx().
326 {
327 // make sure, cached font is updated, if needed:
328 sizeHint();
329
330 if( !mRect.isValid() )
331 return;
332
333 PainterSaver painterSaver( painter );
334 painter->setFont( cachedFont );
335 painter->setPen( mAttributes.pen() );
336 QRectF rect = geometry();
337
338 painter->translate( rect.center() );
339 rect.moveTopLeft( QPointF( - rect.width() / 2, - rect.height() / 2 ) );
340 painter->rotate( mAttributes.rotation() );
341 painter->drawText( rect, Qt::AlignHCenter | Qt::AlignVCenter, mText );
342 }
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
221 {
222 realFontWasRecalculated(); // we can safely ignore the boolean return value
223 return cachedFont;
224 }
194 {
195 return qMax(
196 mAttributes.fontSize().calculatedValue(
197 mAutoReferenceArea,
198 mAutoReferenceOrientation ),
199 mAttributes.minimalFontSize().calculatedValue(
200 mAutoReferenceArea,
201 mAutoReferenceOrientation ) );
202 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
116 {
117 mAutoReferenceArea = area;
118 cachedSizeHint = QSize();
119 sizeHint();
120 }
188 {
189 mRect = r;
190 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
128 {
129 mText = text;
130 cachedSizeHint = QSize();
131 sizeHint();
132 }
Use this to specify the text attributes to be used for this item.
See also:
textAttributes
145 {
146 mAttributes = a;
147 cachedSizeHint = QSize(); // invalidate size hint
148 sizeHint();
149 }
290 {
291 if( realFontWasRecalculated() )
292 {
293 cachedSizeHint = calcSizeHint( cachedFont );
294 sizeHintChanged();
295 }
296 //qDebug("cachedSizeHint.width(): %i",cachedSizeHint.width());
297 return cachedSizeHint;
298 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
135 {
136 return mText;
137 }
See also:
setTextAttributes
157 {
158 return mAttributes;
159 }
• KDChartLayoutItems.h
• KDChartLayoutItems.cpp
6.57.1.1 ThreeDBarAttributes::ThreeDBarAttributes ()
6.57.1.3 ThreeDBarAttributes::∼ThreeDBarAttributes ()
66 {
67 }
99 {
100 return d->angle;
101 }
104 {
105 return d->depth;
106 }
93 {
94 return d->enabled;
95 }
57 { return !operator==(other); }
53 { return !operator==(other); }
56 {
57 if( this == &r )
58 return *this;
59
60 *d = *r.d;
61
62 return *this;
63 }
73 {
74 if( isEnabled() == r.isEnabled() &&
75 depth() == r.depth() )
76 return true;
77 else
78 return false;
79 }
75 {
76 return ( useShadowColors() == r.useShadowColors() &&
77 angle() == r.angle() &&
78 AbstractThreeDAttributes::operator==(r));
79 }
94 {
95 d->angle = threeDAngle;
96 }
98 {
99 d->depth = depth;
100 }
88 {
89 d->enabled = enabled;
90 }
84 {
85 d->useShadowColors = shadowColors;
86 }
89 {
90 return d->useShadowColors;
91 }
110 {
111 return isEnabled() ? d->depth : 0.0;
112 }
The documentation for this class was generated from the following files:
• KDChartThreeDBarAttributes.h
• KDChartThreeDBarAttributes.cpp
6.58.1.1 ThreeDLineAttributes::ThreeDLineAttributes ()
6.58.1.3 ThreeDLineAttributes::∼ThreeDLineAttributes ()
66 {
67 }
104 {
105 return d->depth;
106 }
93 {
94 return d->enabled;
95 }
89 {
90 return d->lineXRotation;
91 }
99 {
100 return d->lineYRotation;
101 }
57 { return !operator==(other); }
51 { return !operator==(other); }
56 {
57 if( this == &r )
58 return *this;
59
60 *d = *r.d;
61
62 return *this;
63 }
73 {
74 if( isEnabled() == r.isEnabled() &&
75 depth() == r.depth() )
76 return true;
77 else
78 return false;
79 }
75 {
76 return ( lineXRotation() == r.lineXRotation() &&
77 lineYRotation() == r.lineYRotation() &&
78 AbstractThreeDAttributes::operator==(r));
79 }
98 {
99 d->depth = depth;
100 }
88 {
89 d->enabled = enabled;
90 }
84 {
85 d->lineXRotation = degrees;
86 }
94 {
95 d->lineYRotation = degrees;
96 }
110 {
111 return isEnabled() ? d->depth : 0.0;
112 }
The documentation for this class was generated from the following files:
• KDChartThreeDLineAttributes.h
• KDChartThreeDLineAttributes.cpp
6.59.1.1 ThreeDPieAttributes::ThreeDPieAttributes ()
6.59.1.3 ThreeDPieAttributes::∼ThreeDPieAttributes ()
65 {
66 }
104 {
105 return d->depth;
106 }
93 {
94 return d->enabled;
95 }
57 { return !operator==(other); }
49 { return !operator==(other); }
55 {
56 if( this == &r )
57 return *this;
58
59 *d = *r.d;
60
61 return *this;
62 }
73 {
74 if( isEnabled() == r.isEnabled() &&
75 depth() == r.depth() )
76 return true;
77 else
78 return false;
79 }
74 {
75 return ( useShadowColors() == r.useShadowColors() &&
76 AbstractThreeDAttributes::operator==(r));
77 }
98 {
99 d->depth = depth;
100 }
88 {
89 d->enabled = enabled;
90 }
82 {
83 d->useShadowColors = shadowColors;
84 }
87 {
88 return d->useShadowColors;
89 }
110 {
111 return isEnabled() ? d->depth : 0.0;
112 }
The documentation for this class was generated from the following files:
• KDChartThreeDPieAttributes.h
• KDChartThreeDPieAttributes.cpp
#include <KDChartLayoutItems.h>
Inheritance diagram for KDChart::VerticalLineLayoutItem:Collaboration diagram for KDChart::Vertical-
LineLayoutItem:
• void removeFromParentLayout ()
• virtual void setGeometry (const QRect &r)
• void setParentLayout (QLayout ∗lay)
• virtual void setParentWidget (QWidget ∗widget)
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
• VerticalLineLayoutItem ()
Protected Attributes
• QWidget ∗ mParent
• QLayout ∗ mParentLayout
6.60.1.1 KDChart::VerticalLineLayoutItem::VerticalLineLayoutItem ()
468 {
469 return Qt::Vertical|Qt::Vertical; // Grow neither vertically nor horizontally
470 }
473 {
474 return mRect;
475 }
478 {
479 return false; // never empty, otherwise the layout item would not exist
480 }
483 {
484 return QSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX );
485 }
488 {
489 return QSize( 0, 0 );
490 }
Implements KDChart::AbstractLayoutItem.
Definition at line 503 of file KDChartLayoutItems.cpp.
504 {
505 if( !mRect.isValid() )
506 return;
507
508 painter->drawLine( QPointF( mRect.center().x(), mRect.top() ),
509 QPointF( mRect.center().x(), mRect.bottom() ) );
510 }
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis.
Definition at line 64 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().
65 {
66 if( context )
67 paint( context->painter() );
68 }
67 {
68 if( mParentLayout ){
69 if( widget() )
70 mParentLayout->removeWidget( widget() );
71 else
72 mParentLayout->removeItem( this );
73 }
74 }
493 {
494 mRect = r;
495 }
63 {
64 mParentLayout = lay;
65 }
Inform the item about its widget: This enables the item, to trigger that widget’s update, whenever the size
of the item’s contents has changed.
Thus, you need to call setParentWidget on every item, that has a non-fixed size.
Definition at line 56 of file KDChartLayoutItems.cpp.
References KDChart::AbstractLayoutItem::mParent.
Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
57 {
58 mParent = widget;
59 }
498 {
499 return QSize( 3, -1 ); // see qframe.cpp
500 }
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 73 of file KDChartLayoutItems.cpp.
Referenced by KDChart::TextLayoutItem::sizeHint().
74 {
75 // This is exactly like what QWidget::updateGeometry does.
76 // qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
77 if( mParent ) {
78 if ( mParent->layout() )
79 mParent->layout()->invalidate();
80 else
81 QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
82 }
83 }
• KDChartLayoutItems.h
• KDChartLayoutItems.cpp
Public Types
• enum ChartType {
NoType,
Bar,
Line,
Pie,
Ring,
Polar }
• enum SubType {
Normal,
Stacked,
Percent,
Rows }
Sub type values, matching the values defines for the respective Diagram classes.
• BarDiagram ∗ barDiagram ()
If the current diagram is a BarDiagram, it is returnd; otherwise 0 is returned.
• AbstractCoordinatePlane ∗ coordinatePlane ()
Returns a pointer to the current coordinate plane.
• AbstractDiagram ∗ diagram ()
Returns a pointer to the current diagram.
• HeaderFooter ∗ firstHeaderFooter ()
Returns the first of all headers.
• Legend ∗ legend ()
Returns the first of all legends.
• LineDiagram ∗ lineDiagram ()
If the current diagram is a LineDiagram, it is returnd; otherwise 0 is returned.
• PieDiagram ∗ pieDiagram ()
If the current diagram is a PieDiagram, it is returnd; otherwise 0 is returned.
• PolarDiagram ∗ polarDiagram ()
If the current diagram is a PolarDiagram, it is returnd; otherwise 0 is returned.
• RingDiagram ∗ ringDiagram ()
If the current diagram is a RingDiagram, it is returnd; otherwise 0 is returned.
• void setDataset (int column, const QVector< QPair< double, double > > &data, const QString
&title=QString())
Sets the data in the given column using a QVector of QPairs of double.
• void setDataset (int column, const QVector< double > &data, const QString &title=QString())
Sets the data in the given column using a QVector of double.
• ∼Widget ()
Destructor.
Public Attributes
Enumeration values:
NoType
Bar
Line
Pie
Ring
Polar
Sub type values, matching the values defines for the respective Diagram classes.
Enumeration values:
Normal
Stacked
Percent
Rows
Parameters:
parent the widget parent; passed on to QWidget
82 :
83 QWidget(parent), _d( new Private( this ) )
84 {
85 // as default we have a cartesian coordinate plane ...
86 // ... and a line diagram
87 setType( Line );
88 }
6.61.3.2 Widget::∼Widget ()
Destructor.
Definition at line 93 of file KDChartWidget.cpp.
94 {
95 delete _d; _d = 0;
96 }
See also:
replaceHeaderFooter, takeHeaderFooter
263 {
264 header->setParent( &d->m_chart );
265 d->m_chart.addHeaderFooter( header ); // we need this explicit call !
266 }
251 {
252 HeaderFooter* newHeader = new HeaderFooter( &d->m_chart );
253 newHeader->setType( type );
254 newHeader->setPosition( position );
255 newHeader->setText( text );
256 d->m_chart.addHeaderFooter( newHeader ); // we need this explicit call !
257 }
309 {
310 legend->setDiagram( diagram() );
311 legend->setParent( &d->m_chart );
312 }
299 {
300 Legend* legend = new Legend( diagram(), &d->m_chart );
301 legend->setPosition( position );
302 d->m_chart.addLegend( legend );
303 }
241 {
242 return d->m_chart.headerFooters();
243 }
291 {
292 return d->m_chart.legends();
293 }
335 {
336 return dynamic_cast<BarDiagram*>( diagram() );
337 }
356 {
357 return d->m_chart.coordinatePlane();
358 }
327 {
328 if ( coordinatePlane() == 0 )
329 qDebug() << "diagram(): coordinatePlane() was NULL";
330
331 return coordinatePlane()->diagram();
332 }
233 {
234 return d->m_chart.headerFooter();
235 }
225 {
226 return d->m_chart.globalLeadingBottom();
227 }
177 {
178 return d->m_chart.globalLeadingLeft();
179 }
209 {
210 return d->m_chart.globalLeadingRight();
211 }
193 {
194 return d->m_chart.globalLeadingTop();
195 }
283 {
284 return d->m_chart.legend();
285 }
339 {
340 return dynamic_cast<LineDiagram*>( diagram() );
341 }
343 {
344 return dynamic_cast<PieDiagram*>( diagram() );
345 }
351 {
352 return dynamic_cast<PolarDiagram*>( diagram() );
353 }
Replaces the old header (or footer, resp.), or appends the new header or footer, it there is none yet.
Parameters:
headerFooter The header or footer to be used instead of the old one. This parameter must not be zero,
or the method will do nothing.
oldHeaderFooter The header or footer to be removed by the new one. This header or footer will be
deleted automatically. If the parameter is omitted, the very first header or footer will be replaced.
In case, there was no header and no footer yet, the new header or footer will just be added.
Note:
If you want to re-use the old header or footer, call takeHeaderFooter and addHeaderFooter, instead of
using replaceHeaderFooter.
See also:
addHeaderFooter, takeHeaderFooter
269 {
270 header->setParent( &d->m_chart );
271 d->m_chart.replaceHeaderFooter( header, oldHeader );
272 }
315 {
316 legend->setDiagram( diagram() );
317 legend->setParent( &d->m_chart );
318 d->m_chart.replaceLegend( legend, oldLegend );
319 }
152 {
153 d->m_model.clear();
154 d->usedDatasetWidth = 0;
155 }
347 {
348 return dynamic_cast<RingDiagram*>( diagram() );
349 }
6.61.4.23 void Widget::setDataset (int column, const QVector< QPair< double, double > > &
data, const QString & title = QString())
Sets the data in the given column using a QVector of QPairs of double.
Definition at line 127 of file KDChartWidget.cpp.
References d.
128 {
129 if ( ! checkDatasetWidth( 2 ))
130 return;
131
132 QStandardItemModel & model = d->m_model;
133
134 justifyModelSize( data.size(), (column + 1) * 2 );
135
136 for( int i = 0; i < data.size(); ++i )
137 {
138 QModelIndex index = model.index( i, column * 2 );
139 model.setData( index, QVariant( data[i].first ), Qt::DisplayRole );
140
141 index = model.index( i, column * 2 + 1 );
142 model.setData( index, QVariant( data[i].second ), Qt::DisplayRole );
143 }
144 if ( ! title.isEmpty() )
145 model.setHeaderData( column * 2, Qt::Horizontal, QVariant( title ) );
146 }
6.61.4.24 void Widget::setDataset (int column, const QVector< double > & data, const QString &
title = QString())
106 {
107 if ( ! checkDatasetWidth( 1 ) )
108 return;
109
110 QStandardItemModel & model = d->m_model;
111
112 justifyModelSize( data.size(), column + 1 );
113
114 for( int i = 0; i < data.size(); ++i )
115 {
116 const QModelIndex index = model.index( i, column );
117 model.setData( index, QVariant( data[i] ), Qt::DisplayRole );
118 }
119 if ( ! title.isEmpty() )
120 model.setHeaderData( column, Qt::Horizontal, QVariant( title ) );
121 }
217 {
218 d->m_chart.setGlobalLeadingBottom( leading );
219 }
169 {
170 d->m_chart.setGlobalLeadingLeft( leading );
171 }
201 {
202 d->m_chart.setGlobalLeadingRight( leading );
203 }
185 {
186 d->m_chart.setGlobalLeadingTop( leading );
187 }
Sets the type of the chart without changing the main type.
Make sure to use a sub-type that matches the main type, so e.g. setting sub-type Rows makes sense for Bar
charts only, and it will be ignored for all other chart types.
See also:
KDChartBarDiagram::BarType, KDChartLineDiagram::LineType
KDChartPieDiagram::PieType, KDChartRingDiagram::RingType
KDChartPolarDiagram::PolarType
436 {
437 BarDiagram* barDia = qobject_cast< BarDiagram* >( diagram() );
Remove the header (or footer, resp.) from the widget, without deleting it.
The chart no longer owns the header or footer, so it is the caller’s responsibility to delete the header or
footer.
See also:
addHeaderFooter, replaceHeaderFooter
275 {
276 d->m_chart.takeHeaderFooter( header );
277 }
322 {
323 d->m_chart.takeLegend( legend );
324 }
479 {
480 // PENDING(christoph) save the type out-of-band:
481 AbstractDiagram * const dia = const_cast<Widget*>( this )->diagram();
482 if ( qobject_cast< BarDiagram* >( dia ) )
483 return Bar;
484 else if ( qobject_cast< LineDiagram* >( dia ) )
485 return Line;
486 else if( qobject_cast< PieDiagram* >( dia ) )
487 return Pie;
488 else if( qobject_cast< PolarDiagram* >( dia ) )
489 return Polar;
490 else if( qobject_cast< RingDiagram* >( dia ) )
491 return Ring;
492 else
493 return NoType;
494 }
497 {
498 // PENDING(christoph) save the type out-of-band:
499 Widget::SubType retVal = Normal;
500
501 AbstractDiagram * const dia = const_cast<Widget*>( this )->diagram();
502 BarDiagram* barDia = qobject_cast< BarDiagram* >( dia );
503 LineDiagram* lineDia = qobject_cast< LineDiagram* >( dia );
504
505 //FIXME(khz): Add the impl for these chart types - or remove them from here:
506 // PieDiagram* pieDia = qobject_cast< PieDiagram* >( diagram() );
507 // PolarDiagram* polarDia = qobject_cast< PolarDiagram* >( diagram() );
508 // RingDiagram* ringDia = qobject_cast< RingDiagram* >( diagram() );
509
510 #define TEST_SUB_TYPE(DIAGRAM, INTERNALSUBTYPE, SUBTYPE) \
511 { \
512 if( DIAGRAM && DIAGRAM->type() == INTERNALSUBTYPE ) \
513 retVal = SUBTYPE; \
514 }
515 const Widget::ChartType mainType = type();
516 switch ( mainType )
517 {
518 case Bar:
519 TEST_SUB_TYPE( barDia, BarDiagram::Normal, Normal );
520 TEST_SUB_TYPE( barDia, BarDiagram::Stacked, Stacked );
521 TEST_SUB_TYPE( barDia, BarDiagram::Percent, Percent );
522 TEST_SUB_TYPE( barDia, BarDiagram::Rows, Rows );
523 break;
524 case Line:
525 TEST_SUB_TYPE( lineDia, LineDiagram::Normal, Normal );
526 TEST_SUB_TYPE( lineDia, LineDiagram::Stacked, Stacked );
527 TEST_SUB_TYPE( lineDia, LineDiagram::Percent, Percent );
528 break;
529 case Pie:
530 // no impl. yet
531 break;
532 case Polar:
533 // no impl. yet
534 break;
535 case Ring:
536 // no impl. yet
537 break;
538 default:
539 Q_ASSERT_X ( false,
540 "Widget::subType", "Chart type not supported!" );
541 break;
542 }
543 return retVal;
544 }
• KDChartWidget.h
• KDChartWidget.cpp
Public Attributes
• double xCenter
• double xFactor
• double yCenter
• double yFactor
6.62.1.1 KDChart::ZoomParameters::ZoomParameters ()
8 : xFactor( 1.0 ),
9 yFactor( 1.0 ),
10 xCenter( 0.5 ),
11 yCenter( 0.5)
12 {
13 }
• KDChartZoomParameters.h
Namespaces
• namespace KDChart
Defines
• #define attributes d → frameAttributes
• #define attributes d → backgroundAttributes
• #define d d_func()
KDChart::AbstractAreaBase::setBackgroundAttributes(), KDChart::BarDiagram::setBarAttributes(),
KDChart::Legend::setBrush(), KDChart::Legend::setBrushesFromDiagram(), KDChart::Legend::set-
Color(), KDChart::AbstractDiagram::setCoordinatePlane(), KDChart::AbstractDiagram::set-
DataBoundariesDirty(), KDChart::Widget::setDataset(), KDChart::AbstractDiagram::setDataset-
Dimension(), KDChart::AbstractDiagram::setDataValueAttributes(), KDChart::AbstractThree-
DAttributes::setDepth(), KDChart::AbstractThreeDAttributes::setEnabled(), KDChart::PieAttributes::set-
Explode(), KDChart::PieAttributes::setExplodeFactor(), KDChart::AbstractAreaBase::setFrame-
Attributes(), KDChart::CartesianAxis::setGeometry(), KDChart::AbstractCoordinatePlane::set-
Geometry(), KDChart::AbstractCoordinatePlane::setGlobalGridAttributes(), KDChart::Chart::set-
GlobalLeading(), KDChart::Widget::setGlobalLeadingBottom(), KDChart::Chart::setGlobal-
LeadingBottom(), KDChart::Widget::setGlobalLeadingLeft(), KDChart::Chart::setGlobalLeading-
Left(), KDChart::Widget::setGlobalLeadingRight(), KDChart::Chart::setGlobalLeadingRight(),
KDChart::Widget::setGlobalLeadingTop(), KDChart::Chart::setGlobalLeadingTop(), KDChart::Abstract-
PieDiagram::setGranularity(), KDChart::PolarCoordinatePlane::setGridAttributes(), KDChart::Cartesian-
CoordinatePlane::setGridAttributes(), KDChart::CartesianCoordinatePlane::setHorizontalRange(),
KDChart::CartesianCoordinatePlane::setIsometricScaling(), KDChart::AbstractAxis::setLabels(),
KDChart::LineDiagram::setLineAttributes(), KDChart::ThreeDLineAttributes::setLineXRotation(),
KDChart::ThreeDLineAttributes::setLineYRotation(), KDChart::Legend::setMarkerAttributes(),
KDChart::AbstractDiagram::setModel(), KDChart::Legend::setNeedRebuild(), KDChart::Legend::set-
Orientation(), KDChart::AbstractCoordinatePlane::setParent(), KDChart::Legend::setPen(),
KDChart::AbstractDiagram::setPercentMode(), KDChart::AbstractPieDiagram::setPieAttributes(),
KDChart::Legend::setPosition(), KDChart::HeaderFooter::setPosition(), KDChart::CartesianAxis::set-
Position(), KDChart::Legend::setReferenceArea(), KDChart::AbstractCoordinatePlane::setReference-
CoordinatePlane(), KDChart::AbstractCartesianDiagram::setReferenceDiagram(), KDChart::Ring-
Diagram::setRelativeThickness(), KDChart::AbstractDiagram::setRootIndex(), KDChart::Polar-
Diagram::setRotateCircularLabels(), KDChart::AbstractAxis::setShortLabels(), KDChart::Polar-
Diagram::setShowDelimitersAtPosition(), KDChart::PolarDiagram::setShowLabelsAtPosition(),
KDChart::Legend::setShowLines(), KDChart::Legend::setSpacing(), KDChart::AbstractPieDiagram::set-
StartPosition(), KDChart::Legend::setText(), KDChart::Legend::setTextAttributes(), KDChart::Abstract-
Axis::setTextAttributes(), KDChart::BarDiagram::setThreeDBarAttributes(), KDChart::Line-
Diagram::setThreeDLineAttributes(), KDChart::AbstractPieDiagram::setThreeDPieAttributes(),
KDChart::Legend::setTitleText(), KDChart::CartesianAxis::setTitleText(), KDChart::Legend::set-
TitleTextAttributes(), KDChart::CartesianAxis::setTitleTextAttributes(), KDChart::LineDiagram::set-
Type(), KDChart::HeaderFooter::setType(), KDChart::BarDiagram::setType(), KDChart::Three-
DPieAttributes::setUseShadowColors(), KDChart::ThreeDBarAttributes::setUseShadowColors(),
KDChart::CartesianCoordinatePlane::setVerticalRange(), KDChart::PolarDiagram::setZeroDegree-
Position(), KDChart::PolarCoordinatePlane::setZoomCenter(), KDChart::CartesianCoordinate-
Plane::setZoomCenter(), KDChart::PolarCoordinatePlane::setZoomFactorX(), KDChart::Cartesian-
CoordinatePlane::setZoomFactorX(), KDChart::PolarCoordinatePlane::setZoomFactorY(),
KDChart::CartesianCoordinatePlane::setZoomFactorY(), KDChart::AbstractAxis::shortLabels(),
KDChart::PolarDiagram::showDelimitersAtPosition(), KDChart::PolarDiagram::showLabelsAt-
Position(), KDChart::Legend::showLines(), KDChart::Legend::spacing(), KDChart::AbstractPie-
Diagram::startPosition(), KDChart::AbstractCartesianDiagram::takeAxis(), KDChart::Chart::take-
CoordinatePlane(), KDChart::AbstractCoordinatePlane::takeDiagram(), KDChart::Widget::takeHeader-
Footer(), KDChart::Chart::takeHeaderFooter(), KDChart::Widget::takeLegend(), KDChart::Chart::take-
Legend(), KDChart::Legend::text(), KDChart::Legend::textAttributes(), KDChart::AbstractAxis::text-
Attributes(), KDChart::ThreeDBarAttributes::ThreeDBarAttributes(), KDChart::BarDiagram::three-
DBarAttributes(), KDChart::LineDiagram::threeDItemDepth(), KDChart::BarDiagram::threeDItem-
Depth(), KDChart::ThreeDLineAttributes::ThreeDLineAttributes(), KDChart::LineDiagram::three-
DLineAttributes(), KDChart::ThreeDPieAttributes::ThreeDPieAttributes(), KDChart::AbstractPie-
Diagram::threeDPieAttributes(), KDChart::Legend::titleText(), KDChart::CartesianAxis::titleText(),
KDChart::Legend::titleTextAttributes(), KDChart::CartesianAxis::titleTextAttributes(), KDChart::Polar-
CoordinatePlane::translate(), KDChart::CartesianCoordinatePlane::translate(), KDChart::Polar-
CoordinatePlane::translatePolar(), KDChart::LineDiagram::type(), KDChart::HeaderFooter::type(),
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Namespaces
• namespace KDChart
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const KDChart::AbstractThreeDAttributes &a)
117 {
118 dbg << "enabled="<<a.isEnabled()
119 << "depth="<<a.depth();
120 return dbg;
121 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::AbstractThreeDAttributes
&)
117 {
118 dbg << "enabled="<<a.isEnabled()
119 << "depth="<<a.depth();
120 return dbg;
121 }
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const KDChart::BackgroundAttributes &ba)
135 {
136 dbg << "KDChart::BackgroundAttributes("
137 << "visible="<<ba.isVisible()
138 << "brush="<<ba.brush()
139 << "pixmapmode="<<ba.pixmapMode()
140 << "pixmap="<<ba.pixmap()
141 << ")";
142 return dbg;
143 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::BackgroundAttributes &)
• Q_DECLARE_TYPEINFO (KDChart::BackgroundAttributes, Q_MOVABLE_TYPE)
135 {
136 dbg << "KDChart::BackgroundAttributes("
137 << "visible="<<ba.isVisible()
138 << "brush="<<ba.brush()
139 << "pixmapmode="<<ba.pixmapMode()
140 << "pixmap="<<ba.pixmap()
141 << ")";
142 return dbg;
143 }
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
• #define d (d_func())
• #define ptr (context → painter())
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
Functions
Value:
{ \
QVBoxLayout* innerLayout = new QVBoxLayout(); \
for (int i = 0; i < count; ++i) { \
legend = list.at(i); \
if( legend->alignment() == ( align ) ) \
innerLayout->addWidget( legend, 0, Qt::AlignLeft ); \
} \
gridLayout->addLayout( innerLayout, row, column, ( align ) ); \
}
360 {
361 return findOrCreateLayoutByObjectName<QHBoxLayout>( parentLayout, name );
362 }
345 {
346 T *box = qFindChild<T*>( parentLayout, QString::fromLatin1( name ) );
347 if ( !box ) {
348 box = new T();
349 box->setObjectName( QString::fromLatin1( name ) );
350 }
351 return box;
352 }
355 {
356 return findOrCreateLayoutByObjectName<QVBoxLayout>( parentLayout, name );
357 }
Namespaces
• namespace KDChart
Namespaces
• namespace KDChart
Namespaces
• namespace KDChart
• namespace Ui
Defines
• #define d d_func()
• #define KDCHART_DATA_VALUE_AUTO_DIGITS 4
Functions
• QDebug operator<< (QDebug dbg, const KDChart::DataValueAttributes &val)
270 {
271 dbg << "RelativePosition DataValueAttributes("
272 << "visible="<<val.isVisible()
273 << "textattributes="<<val.textAttributes()
274 << "frameattributes="<<val.frameAttributes()
275 << "backgroundattributes="<<val.backgroundAttributes()
276 << "decimaldigits="<<val.decimalDigits()
277 << "poweroftendivisor="<<val.powerOfTenDivisor()
278 << "showinfinite="<<val.showInfinite()
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::DataValueAttributes &)
• Q_DECLARE_TYPEINFO (KDChart::DataValueAttributes, Q_MOVABLE_TYPE)
270 {
271 dbg << "RelativePosition DataValueAttributes("
272 << "visible="<<val.isVisible()
273 << "textattributes="<<val.textAttributes()
274 << "frameattributes="<<val.frameAttributes()
275 << "backgroundattributes="<<val.backgroundAttributes()
276 << "decimaldigits="<<val.decimalDigits()
277 << "poweroftendivisor="<<val.powerOfTenDivisor()
278 << "showinfinite="<<val.showInfinite()
279 << "negativerelativeposition="<<val.negativePosition()
280 << "positiverelativeposition="<<val.positivePosition()
281 <<")";
282 return dbg;
283 }
Namespaces
• namespace KDChart
Classes
• class KDChartEnums
Project global class providing some enums needed both by KDChartParams and by KDChartCustomBox.
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const KDChart::FrameAttributes &fa)
120 {
121 dbg << "KDChart::FrameAttributes("
122 << "visible="<<fa.isVisible()
123 << "pen="<<fa.pen()
124 << "padding="<<fa.padding()
125 << ")";
126 return dbg;
127 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::FrameAttributes &)
• Q_DECLARE_TYPEINFO (KDChart::FrameAttributes, Q_MOVABLE_TYPE)
120 {
121 dbg << "KDChart::FrameAttributes("
122 << "visible="<<fa.isVisible()
123 << "pen="<<fa.pen()
124 << "padding="<<fa.padding()
125 << ")";
126 return dbg;
127 }
Namespaces
• namespace KDChart
Defines
• #define KDAB_SET_OBJECT_NAME(x) __kdab__dereference_for_methodcall( x ).setObject-
Name( QLatin1String( #x ) )
• #define KDCHART_DECLARE_DERIVED_DIAGRAM(X, PLANE)
• #define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC(X)
• #define KDCHART_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET(X)
• #define KDCHART_DECLARE_PRIVATE_BASE_VALUE(X)
• #define KDCHART_DECLARE_PRIVATE_DERIVED(X)
• #define KDCHART_DECLARE_PRIVATE_DERIVED_PARENT(X, ParentType)
• #define KDCHART_DECLARE_PRIVATE_DERIVED_QWIDGET(X) KDCHART_DECLARE_-
PRIVATE_DERIVED_PARENT( X, QWidget∗ )
• #define KDCHART_DECLARE_SWAP_BASE(X)
• #define KDCHART_DECLARE_SWAP_DERIVED(X) void swap( X& other ) { doSwap( other ); }
• #define KDCHART_DECLARE_SWAP_SPECIALISATION(X)
• #define KDCHART_DECLARE_SWAP_SPECIALISATION_DERIVED(X) KDCHART_-
DECLARE_SWAP_SPECIALISATION( X )
• #define KDCHART_DERIVED_PRIVATE_FOOTER(CLASS, PARENT)
• #define KDCHART_IMPL_DERIVED_DIAGRAM(CLASS, PARENT, PLANE)
• #define KDCHART_IMPL_DERIVED_PLANE(CLASS, BASEPLANE)
Functions
• template<typename T> T & __kdab__dereference_for_methodcall (T ∗o)
• template<typename T> T & __kdab__dereference_for_methodcall (T &o)
Value:
protected: \
class Private; \
inline Private * d_func(); \
inline const Private * d_func() const; \
explicit inline X( Private * ); \
explicit inline X( Private *, QWidget *, PLANE * ); \
private: \
void init();
Value:
protected: \
class Private; \
Private * d_func() { return _d; } \
const Private * d_func() const { return _d; } \
explicit inline X( Private * ); \
private: \
void init(); \
Private * _d;
Value:
protected: \
class Private; \
Private * d_func() { return _d; } \
const Private * d_func() const { return _d; } \
explicit inline X( Private *, QWidget* ); \
private: \
void init(); \
Private * _d;
Value:
public: \
inline void swap( X & other ) { qSwap( _d, other._d ); } \
protected: \
class Private; \
Private * d_func() { return _d; } \
const Private * d_func() const { return _d; } \
private: \
void init(); \
Private * _d;
Value:
protected: \
class Private; \
inline Private * d_func(); \
inline const Private * d_func() const; \
explicit inline X( Private * ); \
private: \
void init();
Value:
protected: \
class Private; \
inline Private * d_func(); \
inline const Private * d_func() const; \
explicit inline X( Private *, ParentType ); \
private: \
void init();
Value:
protected: \
void doSwap( X& other ) \
{ qSwap( _d, other._d); }
Value:
Value:
Value:
Value:
42 {
43 return *o;
44 }
37 {
38 return o;
39 }
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const KDChart::GridAttributes &a)
261 {
262 dbg << "KDChart::GridAttributes("
263 << "visible="<<a.isGridVisible()
264 << "subVisible="<<a.isSubGridVisible()
265 // KDChartEnums::GranularitySequence sequence;
266 << "stepWidth=" << a.gridStepWidth()
267 << "subStepWidth=" << a.gridSubStepWidth()
268 << "pen="<<a.gridPen()
269 << "subPen="<<a.subGridPen()
270 << "zeroPen="<<a.zeroLinePen()
271 << ")";
272 return dbg;
273 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::GridAttributes &)
• Q_DECLARE_TYPEINFO (KDChart::GridAttributes, Q_MOVABLE_TYPE)
261 {
262 dbg << "KDChart::GridAttributes("
263 << "visible="<<a.isGridVisible()
264 << "subVisible="<<a.isSubGridVisible()
265 // KDChartEnums::GranularitySequence sequence;
266 << "stepWidth=" << a.gridStepWidth()
267 << "subStepWidth=" << a.gridSubStepWidth()
268 << "pen="<<a.gridPen()
269 << "subPen="<<a.subGridPen()
270 << "zeroPen="<<a.zeroLinePen()
271 << ")";
272 return dbg;
273 }
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
• #define PI 3.141592653589793
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const KDChart::LineAttributes &a)
124 {
125 dbg << "KDChart::LineAttributes("
126 // MissingValuesPolicy missingValuesPolicy;
127 << "bool="<<a.displayArea()
128 << "transparency="<<a.transparency()
129 << ")";
130 return dbg;
131
132 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::LineAttributes &)
• Q_DECLARE_TYPEINFO (KDChart::LineAttributes, Q_MOVABLE_TYPE)
124 {
125 dbg << "KDChart::LineAttributes("
126 // MissingValuesPolicy missingValuesPolicy;
127 << "bool="<<a.displayArea()
128 << "transparency="<<a.transparency()
129 << ")";
130 return dbg;
131
132 }
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const MarkerAttributes &ma)
162 {
163 return dbg << "KDChart::MarkerAttributes("
164 << "visible=" << ma.isVisible()
165 << "markerStylesMap=" << ma.markerStylesMap()
166 << "markerStyle=" << ma.markerStyle()
167 << "markerColor=" << ma.markerColor()
168 << "pen=" << ma.pen()
169 << ")";
170 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::MarkerAttributes &)
• Q_DECLARE_TYPEINFO (KDChart::MarkerAttributes, Q_MOVABLE_TYPE)
Namespaces
• namespace KDChart
Functions
• QDebug operator<< (QDebug dbg, const KDChart::Measure &m)
159 {
160 dbg << "KDChart::Measure("
161 << "value="<<m.value()
162 << "calculationmode="<<m.calculationMode()
163 << "referencearea="<<m.referenceArea()
164 << "referenceorientation="<<m.referenceOrientation()
165 << ")";
166 return dbg;
167 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::Measure &)
159 {
160 dbg << "KDChart::Measure("
161 << "value="<<m.value()
162 << "calculationmode="<<m.calculationMode()
163 << "referencearea="<<m.referenceArea()
164 << "referenceorientation="<<m.referenceOrientation()
165 << ")";
166 return dbg;
167 }
Defines
• #define d (d_func())
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Functions
• Palette makeDefaultPalette ()
• Palette makeRainbowPalette ()
• Palette makeSubduedPalette ()
40 {
41 Palette p;
42
43 p.addBrush( Qt::red );
44 p.addBrush( Qt::green );
45 p.addBrush( Qt::blue );
46 p.addBrush( Qt::cyan );
47 p.addBrush( Qt::magenta );
48 p.addBrush( Qt::yellow );
49 p.addBrush( Qt::darkRed );
50 p.addBrush( Qt::darkGreen );
51 p.addBrush( Qt::darkBlue );
52 p.addBrush( Qt::darkCyan );
53 p.addBrush( Qt::darkMagenta );
54 p.addBrush( Qt::darkYellow );
55
56 return p;
57 }
84 {
85 Palette p;
86
87 p.addBrush( QColor(255, 0,196) );
88 p.addBrush( QColor(255, 0, 96) );
89 p.addBrush( QColor(255, 128,64) );
90 p.addBrush( Qt::yellow );
91 p.addBrush( Qt::green );
92 p.addBrush( Qt::cyan );
93 p.addBrush( QColor( 96, 96,255) );
94 p.addBrush( QColor(160, 0,255) );
95 for( int i = 8 ; i < 16 ; ++i )
96 p.addBrush( p.getBrush(i-8).color().light(), i );
97
98 return p;
99 }
59 {
60 Palette p;
61
62 p.addBrush( QColor( 0xe0,0x7f,0x70 ) );
63 p.addBrush( QColor( 0xe2,0xa5,0x6f ) );
64 p.addBrush( QColor( 0xe0,0xc9,0x70 ) );
65 p.addBrush( QColor( 0xd1,0xe0,0x70 ) );
66 p.addBrush( QColor( 0xac,0xe0,0x70 ) );
67 p.addBrush( QColor( 0x86,0xe0,0x70 ) );
68 p.addBrush( QColor( 0x70,0xe0,0x7f ) );
69 p.addBrush( QColor( 0x70,0xe0,0xa4 ) );
70 p.addBrush( QColor( 0x70,0xe0,0xc9 ) );
71 p.addBrush( QColor( 0x70,0xd1,0xe0 ) );
72 p.addBrush( QColor( 0x70,0xac,0xe0 ) );
73 p.addBrush( QColor( 0x70,0x86,0xe0 ) );
74 p.addBrush( QColor( 0x7f,0x70,0xe0 ) );
75 p.addBrush( QColor( 0xa4,0x70,0xe0 ) );
76 p.addBrush( QColor( 0xc9,0x70,0xe0 ) );
77 p.addBrush( QColor( 0xe0,0x70,0xd1 ) );
78 p.addBrush( QColor( 0xe0,0x70,0xac ) );
79 p.addBrush( QColor( 0xe0,0x70,0x86 ) );
80
81 return p;
82 }
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const KDChart::PieAttributes &a)
107 {
108 dbg << "KDChart::PieAttributes(";
109 dbg << "explodeFactor="<< a.explodeFactor() << ")";
110 return dbg;
111 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::PieAttributes &)
• Q_DECLARE_TYPEINFO (KDChart::PieAttributes, Q_MOVABLE_TYPE)
107 {
108 dbg << "KDChart::PieAttributes(";
109 dbg << "explodeFactor="<< a.explodeFactor() << ")";
110 return dbg;
111 }
Defines
• #define d d_func()
Functions
• QRectF buildReferenceRect (const PolarCoordinatePlane ∗plane)
114 {
115 QRectF contentsRect;
116 //qDebug() << "..........................................";
117 QPointF referencePointAtTop = plane->translate( QPointF( 1, 0 ) );
118 QPointF temp = plane->translate( QPointF( 0, 0 ) ) - referencePointAtTop;
119 const double offset = temp.y();
120 referencePointAtTop.setX( referencePointAtTop.x() - offset );
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Namespaces
• namespace KDChart
#include <KDChartPosition.h>
#include <KDChartEnums.h>
#include <QString>
#include <QStringList>
#include <QList>
#include <QByteArray>
#include <KDABLibFakes>
#include <cassert>
Include dependency graph for KDChartPosition.cpp:
Functions
Variables
• int maxPositionValue = 9
• Position staticPositionCenter = Position( KDChartEnums::PositionCenter )
• Position staticPositionEast = Position( KDChartEnums::PositionEast )
• const char ∗ staticPositionNames [ ]
• Position staticPositionNorth = Position( KDChartEnums::PositionNorth )
• Position staticPositionNorthEast = Position( KDChartEnums::PositionNorthEast )
• Position staticPositionNorthWest = Position( KDChartEnums::PositionNorthWest )
• Position staticPositionSouth = Position( KDChartEnums::PositionSouth )
• Position staticPositionSouthEast = Position( KDChartEnums::PositionSouthEast )
• Position staticPositionSouthWest = Position( KDChartEnums::PositionSouthWest )
• Position staticPositionUnknown = Position( KDChartEnums::PositionUnknown )
• Position staticPositionWest = Position( KDChartEnums::PositionWest )
248 {
249 dbg << "KDChart::Position("
250 << p.name() << ")";
251 return dbg;
252 }
Initial value:
{
QT_TRANSLATE_NOOP("Position","Unknown Position"),
QT_TRANSLATE_NOOP("Position","Center"),
QT_TRANSLATE_NOOP("Position","NorthWest"),
QT_TRANSLATE_NOOP("Position","North"),
QT_TRANSLATE_NOOP("Position","NorthEast"),
QT_TRANSLATE_NOOP("Position","East"),
QT_TRANSLATE_NOOP("Position","SouthEast"),
QT_TRANSLATE_NOOP("Position","South"),
QT_TRANSLATE_NOOP("Position","SouthWest"),
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::Position &)
• Q_DECLARE_TYPEINFO (KDChart::Position, Q_MOVABLE_TYPE)
248 {
249 dbg << "KDChart::Position("
250 << p.name() << ")";
251 return dbg;
252 }
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const KDChart::RelativePosition &rp)
149 {
150 dbg << "KDChart::RelativePosition("
151 << "referencearea="<<rp.referenceArea()
152 << "referenceposition="<<rp.referencePosition()
153 << "alignment="<<rp.alignment()
154 << "horizontalpadding="<<rp.horizontalPadding()
155 << "verticalpadding="<<rp.verticalPadding()
156 << "rotation="<<rp.rotation()
157 << ")";
158 return dbg;
159 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::RelativePosition &)
• Q_DECLARE_TYPEINFO (KDChart::RelativePosition, Q_MOVABLE_TYPE)
149 {
150 dbg << "KDChart::RelativePosition("
151 << "referencearea="<<rp.referenceArea()
152 << "referenceposition="<<rp.referencePosition()
153 << "alignment="<<rp.alignment()
154 << "horizontalpadding="<<rp.horizontalPadding()
155 << "verticalpadding="<<rp.verticalPadding()
156 << "rotation="<<rp.rotation()
157 << ")";
158 return dbg;
159 }
Defines
• #define d d_func()
Namespaces
• namespace KDChart
Namespaces
• namespace KDChart
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const KDChart::TextAttributes &ta)
193 {
194 dbg << "KDChart::TextAttributes("
195 << "visible="<<ta.isVisible()
196 << "font="<<ta.font().toString() /* What? No QDebug for QFont? */
197 << "fontsize="<<ta.fontSize()
198 << "minimalfontsize="<<ta.minimalFontSize()
199 << "autorotate="<<ta.autoRotate()
200 << "autoshrink="<<ta.autoShrink()
201 << "rotation="<<ta.rotation()
202 << "pen="<<ta.pen()
203 << ")";
204 return dbg;
205 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::TextAttributes &)
• Q_DECLARE_TYPEINFO (KDChart::TextAttributes, Q_MOVABLE_TYPE)
193 {
194 dbg << "KDChart::TextAttributes("
195 << "visible="<<ta.isVisible()
196 << "font="<<ta.font().toString() /* What? No QDebug for QFont? */
197 << "fontsize="<<ta.fontSize()
198 << "minimalfontsize="<<ta.minimalFontSize()
199 << "autorotate="<<ta.autoRotate()
200 << "autoshrink="<<ta.autoShrink()
201 << "rotation="<<ta.rotation()
202 << "pen="<<ta.pen()
203 << ")";
204 return dbg;
205 }
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const KDChart::ThreeDBarAttributes &a)
106 {
107 dbg << "KDChart::ThreeDBarAttributes(";
108 dbg = operator <<( dbg, static_cast<const AbstractThreeDAttributes&>(a) );
109 dbg << "useShadowColors="<< a.useShadowColors()
110 << "angle=" << a.angle() << ")";
111 return dbg;
112 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::ThreeDBarAttributes &)
• Q_DECLARE_TYPEINFO (KDChart::ThreeDBarAttributes, Q_MOVABLE_TYPE)
106 {
107 dbg << "KDChart::ThreeDBarAttributes(";
108 dbg = operator <<( dbg, static_cast<const AbstractThreeDAttributes&>(a) );
109 dbg << "useShadowColors="<< a.useShadowColors()
110 << "angle=" << a.angle() << ")";
111 return dbg;
112 }
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const KDChart::ThreeDLineAttributes &a)
107 {
108 dbg << "KDChart::ThreeDLineAttributes(";
109 dbg = operator <<( dbg, static_cast<const AbstractThreeDAttributes&>(a) );
110 dbg << " lineXRotation="<< a.lineXRotation()
111 << " lineYRotation="<< a.lineYRotation()
112 << ")";
113 return dbg;
114 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::ThreeDLineAttributes &)
• Q_DECLARE_TYPEINFO (KDChart::ThreeDLineAttributes, Q_MOVABLE_TYPE)
107 {
108 dbg << "KDChart::ThreeDLineAttributes(";
109 dbg = operator <<( dbg, static_cast<const AbstractThreeDAttributes&>(a) );
110 dbg << " lineXRotation="<< a.lineXRotation()
111 << " lineYRotation="<< a.lineYRotation()
112 << ")";
113 return dbg;
114 }
Defines
• #define d d_func()
Functions
• QDebug operator<< (QDebug dbg, const KDChart::ThreeDPieAttributes &a)
93 {
94 dbg << "KDChart::ThreeDPieAttributes(";
95 dbg = operator <<( dbg, static_cast<const AbstractThreeDAttributes&>(a) );
96 dbg << "useShadowColors="<< a.useShadowColors() << ")";
97 return dbg;
98 }
Namespaces
• namespace KDChart
Functions
• KDCHART_EXPORT QDebug operator<< (QDebug, const KDChart::ThreeDPieAttributes &)
• Q_DECLARE_TYPEINFO (KDChart::ThreeDPieAttributes, Q_MOVABLE_TYPE)
93 {
94 dbg << "KDChart::ThreeDPieAttributes(";
95 dbg = operator <<( dbg, static_cast<const AbstractThreeDAttributes&>(a) );
96 dbg << "useShadowColors="<< a.useShadowColors() << ")";
97 return dbg;
98 }
Defines
• #define d d_func()
• #define SET_SUB_TYPE(DIAGRAM, SUBTYPE)
• #define TEST_SUB_TYPE(DIAGRAM, INTERNALSUBTYPE, SUBTYPE)
Functions
• bool isCartesian (KDChart::Widget::ChartType type)
• bool isPolar (KDChart::Widget::ChartType type)
Value:
{ \
if( DIAGRAM ) \
DIAGRAM->setType( SUBTYPE ); \
}
Referenced by KDChart::Widget::setSubType().
Value:
{ \
if( DIAGRAM && DIAGRAM->type() == INTERNALSUBTYPE ) \
retVal = SUBTYPE; \
}
361 {
362 return (type == KDChart::Widget::Bar || type == KDChart::Widget::Line);
363 }
366 {
367 return (type == KDChart::Widget::Pie
368 || type == KDChart::Widget::Ring
369 || type == KDChart::Widget::Polar );
370 }
Namespaces
• namespace KDChart
Namespaces
• namespace KDChart
Classes
• class KDTextDocument
areaGeometry axesCalcModeY
KDChart::AbstractArea, 31 KDChart::CartesianCoordinatePlane, 299
KDChart::AbstractAreaBase, 39
KDChart::AbstractAreaWidget, 44 BackgroundAttributes, 11
KDChart::AbstractAxis, 52 KDChart::BackgroundAttributes, 220
KDChart::AbstractCoordinatePlane, 97 backgroundAttributes
KDChart::CartesianAxis, 269 KDChart::AbstractArea, 31
KDChart::CartesianCoordinatePlane, 299 KDChart::AbstractAreaBase, 39
KDChart::HeaderFooter, 372 KDChart::AbstractAreaWidget, 44
KDChart::Legend, 406 KDChart::AbstractAxis, 52
KDChart::PolarCoordinatePlane, 535 KDChart::AbstractCoordinatePlane, 97
KDChart::TextArea, 644 KDChart::CartesianAxis, 269
attributes KDChart::CartesianCoordinatePlane, 299
KDChartAbstractAreaBase.cpp, 709 KDChart::DataValueAttributes, 356
AttributesModel KDChart::HeaderFooter, 372
KDChart::AttributesModel, 210 KDChart::Legend, 406
attributesModel KDChart::PolarCoordinatePlane, 535
KDChart::AbstractCartesianDiagram, 68 KDChart::TextArea, 645
KDChart::AbstractDiagram, 119 BackgroundPixmapMode
KDChart::AbstractPieDiagram, 149 KDChart::BackgroundAttributes, 219
KDChart::AbstractPolarDiagram, 180 BackgroundPixmapModeCentered
KDChart::BarDiagram, 231 KDChart::BackgroundAttributes, 219
KDChart::LineDiagram, 437 BackgroundPixmapModeNone
KDChart::PieDiagram, 499 KDChart::BackgroundAttributes, 219
KDChart::PolarDiagram, 562 BackgroundPixmapModeScaled
KDChart::RingDiagram, 613 KDChart::BackgroundAttributes, 219
attributesModelRootIndex BackgroundPixmapModeStretched
KDChart::AbstractCartesianDiagram, 69 KDChart::BackgroundAttributes, 219
KDChart::AbstractDiagram, 119 Bar
KDChart::AbstractPieDiagram, 149 KDChart::Widget, 692
KDChart::AbstractPolarDiagram, 181 BarAttributes, 12
KDChart::BarDiagram, 232 KDChart::BarAttributes, 222
KDChart::LineDiagram, 438 barAttributes
KDChart::PieDiagram, 500 KDChart::BarDiagram, 232, 233
KDChart::PolarDiagram, 562 BarAttributesRole
KDChart::RingDiagram, 613 KDChart, 19
autoReferenceArea BarDiagram
KDChart::HeaderFooter, 372 KDChart::BarDiagram, 230
KDChart::TextArea, 644 barDiagram
KDChart::TextLayoutItem, 663 KDChart::Widget, 694
autoRotate barGapFactor
KDChart::TextAttributes, 657 KDChart::BarAttributes, 222
autoShrink BarType
KDChart::TextAttributes, 657 KDChart::BarDiagram, 230
axes Bottom
KDChart::AbstractCartesianDiagram, 69 KDChart::CartesianAxis, 268
KDChart::BarDiagram, 232 bottom
KDChart::LineDiagram, 438 KDChart::Widget, 702
AxesCalcMode brush
KDChart::AbstractCoordinatePlane, 96 KDChart::AbstractCartesianDiagram, 69,
KDChart::CartesianCoordinatePlane, 297 70
KDChart::PolarCoordinatePlane, 533 KDChart::AbstractDiagram, 119, 120
axesCalcModeX KDChart::AbstractPieDiagram, 150
KDChart::CartesianCoordinatePlane, 299 KDChart::AbstractPolarDiagram, 181, 182
d KDChart::AbstractCartesianDiagram, 72
KDChartAbstractAreaBase.cpp, 709 KDChart::AbstractDiagram, 122
KDChartAbstractAreaWidget.cpp, 714 KDChart::AbstractPieDiagram, 152
KDChartAbstractAxis.cpp, 716 KDChart::AbstractPolarDiagram, 184
KDChartAbstractCartesianDiagram.cpp, KDChart::BarDiagram, 238
718 KDChart::LineDiagram, 443
KDChartAbstractCoordinatePlane.cpp, 720 KDChart::PieDiagram, 503
KDChartAbstractDiagram.cpp, 722 KDChart::PolarDiagram, 566
KDChartAbstractPieDiagram.cpp, 724 KDChart::RingDiagram, 617
KDChartAbstractPolarDiagram.cpp, 726 DataDimension
KDChartAbstractThreeDAttributes.cpp, KDChart::DataDimension, 342, 343
730 DataDimensionsList
KDChartBackgroundAttributes.cpp, 734 KDChart, 19
KDChartBarAttributes.cpp, 736 dataLabel
KDChartBarDiagram.cpp, 738 KDChart::DataValueAttributes, 356
KDChartCartesianAxis.cpp, 740 datasetBrushes
KDChartCartesianCoordinatePlane.cpp, KDChart::AbstractCartesianDiagram, 72
742 KDChart::AbstractDiagram, 122
KDChartChart.cpp, 745 KDChart::AbstractPieDiagram, 153
KDChartDataValueAttributes.cpp, 751 KDChart::AbstractPolarDiagram, 184
KDChartFrameAttributes.cpp, 757 KDChart::BarDiagram, 238
KDChartGridAttributes.cpp, 764 KDChart::LineDiagram, 443
KDChartHeaderFooter.cpp, 766 KDChart::PieDiagram, 503
KDChartLegend.cpp, 770 KDChart::PolarDiagram, 566
KDChartLineAttributes.cpp, 772 KDChart::RingDiagram, 617
KDChartLineDiagram.cpp, 774 DatasetBrushRole
KDChartMarkerAttributes.cpp, 776 KDChart, 19
KDChartPaintContext.cpp, 780 datasetCount
KDChartPalette.cpp, 782 KDChart::Legend, 410
KDChartPieAttributes.cpp, 785 DatasetDescriptionVector
KDChartPieDiagram.cpp, 787 KDChart, 19
KDChartPolarCoordinatePlane.cpp, 790 datasetDimension
KDChartPolarDiagram.cpp, 792 KDChart::AbstractCartesianDiagram, 72
KDChartRelativePosition.cpp, 798 KDChart::AbstractDiagram, 123
KDChartRingDiagram.cpp, 800 KDChart::AbstractPieDiagram, 153
KDChartTextAttributes.cpp, 804 KDChart::AbstractPolarDiagram, 185
KDChartThreeDBarAttributes.cpp, 806 KDChart::BarDiagram, 238
KDChartThreeDLineAttributes.cpp, 808 KDChart::LineDiagram, 444
KDChartThreeDPieAttributes.cpp, 810 KDChart::PieDiagram, 504
KDChartWidget.cpp, 812 KDChart::PolarDiagram, 567
data KDChart::RingDiagram, 618
KDChart::AttributesModel, 211, 212 datasetLabels
KDChart::DatasetProxyModel, 346 KDChart::AbstractCartesianDiagram, 73
dataBoundaries KDChart::AbstractDiagram, 123
KDChart::AbstractCartesianDiagram, 71 KDChart::AbstractPieDiagram, 154
KDChart::AbstractDiagram, 121 KDChart::AbstractPolarDiagram, 185
KDChart::AbstractPieDiagram, 152 KDChart::BarDiagram, 239
KDChart::AbstractPolarDiagram, 183 KDChart::LineDiagram, 444
KDChart::BarDiagram, 237 KDChart::PieDiagram, 504
KDChart::LineDiagram, 442 KDChart::PolarDiagram, 567
KDChart::PieDiagram, 503 KDChart::RingDiagram, 618
KDChart::PolarDiagram, 565 datasetMarkers
KDChart::RingDiagram, 616 KDChart::AbstractCartesianDiagram, 73
dataChanged KDChart::AbstractDiagram, 123
KDChart::AbstractAreaBase, 38 paint, 55
KDChart::AbstractAreaBase paintAll, 55
∼AbstractAreaBase, 38 paintBackground, 56
AbstractAreaBase, 38 paintCtx, 57
alignToReferencePoint, 39 paintFrame, 57
areaGeometry, 39 paintIntoRect, 58
backgroundAttributes, 39 positionHasChanged, 58
frameAttributes, 39 Q_SLOTS, 62
innerRect, 39 removeFromParentLayout, 58
paintBackground, 40 setBackgroundAttributes, 59
paintFrame, 41 setFrameAttributes, 59
positionHasChanged, 41 setGeometry, 59
setBackgroundAttributes, 41 setLabels, 59
setFrameAttributes, 42 setParentLayout, 60
KDChart::AbstractAreaWidget, 43 setParentWidget, 60
KDChart::AbstractAreaWidget setShortLabels, 60
∼AbstractAreaWidget, 44 setTextAttributes, 60
__pad0__, 49 shortLabels, 61
AbstractAreaWidget, 44 sizeHintChanged, 61
alignToReferencePoint, 44 textAttributes, 61
areaGeometry, 44 KDChart::AbstractCartesianDiagram, 63
backgroundAttributes, 44 KDChart::AbstractCartesianDiagram
forceRebuild, 44 ∼AbstractCartesianDiagram, 67
frameAttributes, 45 __pad0__, 92
innerRect, 45 AbstractCartesianDiagram, 67
paint, 45 addAxis, 67
paintAll, 46 allowOverlappingDataValueTexts, 68
paintBackground, 46 antiAliasing, 68
paintEvent, 47 attributesModel, 68
paintFrame, 47 attributesModelRootIndex, 69
paintIntoRect, 48 axes, 69
positionHasChanged, 48 brush, 69, 70
setBackgroundAttributes, 48 calculateDataBoundaries, 70
setFrameAttributes, 49 checkInvariants, 70
KDChart::AbstractAxis, 50 columnToIndex, 71
KDChart::AbstractAxis coordinatePlane, 71
∼AbstractAxis, 52 dataBoundaries, 71
__pad0__, 62 dataChanged, 72
AbstractAxis, 52 datasetBrushes, 72
alignToReferencePoint, 52 datasetDimension, 72
areaGeometry, 52 datasetLabels, 73
backgroundAttributes, 52 datasetMarkers, 73
connectSignals, 53 datasetPens, 74
coordinatePlane, 53 dataValueAttributes, 74, 75
createObserver, 53 doItemsLayout, 75
deleteObserver, 54 horizontalOffset, 75
diagram, 54 indexAt, 76
frameAttributes, 54 isIndexHidden, 76
geometry, 54 itemRowLabels, 76
innerRect, 54 layoutPlanes, 76
labels, 55 modelsChanged, 77
mParent, 62 moveCursor, 77
mParentLayout, 62 numberOfAbscissaSegments, 77
observedBy, 55 numberOfOrdinateSegments, 77
paint, 77 getDataDimensionsList, 99
paintDataValueText, 77 globalGridAttributes, 99
paintDataValueTexts, 78 gridDimensionsList, 100
paintMarker, 78, 79 innerRect, 100
paintMarkers, 81 isEmpty, 101
pen, 81, 82 layoutDiagrams, 101
percentMode, 82 layoutPlanes, 101
propertiesChanged, 82 maximumSize, 101
referenceDiagram, 82 minimumSize, 102
referenceDiagramOffset, 83 minimumSizeHint, 102
resize, 83 mParent, 113
scrollTo, 83 mParentLayout, 113
setAllowOverlappingDataValueTexts, 83 needLayoutPlanes, 102
setAntiAliasing, 84 needRelayout, 102
setAttributesModel, 84 needUpdate, 102
setAttributesModelRootIndex, 85 paint, 102
setBrush, 85 paintAll, 103
setCoordinatePlane, 85 paintBackground, 103
setDataBoundariesDirty, 86 paintCtx, 104
setDatasetDimension, 86 paintFrame, 104
setDataValueAttributes, 87 paintIntoRect, 105
setModel, 88 parent, 105
setPen, 88 positionHasChanged, 106
setPercentMode, 89 propertiesChanged, 106
setReferenceDiagram, 89 Q_SLOTS, 113
setRootIndex, 89 referenceCoordinatePlane, 106
setSelection, 89 relayout, 106
takeAxis, 89 removeFromParentLayout, 107
threeDItemDepth, 90 replaceDiagram, 107
update, 90 setBackgroundAttributes, 108
useDefaultColors, 90 setFrameAttributes, 108
useRainbowColors, 90 setGeometry, 108
useSubduedColors, 91 setGlobalGridAttributes, 108
valueForCell, 91 setParent, 109
verticalOffset, 91 setParentLayout, 109
visualRect, 91 setParentWidget, 109
visualRegionForSelection, 92 setReferenceCoordinatePlane, 110
KDChart::AbstractCoordinatePlane, 93 setZoomCenter, 110
Linear, 96 setZoomFactorX, 110
Logarithmic, 96 setZoomFactorY, 110
KDChart::AbstractCoordinatePlane sizeHint, 111
∼AbstractCoordinatePlane, 96 sizeHintChanged, 111
__pad0__, 113 sizePolicy, 111
AbstractCoordinatePlane, 96 takeDiagram, 111
addDiagram, 96 translate, 112
alignToReferencePoint, 97 zoomCenter, 112
areaGeometry, 97 zoomFactorX, 112
AxesCalcMode, 96 zoomFactorY, 113
backgroundAttributes, 97 KDChart::AbstractDiagram, 114
diagram, 97 KDChart::AbstractDiagram
diagrams, 98 ∼AbstractDiagram, 118
expandingDirections, 98 __pad0__, 140
frameAttributes, 99 AbstractDiagram, 118
geometry, 99 allowOverlappingDataValueTexts, 118
RingDiagram setAttributesModel
KDChart::RingDiagram, 612 KDChart::AbstractCartesianDiagram, 84
ringDiagram KDChart::AbstractDiagram, 133
KDChart::Widget, 698 KDChart::AbstractPieDiagram, 165
rotateCircularLabels KDChart::AbstractPolarDiagram, 196
KDChart::PolarDiagram, 578 KDChart::BarDiagram, 253
rotation KDChart::LineDiagram, 460
KDChart::RelativePosition, 607 KDChart::PieDiagram, 519
KDChart::TextAttributes, 658 KDChart::PolarDiagram, 579
rowCount KDChart::RingDiagram, 631
KDChart::AttributesModel, 216 setAttributesModelRootIndex
Rows KDChart::AbstractCartesianDiagram, 85
KDChart::BarDiagram, 230 KDChart::AbstractDiagram, 133
KDChart::Widget, 692 KDChart::AbstractPieDiagram, 166
KDChart::AbstractPolarDiagram, 196
scrollTo KDChart::BarDiagram, 254
KDChart::AbstractCartesianDiagram, 83 KDChart::LineDiagram, 461
KDChart::AbstractDiagram, 132 KDChart::PieDiagram, 520
KDChart::AbstractPieDiagram, 164 KDChart::PolarDiagram, 580
KDChart::AbstractPolarDiagram, 195 KDChart::RingDiagram, 631
KDChart::BarDiagram, 252 setAutoReferenceArea
KDChart::LineDiagram, 459 KDChart::HeaderFooter, 379
KDChart::PieDiagram, 518 KDChart::TextArea, 651
KDChart::PolarDiagram, 579 KDChart::TextLayoutItem, 666
KDChart::RingDiagram, 630 setAutoRotate
sequence KDChart::TextAttributes, 658
KDChart::DataDimension, 344 setAutoShrink
SET_SUB_TYPE KDChart::TextAttributes, 658
KDChartWidget.cpp, 812 setAxesCalcModes
setAlignment KDChart::CartesianCoordinatePlane, 316
KDChart::Legend, 419 setAxesCalcModeX
KDChart::RelativePosition, 607 KDChart::CartesianCoordinatePlane, 316
setAllowOverlappingDataValueTexts setAxesCalcModeY
KDChart::AbstractCartesianDiagram, 83 KDChart::CartesianCoordinatePlane, 316
KDChart::AbstractDiagram, 132 setBackgroundAttributes
KDChart::AbstractPieDiagram, 164 KDChart::AbstractArea, 35
KDChart::AbstractPolarDiagram, 195 KDChart::AbstractAreaBase, 41
KDChart::BarDiagram, 253 KDChart::AbstractAreaWidget, 48
KDChart::LineDiagram, 460 KDChart::AbstractAxis, 59
KDChart::PieDiagram, 519 KDChart::AbstractCoordinatePlane, 108
KDChart::PolarDiagram, 579 KDChart::CartesianAxis, 287
KDChart::RingDiagram, 630 KDChart::CartesianCoordinatePlane, 317
setAngle KDChart::DataValueAttributes, 358
KDChart::ThreeDBarAttributes, 672 KDChart::HeaderFooter, 380
setAntiAliasing KDChart::Legend, 419
KDChart::AbstractCartesianDiagram, 84 KDChart::PolarCoordinatePlane, 548
KDChart::AbstractDiagram, 132 KDChart::TextArea, 652
KDChart::AbstractPieDiagram, 165 setBarAttributes
KDChart::AbstractPolarDiagram, 195 KDChart::BarDiagram, 254, 255
KDChart::BarDiagram, 253 setBarGapFactor
KDChart::LineDiagram, 460 KDChart::BarAttributes, 223
KDChart::PieDiagram, 519 setBrush
KDChart::PolarDiagram, 579 KDChart::AbstractCartesianDiagram, 85
KDChart::RingDiagram, 630 KDChart::AbstractDiagram, 134
KDChart::AbstractAxis, 59 setGridVisible
KDChart::AbstractCoordinatePlane, 108 KDChart::GridAttributes, 367
KDChart::CartesianAxis, 287 setGroupGapFactor
KDChart::CartesianCoordinatePlane, 317 KDChart::BarAttributes, 223
KDChart::DataValueAttributes, 358 setHeaderData
KDChart::HeaderFooter, 380 KDChart::AttributesModel, 216
KDChart::Legend, 421 setHorizontalPadding
KDChart::PolarCoordinatePlane, 549 KDChart::RelativePosition, 607
KDChart::TextArea, 652 setHorizontalRange
setGeometry KDChart::CartesianCoordinatePlane, 319
KDChart::AbstractAxis, 59 setIsometricScaling
KDChart::AbstractCoordinatePlane, 108 KDChart::CartesianCoordinatePlane, 319
KDChart::CartesianAxis, 288 setLabels
KDChart::CartesianCoordinatePlane, 317 KDChart::AbstractAxis, 59
KDChart::HeaderFooter, 380 KDChart::CartesianAxis, 288
KDChart::HorizontalLineLayoutItem, 387 setLineAttributes
KDChart::MarkerLayoutItem, 478 KDChart::LineDiagram, 464, 465
KDChart::PolarCoordinatePlane, 549 setLineXRotation
KDChart::TextArea, 652 KDChart::ThreeDLineAttributes, 678
KDChart::TextLayoutItem, 666 setLineYRotation
KDChart::VerticalLineLayoutItem, 686 KDChart::ThreeDLineAttributes, 678
setGlobalGridAttributes setMarkerAttributes
KDChart::AbstractCoordinatePlane, 108 KDChart::DataValueAttributes, 359
KDChart::CartesianCoordinatePlane, 318 KDChart::Legend, 421
KDChart::PolarCoordinatePlane, 549 setMarkerColor
setGlobalLeading KDChart::MarkerAttributes, 475
KDChart::Chart, 337 setMarkerSize
setGlobalLeadingBottom KDChart::MarkerAttributes, 475
KDChart::Chart, 338 setMarkerStyle
KDChart::Widget, 699 KDChart::MarkerAttributes, 475
setGlobalLeadingLeft setMarkerStylesMap
KDChart::Chart, 338 KDChart::MarkerAttributes, 475
KDChart::Widget, 699 setMinimalFontSize
setGlobalLeadingRight KDChart::TextAttributes, 659
KDChart::Chart, 338 setMissingValuesPolicy
KDChart::Widget, 700 KDChart::LineAttributes, 429
setGlobalLeadingTop setModel
KDChart::Chart, 339 KDChart::AbstractCartesianDiagram, 88
KDChart::Widget, 700 KDChart::AbstractDiagram, 136
setGranularity KDChart::AbstractPieDiagram, 169
KDChart::AbstractPieDiagram, 169 KDChart::AbstractPolarDiagram, 199
KDChart::PieDiagram, 523 KDChart::BarDiagram, 258
KDChart::RingDiagram, 634 KDChart::LineDiagram, 465
setGridAttributes KDChart::PieDiagram, 523
KDChart::CartesianCoordinatePlane, 318 KDChart::PolarDiagram, 583
KDChart::PolarCoordinatePlane, 550 KDChart::RingDiagram, 635
setGridGranularitySequence setModelData
KDChart::GridAttributes, 367 KDChart::AttributesModel, 217
setGridPen setNeedRebuild
KDChart::GridAttributes, 367 KDChart::Legend, 421
setGridStepWidth setNegativePosition
KDChart::GridAttributes, 367 KDChart::DataValueAttributes, 359
setGridSubStepWidth setOrientation
KDChart::GridAttributes, 367 KDChart::Legend, 422
setPadding KDChart::AbstractCartesianDiagram, 89
KDChart::FrameAttributes, 365 KDChart::AbstractDiagram, 137
setPainter KDChart::AbstractPieDiagram, 170
KDChart::PaintContext, 486 KDChart::AbstractPolarDiagram, 200
setPaletteType KDChart::BarDiagram, 259
KDChart::AttributesModel, 217 KDChart::LineDiagram, 466
setParent KDChart::PieDiagram, 524
KDChart::AbstractCoordinatePlane, 109 KDChart::PolarDiagram, 584
KDChart::CartesianCoordinatePlane, 319 KDChart::RingDiagram, 636
KDChart::HeaderFooter, 380 setPieAttributes
KDChart::PolarCoordinatePlane, 550 KDChart::AbstractPieDiagram, 170
setParentLayout KDChart::PieDiagram, 524, 525
KDChart::AbstractArea, 35 KDChart::RingDiagram, 636
KDChart::AbstractAxis, 60 setPixmap
KDChart::AbstractCoordinatePlane, 109 KDChart::BackgroundAttributes, 220
KDChart::AbstractLayoutItem, 142 setPixmapMode
KDChart::CartesianAxis, 288 KDChart::BackgroundAttributes, 220
KDChart::CartesianCoordinatePlane, 320 setPosition
KDChart::HeaderFooter, 381 KDChart::CartesianAxis, 289
KDChart::HorizontalLineLayoutItem, 387 KDChart::HeaderFooter, 381
KDChart::MarkerLayoutItem, 479 KDChart::Legend, 422
KDChart::PolarCoordinatePlane, 551 setPositivePosition
KDChart::TextArea, 652 KDChart::DataValueAttributes, 359
KDChart::TextLayoutItem, 667 setPowerOfTenDivisor
KDChart::VerticalLineLayoutItem, 686 KDChart::DataValueAttributes, 359
setParentWidget setPrefix
KDChart::AbstractArea, 36 KDChart::DataValueAttributes, 359
KDChart::AbstractAxis, 60 setRainbowColors
KDChart::AbstractCoordinatePlane, 109 KDChart::Legend, 422
KDChart::AbstractLayoutItem, 142 setRectangle
KDChart::CartesianAxis, 288 KDChart::PaintContext, 486
KDChart::CartesianCoordinatePlane, 320 setReferenceArea
KDChart::HeaderFooter, 381 KDChart::Legend, 423
KDChart::HorizontalLineLayoutItem, 387 KDChart::Measure, 484
KDChart::MarkerLayoutItem, 479 KDChart::RelativePosition, 607
KDChart::PolarCoordinatePlane, 551 setReferenceCoordinatePlane
KDChart::TextArea, 653 KDChart::AbstractCoordinatePlane, 110
KDChart::TextLayoutItem, 667 KDChart::CartesianCoordinatePlane, 320
KDChart::VerticalLineLayoutItem, 686 KDChart::PolarCoordinatePlane, 551
setPen setReferenceDiagram
KDChart::AbstractCartesianDiagram, 88 KDChart::AbstractCartesianDiagram, 89
KDChart::AbstractDiagram, 137 KDChart::BarDiagram, 259
KDChart::AbstractPieDiagram, 169, 170 KDChart::LineDiagram, 466
KDChart::AbstractPolarDiagram, 199, 200 setReferenceOrientation
KDChart::BarDiagram, 258 KDChart::Measure, 485
KDChart::FrameAttributes, 365 setReferencePosition
KDChart::Legend, 422 KDChart::RelativePosition, 607
KDChart::LineDiagram, 465, 466 setRelativeMode
KDChart::MarkerAttributes, 475 KDChart::Measure, 485
KDChart::PieDiagram, 524 setRelativeThickness
KDChart::PolarDiagram, 583, 584 KDChart::RingDiagram, 636
KDChart::RingDiagram, 635, 636 setRootIndex
KDChart::TextAttributes, 659 KDChart::AbstractCartesianDiagram, 89
setPercentMode KDChart::AbstractDiagram, 138
KDChart::PieDiagram, 529
KDChart::PolarDiagram, 588
KDChart::RingDiagram, 641
visualRegionForSelection
KDChart::AbstractCartesianDiagram, 92
KDChart::AbstractDiagram, 140
KDChart::AbstractPieDiagram, 175
KDChart::AbstractPolarDiagram, 203
KDChart::BarDiagram, 264
KDChart::LineDiagram, 472
KDChart::PieDiagram, 529
KDChart::PolarDiagram, 588
KDChart::RingDiagram, 641
West
KDChart::Position, 597
Widget
KDChart::Widget, 692
xCenter
KDChart::ZoomParameters, 704
xFactor
KDChart::ZoomParameters, 704
yCenter
KDChart::ZoomParameters, 704
yFactor
KDChart::ZoomParameters, 704
zeroDegreePosition
KDChart::PolarDiagram, 588
zeroLinePen
KDChart::GridAttributes, 367
zoomCenter
KDChart::AbstractCoordinatePlane, 112
KDChart::CartesianCoordinatePlane, 324
KDChart::PolarCoordinatePlane, 554
zoomFactorX
KDChart::AbstractCoordinatePlane, 112
KDChart::CartesianCoordinatePlane, 324
KDChart::PolarCoordinatePlane, 555
zoomFactorY
KDChart::AbstractCoordinatePlane, 113
KDChart::CartesianCoordinatePlane, 324
KDChart::PolarCoordinatePlane, 555
ZoomParameters
KDChart::ZoomParameters, 704