이 페이지에서

QChart Class

QChart 클래스는 차트의 시계열, 범례 및 축을 그래픽으로 표현하는 기능을 관리합니다. 더 보기...

Header: #include <QChart>
Inherits: QGraphicsWidget
Inherited By:

QPolarChart

Status: Deprecated

이 클래스는 더 이상 사용되지 않습니다. 새로운 코드에서는 이 클래스를 사용하지 않는 것을 강력히 권장합니다.

공개 유형

enum AnimationOption { NoAnimation, GridAxisAnimations, SeriesAnimations, AllAnimations }
flags AnimationOptions
enum ChartTheme { ChartThemeLight, ChartThemeBlueCerulean, ChartThemeDark, ChartThemeBrownSand, ChartThemeBlueNcs, …, ChartThemeQt }
enum ChartType { ChartTypeUndefined, ChartTypeCartesian, ChartTypePolar }

속성

공개 함수

QChart(QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = Qt::WindowFlags())
virtual ~QChart()
void addAxis(QAbstractAxis *axis, Qt::Alignment alignment)
void addSeries(QAbstractSeries *series)
int animationDuration() const
QEasingCurve animationEasingCurve() const
QChart::AnimationOptions animationOptions() const
QList<QAbstractAxis *> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = nullptr) const
QBrush backgroundBrush() const
QPen backgroundPen() const
qreal backgroundRoundness() const
QChart::ChartType chartType() const
void createDefaultAxes()
bool isBackgroundVisible() const
bool isDropShadowEnabled() const
bool isPlotAreaBackgroundVisible() const
bool isZoomed()
QLegend *legend() const
QLocale locale() const
bool localizeNumbers() const
QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = nullptr)
QPointF mapToValue(const QPointF &position, QAbstractSeries *series = nullptr)
QMargins margins() const
QRectF plotArea() const
QBrush plotAreaBackgroundBrush() const
QPen plotAreaBackgroundPen() const
void removeAllSeries()
void removeAxis(QAbstractAxis *axis)
void removeSeries(QAbstractSeries *series)
void scroll(qreal dx, qreal dy)
QList<QAbstractSeries *> series() const
void setAnimationDuration(int msecs)
void setAnimationEasingCurve(const QEasingCurve &curve)
void setAnimationOptions(QChart::AnimationOptions options)
void setBackgroundBrush(const QBrush &brush)
void setBackgroundPen(const QPen &pen)
void setBackgroundRoundness(qreal diameter)
void setBackgroundVisible(bool visible = true)
void setDropShadowEnabled(bool enabled = true)
void setLocale(const QLocale &locale)
void setLocalizeNumbers(bool localize)
void setMargins(const QMargins &margins)
void setPlotArea(const QRectF &rect)
void setPlotAreaBackgroundBrush(const QBrush &brush)
void setPlotAreaBackgroundPen(const QPen &pen)
void setPlotAreaBackgroundVisible(bool visible = true)
void setTheme(QChart::ChartTheme theme)
void setTitle(const QString &title)
void setTitleBrush(const QBrush &brush)
void setTitleFont(const QFont &font)
QChart::ChartTheme theme() const
QString title() const
QBrush titleBrush() const
QFont titleFont() const
void zoom(qreal factor)
void zoomIn()
void zoomIn(const QRectF &rect)
void zoomOut()
void zoomReset()

신호

void plotAreaChanged(const QRectF &plotArea)

상세 설명

QChart는 QGraphicsScene 에 표시할 수 있는 차트 객체( QGraphicsWidget )입니다. 이 객체는 다양한 유형의 시리즈와 범례, 축 등 차트와 관련된 다른 객체들의 그래픽 표현을 관리합니다. 레이아웃에 차트를 간단히 표시하려면 QChart 대신 편의 클래스인 ` QChartView `를 사용할 수 있습니다. 또한 ` QPolarChart ` 클래스를 사용하면 선, 스플라인, 면, 산점도 시리즈를 극좌표 차트로 표시할 수 있습니다.

QChartView 및 QPolarChart도 참조하십시오 .

멤버 유형 문서

enum QChart::AnimationOption
flags QChart::AnimationOptions

이 열거형은 차트에서 활성화된 애니메이션을 설명합니다.

