ChartView QML Type
Manages the graphical representation of the chart's series, legends, and axes. More...
|Import Statement:||import QtCharts 2.2|
- animationDuration : int
- animationEasingCurve : easing
- animationOptions : enumeration
- axes : list<AbstractAxis>
- backgroundColor : color
- backgroundRoundness : real
- count : int
- dropShadowEnabled : bool
- legend : Legend
- locale : locale
- localizeNumbers : bool
- margins : Margins
- plotArea : rect
- plotAreaColor : color
- theme : enumeration
- title : string
- titleColor : color
- titleFont : font
- Axis axisX(AbstractSeries series)
- Axis axisY(AbstractSeries series)
- AbstractSeries createSeries(enumeration type, string name, AbstractAxis axisX, AbstractAxis axisY)
- point mapToPosition(point value, AbstractSeries series)
- point mapToValue(point position, AbstractSeries series)
- removeSeries(AbstractSeries series)
- scrollDown(real pixels)
- scrollLeft(real pixels)
- scrollRight(real pixels)
- scrollUp(real pixels)
- AbstractSeries series(string name)
- AbstractSeries series(int index)
- setAxisX(AbstractAxis axis, AbstractSeries series)
- setAxisY(AbstractAxis axis, AbstractSeries series)
- zoom(real factor)
- zoomIn(rect rectangle)
The ChartView type displays different series types as charts.
The following QML code shows how to create a simple chart with one pie series:
animationDuration : int
The duration of the animation for the chart.
animationOptions : enumeration
The animations enabled in the chart:
|Animation is disabled in the chart. This is the default value.|
|Grid axis animation is enabled in the chart.|
|Series animation is enabled in the chart.|
|All animation types are enabled in the chart.|
backgroundColor : color
The color of the chart's background. By default, the background color is specified by the chart theme.
See also theme.
backgroundRoundness : real
The diameter of the rounding circle at the corners of the chart background.
count : int
The number of series added to the chart.
dropShadowEnabled : bool
Whether the background drop shadow effect is enabled.
If set to
true, the background drop shadow effect is enabled. If set to
false, it is disabled.
legend : Legend
The legend of the chart. The legend lists all the series, pie slices, and bar sets added to the chart.
The locale used to format various chart labels.
Defaults to the application default locale at the time when the chart is constructed.
This property was introduced in QtCharts 2.0.
See also localizeNumbers.
localizeNumbers : bool
Whether numbers are localized.
true, all generated numbers appearing in various series and axis labels will be localized using the QLocale set with the locale property. When
false, the C locale is always used. Defaults to
This property was introduced in QtCharts 2.0.
See also locale.
margins : Margins
The minimum margins allowed between the edge of the chart rectangle and the plot area. The margins are used for drawing the title, axes, and legend.
plotArea : rect
The rectangle within which the chart is drawn.
The plot area does not include the area defined by margins.
See also margins.
plotAreaColor : color
theme : enumeration
The theme used by the chart.
A theme is a built-in collection of UI style related settings applied to all the visual elements of a chart, such as colors, pens, brushes, and fonts of series, as well as axes, title, and legend. The Qml Oscilloscope example illustrates how to set a theme.
Note: Changing the theme will overwrite all customizations previously applied to the series.
The following values are supported:
|The light theme, which is the default theme.|
|The cerulean blue theme.|
|The dark theme.|
|The sand brown theme.|
|The natural color system (NCS) blue theme.|
|The high contrast theme.|
|The icy blue theme.|
|The Qt theme.|
title : string
The title is shown as a headline on top of the chart. Chart titles support HTML formatting.
See also titleColor.
titleColor : color
The color of the title text.
This signal is emitted when the series series is added to the chart.
This signal is emitted when the series series is removed from the chart. The series object becomes invalid when the signal handler completes.
Adds a series of the type type to the chart with the name name and, optionally, the axes axisX and axisY. For example:
// lineSeries is a LineSeries object that has already been added to the ChartView; re-use its axes var myAxisX = chartView.axisX(lineSeries); var myAxisY = chartView.axisY(lineSeries); var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter series", myAxisX, myAxisY);
The following enumeration values can be used as values of type:
|A line series.|
|An area series.|
|A bar series.|
|A stacked bar series.|
|A percent bar series.|
|A box plot series.|
|A candlestick series.|
|A pie series.|
|A scatter series.|
|A spline series.|
|A horizontal bar series.|
|A horizontal stacked bar series.|
|A horizontal percent bar series.|
Returns the position in the chart of the value value in the series series.
Returns the value in the series series located at the position position in the chart.
Removes the series series from the chart and permanently deletes the series object.
Scrolls down by the number of pixels specified by pixels. This is a convenience method suitable for key navigation, for example.
Scrolls to left by the number of pixels specified by pixels. This is a convenience method suitable for key navigation, for example.
Scrolls to right by by the number of pixels specified by pixels. This is a convenience method suitable for key navigation, for example.
Scrolls up by the number of pixels specified by pixels. This is a convenience method suitable for key navigation, for example.
Returns the first series in the chart with the name name. If there is no series with that name, returns null.
Zooms into the chart by the custom factor factor.
A factor over 1.0 zooms into the view in and a factor between 0.0 and 1.0 zooms out of it.
Zooms into the view to a maximum level at which the rectangle rectangle is still fully visible.
Note: This is not supported for polar charts.
Resets the series domains to what they were before any zoom method was called.
Note: This will also reset scrolling and explicit axis range settings specified between the first zoom operation and calling this method. If no zoom operation has been performed, this method does nothing.
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.