The QXYSeries class is a base class for line, spline, and scatter series. 更多...
| 頭: |
#include <QXYSeries>
|
| 在 QML: | XYSeries |
| 繼承: | QAbstractSeries |
| 繼承者: |
(從 6.2 起)
枚舉類
|
PointConfiguration { Color, Size, Visibility, LabelVisibility, LabelFormat } |
|
|
| virtual | ~QXYSeries () |
| void | append (qreal x , qreal y ) |
| void | append (const QList<QPointF> & points ) |
| void | append (const QPointF & point ) |
| const QPointF & | at (int index ) const |
| QColor | bestFitLineColor () const |
(從 6.2 起)
QPair<qreal, qreal>
|
bestFitLineEquation (bool & ok ) const |
| bool | bestFitLineVisible () const |
| QBrush | brush () const |
| void | clear () |
(從 6.2 起)
void
|
clearPointConfiguration (const int index ) |
(從 6.2 起)
void
|
clearPointConfiguration (const int index , const QXYSeries::PointConfiguration key ) |
(從 6.2 起)
void
|
clearPointsConfiguration () |
(從 6.2 起)
void
|
clearPointsConfiguration (const QXYSeries::PointConfiguration key ) |
| virtual QColor | color () const |
(從 6.2 起)
void
|
colorBy (const QList<qreal> & sourceData , const QLinearGradient & gradient = QLinearGradient()) |
| int | count () const |
(從 6.2 起)
void
|
deselectAllPoints () |
(從 6.2 起)
void
|
deselectPoint (int index ) |
(從 6.2 起)
void
|
deselectPoints (const QList<int> & indexes ) |
| void | insert (int index , const QPointF & point ) |
(從 6.2 起)
bool
|
isPointSelected (int index ) |
(從 6.2 起)
const QImage &
|
lightMarker () const |
(從 6.2 起)
qreal
|
markerSize () const |
| QPen | pen () const |
(從 6.2 起)
QHash<QXYSeries::PointConfiguration, QVariant>
|
pointConfiguration (const int index ) const |
| bool | pointLabelsClipping () const |
| QColor | pointLabelsColor () const |
| QFont | pointLabelsFont () const |
| QString | pointLabelsFormat () const |
| bool | pointLabelsVisible () const |
| QList<QPointF> | points () const |
(從 6.2 起)
QXYSeries::PointsConfigurationHash
|
pointsConfiguration () const |
| bool | pointsVisible () const |
| void | remove (const QPointF & point ) |
| void | remove (int index ) |
| void | remove (qreal x , qreal y ) |
| void | removePoints (int index , int count ) |
| void | replace (const QList<QPointF> & points ) |
| void | replace (const QPointF & oldPoint , const QPointF & newPoint ) |
| void | replace (int index , const QPointF & newPoint ) |
| void | replace (int index , qreal newX , qreal newY ) |
| void | replace (qreal oldX , qreal oldY , qreal newX , qreal newY ) |
(從 6.2 起)
void
|
selectAllPoints () |
(從 6.2 起)
void
|
selectPoint (int index ) |
(從 6.2 起)
void
|
selectPoints (const QList<int> & indexes ) |
(從 6.2 起)
const QImage &
|
selectedLightMarker () const |
(從 6.2 起)
QList<int>
|
selectedPoints () const |
| void | setBestFitLineColor (const QColor & color ) |
| void | setBestFitLineVisible (bool visible = true) |
| virtual void | setBrush (const QBrush & brush ) |
| virtual void | setColor (const QColor & color ) |
(從 6.2 起)
void
|
setLightMarker (const QImage & lightMarker ) |
(從 6.2 起)
void
|
setMarkerSize (qreal size ) |
| virtual void | setPen (const QPen & pen ) |
(從 6.2 起)
void
|
setPointConfiguration (const int index , const QHash<QXYSeries::PointConfiguration, QVariant> & configuration ) |
(從 6.2 起)
void
|
setPointConfiguration (const int index , const QXYSeries::PointConfiguration key , const QVariant & value ) |
| void | setPointLabelsClipping (bool enabled = true) |
| void | setPointLabelsColor (const QColor & color ) |
| void | setPointLabelsFont (const QFont & font ) |
| void | setPointLabelsFormat (const QString & format ) |
| void | setPointLabelsVisible (bool visible = true) |
(從 6.2 起)
void
|
setPointSelected (int index , bool selected ) |
(從 6.2 起)
void
|
setPointsConfiguration (const QHash<int, QHash<QXYSeries::PointConfiguration, QVariant>> & pointsConfiguration ) |
| void | setPointsVisible (bool visible = true) |
| void | setSelectedColor (const QColor & color ) |
(從 6.2 起)
void
|
setSelectedLightMarker (const QImage & selectedLightMarker ) |
(從 6.2 起)
void
|
sizeBy (const QList<qreal> & sourceData , const qreal minSize , const qreal maxSize ) |
(從 6.2 起)
void
|
toggleSelection (const QList<int> & indexes ) |
| QXYSeries & | operator<< (const QList<QPointF> & points ) |
| QXYSeries & | operator<< (const QPointF & point ) |
| void | bestFitLineColorChanged (const QColor & color ) |
| void | bestFitLineVisibilityChanged (bool visible ) |
| void | clicked (const QPointF & point ) |
| void | colorChanged (QColor color ) |
| void | doubleClicked (const QPointF & point ) |
| void | hovered (const QPointF & point , bool state ) |
(從 6.2 起)
void
|
lightMarkerChanged (const QImage & lightMarker ) |
| void | markerSizeChanged (qreal size ) |
| void | penChanged (const QPen & pen ) |
| void | pointAdded (int index ) |
| void | pointLabelsClippingChanged (bool clipping ) |
| void | pointLabelsColorChanged (const QColor & color ) |
| void | pointLabelsFontChanged (const QFont & font ) |
| void | pointLabelsFormatChanged (const QString & format ) |
| void | pointLabelsVisibilityChanged (bool visible ) |
| void | pointRemoved (int index ) |
| void | pointReplaced (int index ) |
| void | pointsRemoved (int index , int count ) |
| void | pointsReplaced () |
| void | pressed (const QPointF & point ) |
| void | released (const QPointF & point ) |
| void | selectedColorChanged (const QColor & color ) |
| void | selectedPointsChanged () |
QXYSeries supports displaying best fit line on a chart. Best fit line is a line through a chart that expresses the relationship between points.
[since 6.2]
enum class QXYSeries::
PointConfiguration
This enum value describes the particular configuration of a point.
| 常量 | 值 | 描述 |
|---|---|---|
QXYSeries::PointConfiguration::Color
|
0
|
This enum value can be used to change a point's color. If used together with QXYSeries::setPointConfiguration , the configuration's value should be a valid QColor . |
QXYSeries::PointConfiguration::Size
|
1
|
This enum value can be used to change a point's size. If used together with
QXYSeries::setPointConfiguration
, the configuration's value should be a number, such as
qreal
or
int
.
|
QXYSeries::PointConfiguration::Visibility
|
2
|
This enum value can be used to hide or show the point. If used together with QXYSeries::setPointConfiguration , the configuration's value should be boolean. |
QXYSeries::PointConfiguration::LabelVisibility
|
3
|
This enum value can be used to hide or show the label of the point. If used together with QXYSeries::setPointConfiguration , the configuration's value should be boolean. |
QXYSeries::PointConfiguration::LabelFormat (since Qt 6.5)
|
4
|
This enum value can be used to set custom label text per-point. If used together with QXYSeries::setPointConfiguration , the configuration's value should be a string. |
注意: If an empty string is set as the LabelFormat, it will be ignored, and the series pointLabelsFormat 會被使用。
該枚舉在 Qt 6.2 引入。
另請參閱 pointLabelsFormat and setPointConfiguration ().
[since 6.2]
bestFitLineColor
:
QColor
This property holds the color of best fit line.
該特性在 Qt 6.2 引入。
訪問函數:
| QColor | bestFitLineColor () const |
| void | setBestFitLineColor (const QColor & color ) |
通知程序信號:
| void | bestFitLineColorChanged (const QColor & color ) |
另請參閱 bestFitLineEquation and bestFitLineVisible .
[since 6.2]
bestFitLineVisible
:
bool
This property holds the visibility of the best fit line.
此特性是
false
在默認情況下。
該特性在 Qt 6.2 引入。
訪問函數:
| bool | bestFitLineVisible () const |
| void | setBestFitLineVisible (bool visible = true) |
通知程序信號:
| void | bestFitLineVisibilityChanged (bool visible ) |
另請參閱 bestFitLineEquation .
此特性保持係列的顔色。
This is the line (pen) color in case of QLineSeries or QSplineSeries and the fill (brush) color in case of QScatterSeries or QAreaSeries .
訪問函數:
| virtual QColor | color () const |
| virtual void | setColor (const QColor & color ) |
通知程序信號:
| void | colorChanged (QColor color ) |
This property holds the clipping for data point labels.
此特性是
true
by default. The labels on the edge of the plot area are cut when clipping is enabled.
訪問函數:
| bool | pointLabelsClipping () const |
| void | setPointLabelsClipping (bool enabled = true) |
通知程序信號:
| void | pointLabelsClippingChanged (bool clipping ) |
另請參閱 pointLabelsVisible .
This property holds the color used for data point labels. By default, the color is the color of the brush defined in theme for labels.
訪問函數:
| QColor | pointLabelsColor () const |
| void | setPointLabelsColor (const QColor & color ) |
通知程序信號:
| void | pointLabelsColorChanged (const QColor & color ) |
另請參閱 pointLabelsFormat .
This property holds the font used for data point labels.
訪問函數:
| QFont | pointLabelsFont () const |
| void | setPointLabelsFont (const QFont & font ) |
通知程序信號:
| void | pointLabelsFontChanged (const QFont & font ) |
另請參閱 pointLabelsFormat .
This property holds the format used for showing labels with data points.
QXYSeries supports the following format tags:
| @index | The index in the series of the data point. [since 6.5] |
| @xPoint | The x-coordinate of the data point. |
| @yPoint | The y-coordinate of the data point. |
For example, the following usage of the format tags would produce labels that display the data point shown inside brackets separated by a comma (x, y):
series->setPointLabelsFormat("@index: (@xPoint, @yPoint)");
By default, the labels' format is set to
@xPoint, @yPoint
. The labels are shown on the plot area, and the labels on the edge of the plot area are cut. If the points are close to each other, the labels may overlap.
訪問函數:
| QString | pointLabelsFormat () const |
| void | setPointLabelsFormat (const QString & format ) |
通知程序信號:
| void | pointLabelsFormatChanged (const QString & format ) |
另請參閱 pointLabelsVisible , pointLabelsFont ,和 pointLabelsColor .
此特性保持數據點標簽的可見性。
此特性是
false
在默認情況下。
訪問函數:
| bool | pointLabelsVisible () const |
| void | setPointLabelsVisible (bool visible = true) |
通知程序信號:
| void | pointLabelsVisibilityChanged (bool visible ) |
另請參閱 pointLabelsFormat and pointLabelsClipping .
This property holds whether the data points are visible and should be drawn.
訪問函數:
| bool | pointsVisible () const |
| void | setPointsVisible (bool visible = true) |
[since 6.2]
selectedColor
:
QColor
This property holds the color of the selected points.
This is the fill (brush) color of points marked as selected. If not specified, value of QXYSeries::color is used as default.
該特性在 Qt 6.2 引入。
訪問函數:
| virtual QColor | color () const |
| void | setSelectedColor (const QColor & color ) |
通知程序信號:
| void | selectedColorChanged (const QColor & color ) |
另請參閱 color .
[virtual noexcept]
QXYSeries::
~QXYSeries
()
刪除係列。係列被添加到 QChart instances are owned by them, and are deleted when the QChart instances are deleted.
添加的數據點帶坐標 x and y 到係列。
Adds the list of data points specified by points 到係列。
這是重載函數。
添加數據點 point 到係列。
這是重載函數。
Returns the data point at the position specified by index in the internal series of points.
[signal]
void
QXYSeries::
bestFitLineColorChanged
(const
QColor
&
color
)
This signal is emitted when the color used for the best fit line changes to color .
注意: 通知程序信號對於特性 bestFitLineColor .
[since 6.2]
QPair
<
qreal
,
qreal
> QXYSeries::
bestFitLineEquation
(
bool
&
ok
) const
Returns a pair of numbers where the first number is a slope factor and the second number is intercept of a linear function for a best fit line.
Those factors are calculated using Least Squares Method based on points passed to the series.
參數
ok
is used to report a failure by setting its value to
false
and to report a success by setting its value to
true
.
該函數在 Qt 6.2 引入。
另請參閱 QXYSeries::bestFitLineVisible ().
[signal]
void
QXYSeries::
bestFitLineVisibilityChanged
(
bool
visible
)
This signal is emitted when the visibility of the best fit line changes to visible .
注意: 通知程序信號對於特性 bestFitLineVisible .
Returns the brush used to fill the data points for the series.
另請參閱 setBrush ().
從係列刪除所有點。
另請參閱 pointsRemoved ().
[since 6.2]
void
QXYSeries::
clearPointConfiguration
(const
int
index
)
Removes the configuration of a point located at index and restores the default look derived from the series' settings.
注意: It doesn't affect the configuration of other points.
該函數在 Qt 6.2 引入。
另請參閱 clearPointsConfiguration () 和 setPointConfiguration ().
[since 6.2]
void
QXYSeries::
clearPointConfiguration
(const
int
index
, const
QXYSeries::PointConfiguration
key
)
Removes the configuration property identified by key from the point at index and restores the default look derived from the series' settings.
Removes the configuration type, such as color or size, specified by key from the point at index with configuration customizations, allowing that configuration property to be rendered as the default specified in the series' properties.
注意: It doesn't affect the configuration of other points.
該函數在 Qt 6.2 引入。
另請參閱 clearPointsConfiguration () 和 setPointConfiguration ().
[since 6.2]
void
QXYSeries::
clearPointsConfiguration
()
Removes the configuration of all points in the series and restores the default look derived from the series' settings.
該函數在 Qt 6.2 引入。
另請參閱 setPointConfiguration ().
[since 6.2]
void
QXYSeries::
clearPointsConfiguration
(const
QXYSeries::PointConfiguration
key
)
Removes the configuration property identified by key from all points and restores the default look derived from the series' settings.
Removes the configuration type, such as color or size, specified by key from all points with configuration customizations, allowing that configuration property to be rendered as the default specified in the series properties.
該函數在 Qt 6.2 引入。
另請參閱 clearPointsConfiguration () 和 setPointConfiguration ().
[signal]
void
QXYSeries::
clicked
(const
QPointF
&
point
)
This signal is emitted when the user triggers a mouse event by clicking the point point in the chart.
另請參閱 pressed (), released (),和 doubleClicked ().
[since 6.2]
void
QXYSeries::
colorBy
(const
QList
<
qreal
> &
sourceData
, const
QLinearGradient
&
gradient
= QLinearGradient())
Sets the points' color according to a passed list of values. Values from sourceData are sorted and mapped to the gradient .
If the series has a QColorAxis attached, then a gradient from the axis is going to be used.
該函數在 Qt 6.2 引入。
另請參閱 setPointConfiguration (), pointConfiguration (),和 QColorAxis .
[signal]
void
QXYSeries::
colorChanged
(
QColor
color
)
This signal is emitted when the line (pen) color changes to color .
注意: 通知程序信號對於特性 color .
返迴係列中的數據點數。
[since 6.2]
void
QXYSeries::
deselectAllPoints
()
Deselects all points in the series.
注意: Emits QXYSeries::selectedPointsChanged
該函數在 Qt 6.2 引入。
另請參閱 setPointSelected ().
[since 6.2]
void
QXYSeries::
deselectPoint
(
int
index
)
Deselects point at given index .
注意: Emits QXYSeries::selectedPointsChanged
該函數在 Qt 6.2 引入。
另請參閱 setPointSelected ().
[since 6.2]
void
QXYSeries::
deselectPoints
(const
QList
<
int
> &
indexes
)
Marks multiple points passed in a indexes list as deselected.
注意: Emits QXYSeries::selectedPointsChanged
該函數在 Qt 6.2 引入。
另請參閱 setPointSelected ().
[signal]
void
QXYSeries::
doubleClicked
(const
QPointF
&
point
)
This signal is emitted when the user double-clicks the data point point in the chart. The point is the point where the first press was triggered.
另請參閱 pressed (), released (),和 clicked ().
[signal]
void
QXYSeries::
hovered
(const
QPointF
&
point
,
bool
state
)
This signal is emitted when a mouse is hovered over the point
point
in the chart. When the mouse moves over the point,
state
turns
true
, and when the mouse moves away again, it turns
false
.
Inserts the data point point in the series at the position specified by index .
另請參閱 pointAdded ().
[since 6.2]
bool
QXYSeries::
isPointSelected
(
int
index
)
Returns true if point at given index is among selected points and false otherwise.
注意: Selected points are drawn using the selected color if it was specified.
該函數在 Qt 6.2 引入。
另請參閱 selectedPoints (), setPointSelected (),和 setSelectedColor ().
[since 6.2]
const
QImage
&QXYSeries::
lightMarker
() const
Gets the image used for drawing markers on each point of the series.
The default value is QImage(), meaning no light marker will be painted.
The light markers visualize the data points of this series and as such are an alternative to setPointsVisible (true). Both features can be enabled independently from each other.
Unlike the elements of QScatterSeries the light markers are not represented by QGraphicsItem , but are just painted (no objects created). However, the mouse-event-signals of QXYSeries behave the same way, meaning that you'll get the exact domain value of the point if you click/press/hover the light marker. You'll still get the in between domain value if you click on the line. The light markers are above the line in terms of painting as well as events.
該函數在 Qt 6.2 引入。
另請參閱 QXYSeries::setLightMarker ().
[signal, since 6.2]
void
QXYSeries::
lightMarkerChanged
(const
QImage
&
lightMarker
)
This signal is emitted when the light marker image changes to lightMarker .
該函數在 Qt 6.2 引入。
另請參閱 QXYSeries::setLightMarker ().
[since 6.2]
qreal
QXYSeries::
markerSize
() const
Gets the size of the marker used to render points in the series.
The default size depends on the specific QXYSeries 類型。 QScatterSeries has a default of 15.0 QLineSeries has a default of the series pen size * 1.5
該函數在 Qt 6.2 引入。
另請參閱 setMarkerSize () 和 QScatterSeries::markerSize .
[signal]
void
QXYSeries::
markerSizeChanged
(
qreal
size
)
This signal is emitted when the marker size changes to size .
返迴用於繪製係列數據點輪廓的鋼筆。
另請參閱 setPen ().
[signal]
void
QXYSeries::
penChanged
(const
QPen
&
pen
)
此信號被發射當鋼筆更改為 pen .
[signal]
void
QXYSeries::
pointAdded
(
int
index
)
This signal is emitted when a point is added at the position specified by index .
[since 6.2]
QHash
<
QXYSeries::PointConfiguration
,
QVariant
> QXYSeries::
pointConfiguration
(const
int
index
) const
Returns a map representing the configuration of a point at index .
With points configuration you can change various aspects of each point's look.
該函數在 Qt 6.2 引入。
另請參閱 setPointConfiguration ().
[signal]
void
QXYSeries::
pointLabelsClippingChanged
(
bool
clipping
)
This signal is emitted when the clipping of the data point labels changes to clipping .
注意: 通知程序信號對於特性 pointLabelsClipping .
[signal]
void
QXYSeries::
pointLabelsColorChanged
(const
QColor
&
color
)
This signal is emitted when the color used for data point labels changes to color .
注意: 通知程序信號對於特性 pointLabelsColor .
[signal]
void
QXYSeries::
pointLabelsFontChanged
(const
QFont
&
font
)
This signal is emitted when the font used for data point labels changes to font .
注意: 通知程序信號對於特性 pointLabelsFont .
[signal]
void
QXYSeries::
pointLabelsFormatChanged
(const
QString
&
format
)
This signal is emitted when the format of data point labels changes to format .
注意: 通知程序信號對於特性 pointLabelsFormat .
[signal]
void
QXYSeries::
pointLabelsVisibilityChanged
(
bool
visible
)
This signal is emitted when the visibility of the data point labels changes to visible .
注意: 通知程序信號對於特性 pointLabelsVisible .
[signal]
void
QXYSeries::
pointRemoved
(
int
index
)
This signal is emitted when a point is removed from the position specified by index .
另請參閱 remove ().
[signal]
void
QXYSeries::
pointReplaced
(
int
index
)
This signal is emitted when a point is replaced at the position specified by index .
另請參閱 replace ().
Returns the points in the series.
[since 6.2]
QXYSeries::PointsConfigurationHash
QXYSeries::
pointsConfiguration
() const
Returns a map with points' indexes as keys and points' configuration as values.
該函數在 Qt 6.2 引入。
另請參閱 setPointsConfiguration (), setPointConfiguration (),和 pointConfiguration ().
[signal]
void
QXYSeries::
pointsRemoved
(
int
index
,
int
count
)
This signal is emitted when the number of points specified by count is removed starting at the position specified by index .
另請參閱 removePoints () 和 clear ().
[signal]
void
QXYSeries::
pointsReplaced
()
This signal is emitted when all points are replaced with other points.
另請參閱 replace ().
[signal]
void
QXYSeries::
pressed
(const
QPointF
&
point
)
This signal is emitted when the user presses the data point point in the chart and holds down the mouse button.
另請參閱 clicked (), released (),和 doubleClicked ().
[signal]
void
QXYSeries::
released
(const
QPointF
&
point
)
This signal is emitted when the user releases the mouse press on the data point specified by point .
另請參閱 pressed (), clicked (),和 doubleClicked ().
Removes the data point point from the series.
另請參閱 pointRemoved ().
Removes the point at the position specified by index from the series.
另請參閱 pointRemoved ().
Removes the point that has the coordinates x and y from the series.
另請參閱 pointRemoved ().
Removes the number of points specified by count from the series starting at the position specified by index .
另請參閱 pointsRemoved ().
Replaces the current points with the points specified by points .
注意: This is much faster than replacing data points one by one, or first clearing all data, and then appending the new data. Emits QXYSeries::pointsReplaced () when the points have been replaced.
另請參閱 pointsReplaced ().
Replaces the point specified by oldPoint with the one specified by newPoint .
另請參閱 pointReplaced ().
Replaces the point at the position specified by index with the point specified by newPoint .
另請參閱 pointReplaced ().
Replaces the point at the position specified by index with the point that has the coordinates newX and newY .
另請參閱 pointReplaced ().
Replaces the point with the coordinates oldX and oldY with the point with the coordinates newX and newY . Does nothing if the old point does not exist.
另請參閱 pointReplaced ().
[since 6.2]
void
QXYSeries::
selectAllPoints
()
Marks all points in the series as selected,
注意: Emits QXYSeries::selectedPointsChanged
該函數在 Qt 6.2 引入。
另請參閱 setPointSelected ().
[since 6.2]
void
QXYSeries::
selectPoint
(
int
index
)
Marks point at index as selected.
注意: Emits QXYSeries::selectedPointsChanged
該函數在 Qt 6.2 引入。
另請參閱 setPointSelected ().
[since 6.2]
void
QXYSeries::
selectPoints
(const
QList
<
int
> &
indexes
)
Marks multiple points passed in a indexes list as selected.
注意: Emits QXYSeries::selectedPointsChanged
該函數在 Qt 6.2 引入。
另請參閱 setPointSelected ().
[since 6.2]
const
QImage
&QXYSeries::
selectedLightMarker
() const
Returns the image used for drawing markers on selected series' points.
The default value is QImage(), meaning usual lightMarker () will be painted.
這相當於 selectedColor if you prefer light markers over normal points, but still want to distinguish selected points.
該函數在 Qt 6.2 引入。
另請參閱 setSelectedLightMarker (), lightMarker (), selectedColor ,和 setPointSelected ().
[since 6.2]
QList
<
int
> QXYSeries::
selectedPoints
() const
Returns a list of points indexes marked as selected. Selected points are visible regardless of points visibility.
該函數在 Qt 6.2 引入。
另請參閱 setPointSelected () 和 pointsVisible ().
[signal]
void
QXYSeries::
selectedPointsChanged
()
This signal is emitted when the points selection changes.
[virtual]
void
QXYSeries::
setBrush
(const
QBrush
&
brush
)
Sets the brush used for drawing points on the chart to brush . If the brush is not defined, the brush from the chart theme setting is used.
另請參閱 brush () 和 QChart::setTheme ().
[since 6.2]
void
QXYSeries::
setLightMarker
(const
QImage
&
lightMarker
)
Sets the image used for drawing markers on each point of the series as the value of lightMarker .
The default value is a default-QImage() ( QImage::isNull () == true), meaning no light marker will be painted. You can reset back to default (disabled) by calling this function with a null QImage (QImage()).
The light markers visualize the data points of this series and as such are an alternative to
setPointsVisible(true)
. If a light marker is set with this method, visible points as set with
setPointsVisible(true)
are not displayed.
Unlike the elements of QScatterSeries the light markers are not represented by QGraphicsItem , but are just painted (no objects created). However, the mouse-event-signals of QXYSeries behave the same way, meaning that you'll get the exact domain value of the point if you click/press/hover the light marker. You'll still get the in between domain value if you click on the line. The light markers are above the line in terms of painting as well as events.
該函數在 Qt 6.2 引入。
另請參閱 QXYSeries::lightMarker ().
[since 6.2]
void
QXYSeries::
setMarkerSize
(
qreal
size
)
設置 size of the marker used to render points in the series.
The default size is 15.0.
該函數在 Qt 6.2 引入。
另請參閱 QScatterSeries::markerSize .
[virtual]
void
QXYSeries::
setPen
(const
QPen
&
pen
)
將用於在圖錶中繪製點的鋼筆設為 pen 。若鋼筆未定義,則使用來自圖錶主題的鋼筆。
另請參閱 pen () 和 QChart::setTheme ().
[since 6.2]
void
QXYSeries::
setPointConfiguration
(const
int
index
, const
QHash
<
QXYSeries::PointConfiguration
,
QVariant
> &
configuration
)
Enables customizing the appearance of a point located at index with desired configuration .
With points configuration you can change various aspects of every point's appearance.
A point's configuration is represented as a hash map with QXYSeries::pointConfiguration 鍵和 QVariant values. For example:
QLineSeries *series = new QLineSeries(); series->setName("Customized series"); series->setPointsVisible(true); *series << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 6) << QPointF(7, 4) << QPointF(10, 5) << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2); QChart *chart = new QChart(); chart->addSeries(series); chart->createDefaultAxes(); QHash<QXYSeries::PointConfiguration, QVariant> conf; conf[QXYSeries::PointConfiguration::Color] = QColor(Qt::red); conf[QXYSeries::PointConfiguration::Size] = 8; conf[QXYSeries::PointConfiguration::LabelVisibility] = true; series->setPointConfiguration(4, conf); conf.remove(QXYSeries::PointConfiguration::Color); conf[QXYSeries::PointConfiguration::LabelFormat] = "This Point"; series->setPointConfiguration(6, conf);
In this example, you can see a default QLineSeries with 10 points and with changed configuration of two points. Both changed points are visibly bigger than the others with a look derived from the series configuration. By default, points don't have labels, but the point at index 4 has a label thanks to the QXYSeries::PointConfiguration::LabelVisibility and QXYSeries::PointConfiguration::LabelFormat configuration values. The point at index 6 has a custom label This Point thanks to the QXYSeries::PointConfiguration::LabelFormat configuration value. Below is an example of a chart created in this way:
該函數在 Qt 6.2 引入。
另請參閱 pointConfiguration (), pointsConfiguration (),和 clearPointsConfiguration ().
[since 6.2]
void
QXYSeries::
setPointConfiguration
(const
int
index
, const
QXYSeries::PointConfiguration
key
, const
QVariant
&
value
)
Enables customizing a particular aspect of a point's configuration.
注意: Points configuration concept provides a flexible way to configure various aspects of a point's appearance. Thus, values need to have an elastic type such as QVariant 。見 QXYSeries::PointConfiguration to see what value should be passed for certain key .
該函數在 Qt 6.2 引入。
另請參閱 pointsConfiguration ().
[since 6.2]
void
QXYSeries::
setPointSelected
(
int
index
,
bool
selected
)
Marks point at given index as either selected or deselected as specified by selected .
注意: Selected points are drawn using the selected color if it was specified. Emits QXYSeries::selectedPointsChanged
該函數在 Qt 6.2 引入。
另請參閱 isPointSelected (), setPointSelected(), and setSelectedColor ().
[since 6.2]
void
QXYSeries::
setPointsConfiguration
(const
QHash
<
int
,
QHash
<
QXYSeries::PointConfiguration
,
QVariant
>> &
pointsConfiguration
)
Enables customizing the configuration of multiple points as specified by pointsConfiguration .
該函數在 Qt 6.2 引入。
另請參閱 pointsConfiguration ().
[since 6.2]
void
QXYSeries::
setSelectedLightMarker
(const
QImage
&
selectedLightMarker
)
Sets the image used for drawing markers on selected series's points to selectedLightMarker .
The default value is QImage(), meaning usual lightMarker () will be painted.
This is an equivalent for selectedColor if you prefer light markers over normal points, but still want to distinguish selected points.
該函數在 Qt 6.2 引入。
另請參閱 selectedLightMarker (), lightMarker (), selectedColor ,和 setPointSelected ().
[since 6.2]
void
QXYSeries::
sizeBy
(const
QList
<
qreal
> &
sourceData
, const
qreal
minSize
, const
qreal
maxSize
)
Sets the points' sizes according to a passed list of values. Values from sourceData are sorted and mapped to a point size which is between minSize and maxSize .
注意: 若 sourceData length is smaller than number of points in the series, then size of the points at the end of the series will stay the same.
該函數在 Qt 6.2 引入。
另請參閱 setPointConfiguration () 和 pointConfiguration ().
[since 6.2]
void
QXYSeries::
toggleSelection
(const
QList
<
int
> &
indexes
)
Changes selection state of points at given indexes to the opposite one. Makes
注意: Emits QXYSeries::selectedPointsChanged
該函數在 Qt 6.2 引入。
另請參閱 setPointSelected ().
流運算符用於添加數據點列錶指定通過 points 到係列。
另請參閱 append ().
流運算符用於添加數據點 point 到係列。
另請參閱 append ().