상수값설명
QChart::NoAnimation0x0차트에서 애니메이션이 비활성화됩니다. 이것이 기본값입니다.
QChart::GridAxisAnimations0x1차트에서 격자 축 애니메이션이 활성화되어 있습니다.
QChart::SeriesAnimations0x2차트에서 시리즈 애니메이션이 활성화되어 있습니다.
QChart::AllAnimations0x3차트에서 모든 애니메이션 유형이 활성화되어 있습니다.

AnimationOptions 유형은 QFlags<AnimationOption>에 대한 typedef입니다. 이 유형은 AnimationOption 값들의 OR 조합을 저장합니다.

enum QChart::ChartTheme

이 열거형은 차트에서 사용되는 테마를 나타냅니다.

테마는 차트의 모든 시각적 요소(시리즈의 색상, 펜, 브러시, 글꼴은 물론 축, 제목, 범례 등)에 적용되는 UI 스타일 관련 설정의 내장된 모음입니다. '위젯이 포함된 차트 갤러리'에서는 테마 사용 방법을 보여줍니다.

참고: 테마를변경하면 시리즈에 이전에 적용된 모든 사용자 지정이 덮어쓰게 됩니다.

상수값설명
QChart::ChartThemeLight0기본 테마인 밝은 테마입니다.
QChart::ChartThemeBlueCerulean1청록색 테마입니다.
QChart::ChartThemeDark2어두운 테마.
QChart::ChartThemeBrownSand3모래 갈색 테마.
QChart::ChartThemeBlueNcs4NCS(Natural Color System) 블루 테마.
QChart::ChartThemeHighContrast5고대비 테마.
QChart::ChartThemeBlueIcy6얼음빛 파란색 테마.
QChart::ChartThemeQt7Qt 테마.

enum QChart::ChartType

이 열거형은 차트 유형을 나타냅니다.

상수값설명
QChart::ChartTypeUndefined0차트 유형이 정의되어 있지 않습니다.
QChart::ChartTypeCartesian1직교 차트입니다.
QChart::ChartTypePolar2극좌표 차트입니다.

속성 설명서

animationDuration : int

이 속성은 차트의 애니메이션 지속 시간을 지정합니다.

액세스 함수:

int animationDuration() const
void setAnimationDuration(int msecs)

animationEasingCurve : QEasingCurve

이 속성은 차트의 애니메이션에 적용되는 이징 곡선을 지정합니다.

액세스 함수:

QEasingCurve animationEasingCurve() const
void setAnimationEasingCurve(const QEasingCurve &curve)

animationOptions : QChart::AnimationOptions

이 속성은 차트의 애니메이션 옵션을 지정합니다.

이 설정에 따라 애니메이션이 활성화되거나 비활성화됩니다.

액세스 함수:

QChart::AnimationOptions animationOptions() const
void setAnimationOptions(QChart::AnimationOptions options)

backgroundRoundness : qreal

이 속성은 차트 배경의 모서리에 적용되는 반올림 원의 지름을 지정합니다.

액세스 함수:

qreal backgroundRoundness() const
void setBackgroundRoundness(qreal diameter)

backgroundVisible : bool

이 속성은 차트 배경이 표시되는지 여부를 결정합니다.

액세스 함수:

bool isBackgroundVisible() const
void setBackgroundVisible(bool visible = true)

setBackgroundBrush(), setBackgroundPen(), plotAreaBackgroundVisible도 참조하십시오 .

[read-only] chartType : QChart::ChartType

이 속성은 차트가 직교 좌표계 차트인지 극좌표계 차트인지 여부를 나타냅니다.

이 속성은 내부적으로 설정되며 읽기 전용입니다.

액세스 함수:

QChart::ChartType chartType() const

QPolarChart도 참조하십시오 .

dropShadowEnabled : bool

이 속성은 배경 드롭 섀도우 효과가 활성화되어 있는지 여부를 나타냅니다.

true 로 설정하면 배경 드롭 섀도우 효과가 활성화됩니다. false 로 설정하면 비활성화됩니다.

참고: 드롭 섀도우효과는 테마에 따라 달라지므로, 테마를 변경하면 이 설정도 변경될 수 있습니다.

액세스 함수:

bool isDropShadowEnabled() const
void setDropShadowEnabled(bool enabled = true)

