QAbstractAxis, QAbstractSeries, QAreaSeries

QAbstractAxis

1. Description

The QAbstractAxis class is the base class of the axis class. Each curve can be bound to one or more horizontal and vertical axes.

2. Type members

1. enum QAbstractAxis::AxisType: This enumeration type specifies the type of the axis object.

  • AxisTypeNoAxis
  • AxisTypeValue
  • AxisTypeBarCategory
  • AxisTypeCategory
  • AxisTypeDateTime
  • AxisTypeLogValue
  • AxisTypeColor

Three, attribute members

1. [Read-only] alignment : const Qt::Alignment

The alignment of the axes. can be:

  • Qt::AlignLeft
  • Qt::AlignRight
  • Qt::AlignBottom
  • Qt::AlignTop

2. color: QColor | void colorChanged(QColor color)

The color of the axis and tick marks.

3. gridLineColor : QColor | void gridLineColorChanged(const QColor & amp;color)

The color of the grid lines.

4. gridLinePen : QPen | void gridLinePenChanged(const QPen & amp;pen)

The pen used to draw gridlines.

5. gridVisible: bool | void gridVisibleChanged(bool visible)

Visibility of gridlines.

6. labelsAngle: int | void labelsAngleChanged(int angle)

Holds the angle of the axis labels in degrees.

7. labelsBrush: QBrush | void labelsBrushChanged(const QBrush & amp;brush)

The brush used to draw labels.

8. labelsColor : QColor | void labelsColorChanged(QColor color)

The color of the axis labels.

9. labelsFont : QFont | void labelsFontChanged(const QFont & amp;font)

The font for the axis labels.

10. [Read-only] labelsTruncated : const bool | void labelsTruncatedChanged(bool labelsTruncated)

Whether any labels are truncated on the axes.

11. labelsVisible: bool | void labelsVisibleChanged(bool visible)

Whether the axis labels are visible.

12. linePen: QPen | void linePenChanged(const QPen & pen)

The pen used to draw the axis.

13. lineVisible: bool | void lineVisibleChanged(bool visible)

Axis visibility.

14. minorGridLineColor : QColor | void minorGridLineColorChanged(const QColor & amp;color)

The color of the minor gridlines. Only available for axes that support minor gridlines.

15. minorGridLinePen : QPen | void minorGridLinePenChanged(const QPen & amp;pen)

The pen used to draw the minor grid lines. Only available for axes that support minor gridlines.

16. minorGridVisible: bool | void minorGridVisibleChanged(bool visible)

Visibility of minor gridlines. Only available for axes that support minor gridlines.

17. [Read-only] orientation : const Qt::Orientation

The direction of the axis.

18. reverse: bool

Whether to use the reverse axis. The default is false.

Line, spline, and scatter charts, and area charts with Cartesian charts support reverse axes.

19. shadesBorderColor : QColor | void shadesBorderColorChanged(QColor color)

Border (brush) color for axis shadows.

20. shadesColor : QColor | void shadesColorChanged(QColor color)

The fill (brush) color for the axis shadow.

21. shadesBrush : QBrush | void shadesBrushChanged(const QBrush & amp;brush)

The brush used to paint the axis shading (the area between the gridlines).

22. shadesPen : QPen | void shadesPenChanged(const QPen & pen)

The brush used to paint the axis shading (the area between the gridlines).

23. shadesVisible: bool | void shadesVisibleChanged(bool visible)

Visibility of axis shadows.

24. titleBrush : QBrush | void titleBrushChanged(const QBrush & amp;brush)

The brush used to draw title text.

25. titleFont: QFont | void titleFontChanged(const QFont & amp;font)

The font of the axis title.

26. titleText: QString | void titleTextChanged(const QString & amp;text)

The title of the axis. Axis titles support HTML formatting.

27. titleVisible: bool | void titleVisibleChanged(bool visible)

Visibility of axis titles. Defaults to true.

28. truncateLabels: bool | void truncateLabelsChanged(bool truncateLabels)

The truncation state of the label. Indicates whether tags should be truncated if there is not enough room for the full text. Defaults to true.

29. visible: bool | void visibleChanged(bool visible)

Axis visibility.

4. Member functions

1. [Signal] void labelsEditableChanged(bool editable)

This signal is emitted when the label’s editable state changes.

2. void hide() / void show()

