File indexing completed on 2024-05-12 04:20:35
0001 /* 0002 * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved. 0003 * 0004 * This file is part of the KD Chart library. 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef KCHARTLINEATTRIBUTES_H 0010 #define KCHARTLINEATTRIBUTES_H 0011 0012 #include <QMetaType> 0013 #include "KChartGlobal.h" 0014 0015 namespace KChart { 0016 0017 /** 0018 * @brief Set of attributes for changing the appearance of line charts 0019 */ 0020 class KCHART_EXPORT LineAttributes 0021 { 0022 public: 0023 /** 0024 \brief MissingValuesPolicy specifies how a missing value will be shown in a line diagram. 0025 0026 Missing value is assumed if the data cell contains a QVariant that can not be 0027 interpreted as a qreal, or if the data cell is hidden while its dataset is not hidden. 0028 0029 \li \c MissingValuesAreBridged the default: No markers will be shown for missing values 0030 but the line will be bridged if there is at least one valid cell before and after 0031 the missing value(s), otherwise the segment will be hidden. 0032 \li \c MissingValuesHideSegments Line segments starting with a missing value will 0033 not be shown, and no markers will be shown for missing values, so this will look like 0034 a piece of the line is missing. 0035 \li \c MissingValuesShownAsZero Missing value(s) will be treated like normal zero values, 0036 and markers will shown for them too, so there will be no visible difference between a 0037 zero value and a missing value. 0038 \li \c MissingValuesPolicyIgnored (internal value, do not use) 0039 0040 */ 0041 enum MissingValuesPolicy { 0042 MissingValuesAreBridged, 0043 MissingValuesHideSegments, 0044 MissingValuesShownAsZero, 0045 MissingValuesPolicyIgnored }; 0046 0047 LineAttributes(); 0048 LineAttributes( const LineAttributes& ); 0049 LineAttributes &operator= ( const LineAttributes& ); 0050 0051 ~LineAttributes(); 0052 0053 /* line chart and area chart - all types */ 0054 void setMissingValuesPolicy( MissingValuesPolicy policy ); 0055 MissingValuesPolicy missingValuesPolicy() const; 0056 0057 /* area chart - all types */ 0058 /** 0059 * Sets the lower or upper (depending on the displayed value being positive or 0060 * negative, resp.) bounding line (i.e., the dataset with the line data). The area 0061 * is then drawn between this line and the line of the specified dataset. 0062 * Pass -1 to draw the area between this line and the zero line. 0063 */ 0064 void setAreaBoundingDataset( int dataset ); 0065 int areaBoundingDataset() const; 0066 0067 /** 0068 * Determines if lines are to be drawn or not. This property does not 0069 * effect visibility of markers and text labels. 0070 * 0071 * This is useful for e.g. bubble charts where you need circular markers 0072 * but want no connecting lines to be drawn. 0073 * 0074 * By default lines are drawn, i.e. this property is true. 0075 */ 0076 void setVisible( bool visible ); 0077 bool isVisible() const; 0078 0079 void setDisplayArea( bool display ); 0080 bool displayArea() const; 0081 /*allows viewing the covered areas*/ 0082 void setTransparency( uint alpha ); 0083 uint transparency() const; 0084 0085 bool operator==( const LineAttributes& ) const; 0086 inline bool operator!=( const LineAttributes& other ) const { return !operator==(other); } 0087 0088 private: 0089 KCHART_DECLARE_PRIVATE_BASE_VALUE( LineAttributes ) 0090 }; // End of class LineAttributes 0091 0092 } 0093 0094 #if !defined(QT_NO_DEBUG_STREAM) 0095 KCHART_EXPORT QDebug operator<<(QDebug, const KChart::LineAttributes& ); 0096 #endif /* QT_NO_DEBUG_STREAM */ 0097 0098 KCHART_DECLARE_SWAP_SPECIALISATION( KChart::LineAttributes ) 0099 0100 QT_BEGIN_NAMESPACE 0101 Q_DECLARE_TYPEINFO( KChart::LineAttributes, Q_MOVABLE_TYPE ); 0102 QT_END_NAMESPACE 0103 0104 Q_DECLARE_METATYPE( KChart::LineAttributes ) 0105 0106 #endif // KCHARTLINEATTRIBUTES_H