locale : QLocale

이 속성은 다양한 차트 레이블의 서식을 지정하는 데 사용되는 로케일을 저장합니다.

localizeNumbers 가 true 인 경우에만 레이블이 현지화되며, QDateTimeAxis 레이블은 예외로, 이 속성으로 설정된 QLocale 를 항상 사용합니다.

차트가 생성될 당시의 애플리케이션 기본 로캘이 기본값으로 설정됩니다.

액세스 함수:

QLocale locale() const
void setLocale(const QLocale &locale)

localizeNumbers도 참조하십시오 .

localizeNumbers : bool

이 속성은 숫자가 현지화되었는지 여부와 관계없이 적용됩니다.

true 인 경우, 다양한 시리즈 및 축 레이블에 표시되는 모든 생성된 숫자는 locale 속성으로 설정된 QLocale 을 사용하여 현지화됩니다. false 인 경우, 항상 C 로케일이 사용됩니다. 기본값은 false 입니다.

참고: 이 속성은 QDateTimeAxis 레이블에는 영향을 미치지 않으며, 이 레이블은 항상 locale 속성으로 설정된 QLocale 을 사용합니다.

액세스 함수:

bool localizeNumbers() const
void setLocalizeNumbers(bool localize)

locale도 참조하십시오 .

margins : QMargins

이 속성은 차트 사각형의 가장자리와 플롯 영역 사이에 허용되는 최소 여백을 지정합니다.

이 여백은 제목, 축 및 범례를 그리는 데 사용됩니다.

액세스 함수:

QMargins margins() const
void setMargins(const QMargins &margins)

plotArea : QRectF

이 속성은 차트가 그려지는 사각형을 지정합니다.

플롯 영역에는 여백으로 정의된 영역은 포함되지 않습니다. 기본적으로 QChartView 내부에 있을 경우 크기가 조정됩니다. 플롯 영역에 명시적인 크기가 설정된 경우 해당 크기가 적용되며, 기본 동작으로 되돌리려면 ` setPlotArea(QRectF()); `를 호출하면 됩니다.

액세스 함수:

QRectF plotArea() const
void setPlotArea(const QRectF &rect)

Notifier 신호:

void plotAreaChanged(const QRectF &plotArea)

plotAreaBackgroundVisible : bool

이 속성은 차트 플롯 영역의 배경이 표시되는지 여부를 결정합니다.

참고: 기본적으로 플롯 영역의 배경은 표시되지 않으며, 플롯 영역은 차트의 일반 배경을 사용합니다.

액세스 함수:

bool isPlotAreaBackgroundVisible() const
void setPlotAreaBackgroundVisible(bool visible = true)

setPlotAreaBackgroundBrush(), setPlotAreaBackgroundPen() 및 backgroundVisible도 참조하십시오 .

theme : QChart::ChartTheme

이 속성은 차트에 사용되는 테마를 지정합니다.

액세스 함수:

QChart::ChartTheme theme() const
void setTheme(QChart::ChartTheme theme)

title : QString

이 속성은 차트의 제목을 지정합니다.

제목은 차트 상단에 헤드라인으로 표시됩니다. 차트 제목은 HTML 서식을 지원합니다.

Access 함수:

QString title() const
void setTitle(const QString &title)

멤버 함수 설명서

[explicit] QChart::QChart(QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = Qt::WindowFlags())

parent 의 자식인 차트 객체를 생성합니다. wFlags 에 지정된 속성들은 QGraphicsWidget 생성자에 전달됩니다.

[virtual noexcept] QChart::~QChart()

차트 객체와 그 하위 객체(예: 차트에 추가된 시리즈 및 축 객체 등)를 삭제합니다.

void QChart::addAxis(QAbstractAxis *axis, Qt::Alignment alignment)

alignment 에 지정된 대로 정렬된 axis 축을 차트에 추가합니다. 차트가 해당 축에 대한 소유권을 갖습니다.

removeAxis(), createDefaultAxes() 및 QAbstractSeries::attachAxis()도 참조하십시오 .

void QChart::addSeries(QAbstractSeries *series)

차트에 series 시리즈를 추가하고 해당 시리즈의 소유권을 가져옵니다.