Hide/show axes, shading, labels and gridlines.

3. void setLabelsEditable(bool editable = true)

Sets whether axis labels are editable.

When labels are editable, users will be able to easily change the range of the axis by editing the label. Only QValueAxis and QDateTimeAxis support this feature.

By default, labels are not editable.

4. void setMax(const QVariant & max)

Sets the maximum value displayed on the axis. Convert the max argument to a value of the appropriate type, depending on the actual axis type. If the conversion fails, the function does nothing.

void setMin(const QVariant & amp;min)

Sets the minimum value displayed on the axis. Convert the min argument to a value of the appropriate type, depending on the actual axis type. If the conversion fails, the function does nothing.

void setRange(const QVariant & amp;min, const QVariant & amp;max)

Sets the range displayed on the axes. Convert the min and max arguments to values of the appropriate type, depending on the actual axis type. If the conversion fails, the function does nothing.

5. QAbstractAxis::AxisType type()

Returns the type of axis.

QAbstractSeries

1. Description

The QAbstractSeries class is the base class for all Qt chart curves. Typically, use a curve type specific inheritance class instead of a base class.

2. Type members

1. enum QAbstractSeries::SeriesType: This enumeration describes the type of curve.

  • SeriesTypeLine: Line chart.
  • SeriesTypeArea: area chart.
  • SeriesTypeBar: vertical bar chart.
  • SeriesTypeStackedBar: Vertical stacked bar chart.
  • SeriesTypePercentBar: Vertical percentage bar chart.
  • SeriesTypePie: pie chart.
  • SeriesTypeScatter: Scatter plot.
  • SeriesTypeSpline: spline chart.
  • SeriesTypeHorizontalBar: Horizontal bar chart.
  • SeriesTypeHorizontalStackedBar: Horizontal stacked bar chart.
  • SeriesTypeHorizontalPercentBar: Horizontal percentage bar chart.
  • SeriesTypeBoxPlot: box plot.
  • SeriesTypeCandlestick: candlestick chart.

The benefits of this article,Fees to receive Qt development learning materials package, technical video, including (C ++ language foundation, introduction to Qt programming, QT signal and slot mechanism, QT interface development – Image drawing, QT network, QT database programming, QT project actual combat, QT embedded development, Quick module, etc.) ↓↓↓↓↓↓See below↓↓Click at the bottom of the article to receive the fee↓↓

Three, attribute members

1. name: QString | void nameChanged()

The name of the curve. The name is shown in the legend for the curve and supports HTML formatting.

2. opacity: qreal | void opacityChanged()

The opacity of the curve. Defaults to 1.0. Valid values range from 0.0 (transparent) to 1.0 (opaque).

3. [Read-only] type: const SeriesType

Curve type.

4. useOpenGL: bool | void useOpenGLChanged()

Whether to use OpenGL to accelerate the drawing of curves. The default value is false.

Acceleration with OpenGL is only supported for QLineSeries and QScatterSeries.

Curves used as edge curves for QAreaSeries cannot use OpenGL acceleration.

When the chart contains any curves drawn using OpenGL, a transparent QOpenGLWidget is created on top of the chart’s drawing area. The acceleration curve is not drawn on the underlying QGraphicsView but on the created QOpenGLWidget .

The performance you get from using OpenGL accelerated curve drawing depends on the underlying hardware, but in most cases the performance is significant. For example, on a standard desktop computer, enabling OpenGL acceleration for curves typically allows rendering at least a hundred times more points without slowing down the frame rate. Chart size also has less impact on frame rate.

OpenGL acceleration for curve drawing is suitable for use cases where a large number of points need to be drawn quickly. It is optimized for efficiency, so curves using it lack support for many features available for non-accelerated curves:

Acceleration curves do not support curve animation.

Acceleration curves do not support point labels.

For acceleration curves, pen style, marker shape, and tint markers are ignored. Only solid lines and normal scatter are supported. Scatter points may be circular or rectangular, depending on the underlying graphics hardware and drivers.

Polar plots do not support acceleration curves.

Enabling chart shadows or using transparent chart background colors is not recommended when using acceleration curves, as this can significantly reduce frame rates.

These additional limitations arise when plotting the acceleration curve on a separate widget on top of the graph:

If any graph items are drawn on top of a graph containing acceleration curves, the acceleration curves are drawn on those items.