참고: 새로 추가된시리즈는 기본적으로 어떤 축에도 연결되지 않으며, 시리즈가 차트에 추가되기 전에 ` createDefaultAxes()`를 사용하여 차트를 위해 생성된 축이라 하더라도 마찬가지입니다. 차트가 표시되기 전에 새로 추가된 시계에 축이 연결되어 있지 않으면, 해당 시계는 차트의 플롯 영역에 정확히 맞도록 범위가 설정된 축이 있는 것처럼 그려집니다. 동일한 차트에 축이 올바르게 연결된 다른 시계열이 함께 표시되는 경우, 이는 혼란을 야기할 수 있으므로, 시계열을 추가한 후 항상 ` createDefaultAxes()`를 호출하거나 해당 시계열에 축을 명시적으로 연결하도록 하십시오.

removeSeries(), removeAllSeries(), createDefaultAxes(), QAbstractSeries::attachAxis()도 참조하십시오 .

QList<QAbstractAxis *> QChart::axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = nullptr) const

series 시리에 연결된 축을 orientation 에서 지정한 방향으로 반환합니다. 시리가 지정되지 않은 경우, 지정된 방향으로 차트에 추가된 모든 축이 반환됩니다.

addAxis() 및 createDefaultAxes()도 참조하십시오 .

QBrush QChart::backgroundBrush() const

차트 영역의 배경을 채우는 데 사용되는 브러시를 가져옵니다.

setBackgroundBrush()도 참조하십시오 .

QPen QChart::backgroundPen() const

차트 영역의 배경을 채우는 데 사용되는 펜을 가져옵니다.

setBackgroundPen()도 참조하십시오 .

void QChart::createDefaultAxes()

차트에 이미 추가된 시계열을 기반으로 차트의 축을 생성합니다. 이전에 차트에 추가된 축은 모두 삭제됩니다.

참고: 이 함수는 모든 시리즈가 차트에 추가된 후에 호출해야 합니다. 이 함수로 생성된 축은 함수 호출 이후에 차트에 추가되는 시리즈에는 자동으로 연결되지 않습니다. 축이 연결되지 않은 시계열은 기본적으로 차트의 전체 플롯 영역을 활용하도록 크기가 조정되는데, 축이 올바르게 연결된 다른 시계열이 함께 존재할 경우 혼란을 줄 수 있습니다.

시리즈 유형가로축(X)수직축(Y)
QXYSeriesQValueAxisQValueAxis
QBarSeriesQBarCategoryAxisQValueAxis
QPieSeries없음없음

차트에 QXYSeries에서 파생된 여러 시계가 추가되어 있고 다른 유형의 시계가 추가되지 않은 경우, 축 쌍은 하나만 생성됩니다. 차트에 서로 다른 유형의 시계가 여러 개 추가된 경우, 각 시계는 고유한 축 쌍을 갖게 됩니다.

시리즈에 특정한 축은 나중에 axes() 함수 호출 시 해당 시리즈를 매개변수로 지정하여 차트에서 가져올 수 있습니다. QPieSeries는 축을 생성하지 않습니다.

axes() 및 QAbstractSeries::attachAxis()도 참조하십시오 .

bool QChart::isZoomed()

시리즈 중 확대된 영역을 가진 것이 있으면 ` true `을 반환합니다.

QLegend *QChart::legend() const

차트의 범례 객체를 반환합니다. 소유권은 차트에 그대로 유지됩니다.

QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series = nullptr)

series 로 지정된 시계열에서 value 값에 해당하는 차트상의 위치를 반환합니다.

QPointF QChart::mapToValue(const QPointF &position, QAbstractSeries *series = nullptr)

차트에서 ` series `로 지정된 시리즈의 ` position `로 지정된 위치에 있는 값을 반환합니다.

QBrush QChart::plotAreaBackgroundBrush() const

차트의 플롯 영역 배경을 채우는 데 사용된 브러시를 반환합니다.

plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundPen() 및 setPlotAreaBackgroundBrush()도 참조하십시오 .

QPen QChart::plotAreaBackgroundPen() const

차트의 플롯 영역 배경을 그리는 데 사용된 펜을 반환합니다.

plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundBrush() 및 setPlotAreaBackgroundPen()도 참조하십시오 .

void QChart::removeAllSeries()

차트에 추가된 모든 시리즈 객체를 제거하고 삭제합니다.

addSeries() 및 removeSeries()도 참조하십시오 .

void QChart::removeAxis(QAbstractAxis *axis)

차트에서 축 axis 을 제거합니다. 차트는 지정된 axis 객체에 대한 소유권을 해제합니다.

addAxis(), createDefaultAxes() 및 QAbstractSeries::detachAxis()도 참조하십시오 .

void QChart::removeSeries(QAbstractSeries *series)

차트에서 ‘ series ’ 시리즈를 제거합니다. 차트는 지정된 ‘ series ’ 객체에 대한 소유권을 해제합니다.

addSeries() 및 removeAllSeries()도 참조하십시오 .

void QChart::scroll(qreal dx, qreal dy)

dx 및 dy 에서 지정한 거리만큼 차트의 표시 영역을 스크롤합니다.

극좌표 차트의 경우, ` dx `는 거리 대신 각도축을 따라의 각도를 나타냅니다.

QList<QAbstractSeries *> QChart::series() const

차트에 추가된 모든 시리즈를 반환합니다.

addSeries(), removeSeries() 및 removeAllSeries()도 참조하십시오 .

void QChart::setBackgroundBrush(const QBrush &brush)

차트 영역의 배경을 채우는 데 사용되는 브러시를 ` brush`로 설정합니다.

backgroundBrush()도 참조하십시오 .

void QChart::setBackgroundPen(const QPen &pen)

차트 영역의 배경을 채우는 데 사용되는 펜을 ‘ pen ’로 설정합니다.

backgroundPen()도 참조하십시오 .

void QChart::setPlotAreaBackgroundBrush(const QBrush &brush)

차트의 플롯 영역 배경을 채우는 데 사용되는 브러시를 ‘ brush ’로 설정합니다.

plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundPen() 및 plotAreaBackgroundBrush()도 참조하십시오 .

void QChart::setPlotAreaBackgroundPen(const QPen &pen)

차트의 플롯 영역 배경을 그리는 데 사용되는 펜을 pen 로 설정합니다.

plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundBrush() 및 plotAreaBackgroundPen()도 참조하십시오 .

void QChart::setTitleBrush(const QBrush &brush)

제목 텍스트를 그릴 때 사용되는 브러시를 ‘ brush ’로 설정합니다.

titleBrush()도 참조하십시오 .

void QChart::setTitleFont(const QFont &font)

차트 제목을 그릴 때 사용되는 글꼴을 ‘ font ’로 설정합니다.

titleFont()도 참조하십시오 .

QBrush QChart::titleBrush() const

제목 텍스트를 그리는 데 사용된 브러시를 반환합니다.

setTitleBrush()도 참조하십시오 .

QFont QChart::titleFont() const

차트 제목을 그리는 데 사용되는 글꼴을 가져옵니다.

setTitleFont()도 참조하십시오 .

void QChart::zoom(qreal factor)

사용자 정의 배율 factor 에 따라 뷰를 확대합니다.

1.0보다 큰 배율은 뷰를 확대하고, 0.0과 1.0 사이의 배율은 뷰를 축소합니다.

void QChart::zoomIn()

화면을 2배로 확대합니다.

void QChart::zoomIn(const QRectF &rect)

사각형 rect 이 여전히 완전히 보이게 되는 최대 수준까지 뷰를 확대합니다.

참고: 확대/축소를적용하면 연결된 축의 속성(예: QAbstractAxis::min 및 QAbstractAxis::max)이 변경될 수 있습니다.

참고: 이 기능은 극좌표 차트에서는 지원되지 않습니다.

void QChart::zoomOut()

보이는 영역을 2배로 축소합니다.

참고: 결과 값에 유효하지 않은 로그 축 범위가 포함될 경우,이 작업은 아무런 효과도 없습니다.

void QChart::zoomReset()

시리즈 도메인을 줌 메서드가 호출되기 전 상태로 재설정합니다.

참고: 이 메서드를 호출하면 첫 번째 확대/축소 작업과 이 메서드 호출 사이에 지정된 스크롤 및 명시적 축 범위 설정도 함께 초기화됩니다. 확대/축소 작업이 수행되지 않은 경우, 이 메서드는 아무런 동작도 수행하지 않습니다.

© 2026 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.