For a QOpenGLWidget to be partially transparent, it needs to be stacked on top of all other widgets. This means that you cannot have other widgets partially cover the graph when using acceleration curves.

Acceleration curves are not supported for use cases where a graphics scene has multiple graphics views attached to it.

Acceleration curves are not supported for use cases where graphs have non-default geometries. For example, adding a transform to a graph view causes acceleration curves to be drawn in the wrong place relative to the graph.

5. visible: bool | void visibleChanged()

Whether the curve is visible. Defaults to true.

4. Member functions

1. bool attachAxis(QAbstractAxis*axis)

Attach the axis specified by axis to the curve. Returns whether the attach was successful.

If multiple axes of the same direction are connected to the same curve, they will have the same minimum and maximum values.

2. QList attachedAxes()

Returns a list of axes attached to the curve.

3. QChart *chart()

Returns the chart this curve belongs to. Automatically set when the curve is added to the graph, and unset when the curve is removed from the graph.

4. bool detachAxis(QAbstractAxis *axis)

Detach the axis specified by axis from the curve. Returns whether the detach was successful.

QAreaSeries

1. Description

The QAreaSeries class presents data in the form of an area chart.

Area charts are used to display quantitative data. It is based on the curves of the lines, the way the areas between the boundary lines are emphasized in color.

Since area charts are based on line curves, the QAreaSeries constructor requires a QLineSeries instance that defines the upper boundary of the area. By default, area charts are drawn using the bottom of the plot area as the lower boundary. The lower boundary can also be specified by another curve, in which case the QAreaSeries should be initialized with two QLineSeries instances.

2. Attribute members

1. borderColor: QColor

The border color (brush) of the plot.

2. color: QColor

The fill color (brush) of the graph.

3. [Read-only] lowerSeries : QLineSeries* const

The lower of the two curves that define the boundary of the area chart.

nullptr if constructed without lowerSeries.

[read-only] upperSeries : QLineSeries* const

The higher of the two curves that define the boundary of the area chart.

4. pointLabelsClipping: bool

Whether to enable clipping of data point labels. Defaults to true. When clipping is enabled, labels are clipped at the edges of the drawing area.

5. pointLabelsColor: QColor

The color of the data point labels. Defaults to the brush color defined for tags in the theme.

6. pointLabelsFont: QFont

Font for data point labels.

7. pointLabelsFormat: QString

Format to display labels with curve points. The following formatting tags are supported:

  • @xPoint: the x-value of the data point
  • @yPoint: the y-value of the data point

For example, the following usage of the format tag produces a label where the data points (x, y) are shown within parentheses, separated by commas:

series->setPointLabelsFormat("(@xPoint, @yPoint)");

The default label format is set to: “@xPoint, @yPoint”. Labels are displayed on the drawing area, and labels at the edges of the drawing area are clipped. If the points are close to each other, the labels may overlap.

8. pointLabelsVisible: bool

Whether the data point labels are visible. The default is false.

3. Member functions

1. [Signal] void clicked(const QPointF & amp;point)

This signal is emitted when a point is clicked in the area chart.

2. [Signal] void doubleClicked(const QPointF & amp;point)

This signal is emitted when point point is double-clicked in the area chart.

3. [Signal] void hovered(const QPointF & amp;point, bool state)

This signal is emitted when the mouse cursor is hovered over or moved away from the plot. point Shows the origin of the hover event. The state is true when the cursor hovers over the graph, and becomes false when it leaves the graph.

4. [Signal] void pressed(const QPointF & amp;point)

This signal is emitted when point point in the area chart is pressed.

5. [Signal] void released(const QPointF & amp;point)

This signal is emitted when a press triggered on point point in the area chart is released.

The benefits of this article,Fees to receive Qt development learning materials package, technical video, including (C ++ language foundation, introduction to Qt programming, QT signal and slot mechanism, QT interface development – Image drawing, QT network, QT database programming, QT project actual combat, QT embedded development, Quick module, etc.) ↓↓↓↓↓↓See below↓↓Click at the bottom of the article to receive the fee↓↓

Original link: https://blog.csdn.net/kenfan1647/article/details/123632417

Original link: https://blog.csdn.net/kenfan1647/article/details/123995045

Original link: https://blog.csdn.net/kenfan1647/article/details/124310758