Charts
LineChart
Shows how values change over time or order with lines.
Example
Property preview could not load. Select Property preview to retry.

Usage
Response time
Write points and labels into a ChartModel and call setModel(). addSeries() adds a second series for comparison.
#include <FluentQt/Charts.h>
using namespace fluent::charts;
auto* chart = new LineChart(this);
chart->setObjectName("chartPresentation");
chart->setMinimumHeight(420);
chart->setTitle("Response time");
chart->setSubtitle("Milliseconds · last 7 days");
auto* model = new ChartModel(chart);
model->setName("Primary");
const QStringList labels = {"Mon", "Mon, 04:48", "Mon, 09:36", "Mon, 14:24", "Mon, 19:12", "Tue",
"Tue, 04:48", "Tue, 09:36", "Tue, 14:24", "Tue, 19:12", "Wed", "Wed, 04:48",
"Wed, 09:36", "Wed, 14:24", "Wed, 19:12", "Thu", "Thu, 04:48", "Thu, 09:36",
"Thu, 14:24", "Thu, 19:12", "Fri", "Fri, 04:48", "Fri, 09:36", "Fri, 14:24",
"Fri, 19:12", "Sat", "Sat, 04:48", "Sat, 09:36", "Sat, 14:24", "Sat, 19:12",
"Sun"};
model->setPoints(
{{0, 27}, {1, 32}, {2, 28}, {3, 34}, {4, 30}, {5, 36}, {6, 34}, {7, 32},
{8, 41}, {9, 39}, {10, 37}, {11, 42}, {12, 46}, {13, 43}, {14, 40}, {15, 46},
{16, 42}, {17, 47}, {18, 52}, {19, 48}, {20, 54}, {21, 59}, {22, 56}, {23, 61},
{24, 57}, {25, 60}, {26, 58}, {27, 64}, {28, 59}, {29, 66}, {30, 62}},
labels);
chart->setModel(model);
auto* secondary = new ChartModel(chart);
secondary->setName("Secondary");
secondary->setPoints(
{{0, 14}, {1, 18}, {2, 16}, {3, 20}, {4, 17}, {5, 22}, {6, 20}, {7, 18},
{8, 25}, {9, 23}, {10, 22}, {11, 26}, {12, 29}, {13, 27}, {14, 25}, {15, 28},
{16, 26}, {17, 31}, {18, 34}, {19, 30}, {20, 35}, {21, 41}, {22, 38}, {23, 42},
{24, 39}, {25, 43}, {26, 40}, {27, 44}, {28, 41}, {29, 46}, {30, 43}}, labels);
chart->addSeries(secondary);
chart->setValueSuffix(" ms");
chart->setYRange(0, 80);import fluentqt
from PySide6.QtCore import QPointF
chart = fluentqt.LineChart()
chart.setObjectName("chartPresentation")
chart.setMinimumHeight(420)
chart.setTitle('Response time')
chart.setSubtitle('Milliseconds · last 7 days')
model = fluentqt.ChartModel(chart)
model.setName("Primary")
values = [27, 32, 28, 34, 30, 36, 34, 32, 41, 39, 37, 42, 46, 43, 40,
46, 42, 47, 52, 48, 54, 59, 56, 61, 57, 60, 58, 64, 59, 66,
62]
labels = ['Mon', 'Mon, 04:48', 'Mon, 09:36', 'Mon, 14:24',
'Mon, 19:12', 'Tue', 'Tue, 04:48', 'Tue, 09:36',
'Tue, 14:24', 'Tue, 19:12', 'Wed', 'Wed, 04:48',
'Wed, 09:36', 'Wed, 14:24', 'Wed, 19:12', 'Thu',
'Thu, 04:48', 'Thu, 09:36', 'Thu, 14:24', 'Thu, 19:12',
'Fri', 'Fri, 04:48', 'Fri, 09:36', 'Fri, 14:24',
'Fri, 19:12', 'Sat', 'Sat, 04:48', 'Sat, 09:36',
'Sat, 14:24', 'Sat, 19:12', 'Sun']
model.setPoints(
[QPointF(i, y) for i, y in enumerate(values)],
labels
)
chart.setModel(model)
secondary = fluentqt.ChartModel(chart)
secondary.setName("Secondary")
secondary_values = [14, 18, 16, 20, 17, 22, 20, 18, 25, 23, 22, 26, 29, 27, 25,
28, 26, 31, 34, 30, 35, 41, 38, 42, 39, 43, 40, 44, 41, 46,
43]
secondary.setPoints(
[QPointF(i, y) for i, y in enumerate(secondary_values)],
labels
)
chart.addSeries(secondary)
chart.setValueSuffix(" ms")
chart.setYRange(0, 80)API
DeclarationNo matching API members.
fluent::charts::LineChart
Inherits ChartView
Line chart widget backed by a ChartModel.
Constructors
Inherited from fluent::charts::ChartView
Properties
ChartType chartType- Read
chartType()WritesetChartType()NotifychartTypeChanged() QString title- Read
title()WritesetTitle()NotifytitleChanged() QString subtitle- Read
subtitle()WritesetSubtitle()NotifysubtitleChanged() QString valueSuffixUnit suffix appended to value readouts (e.g. " ms" or "%").
ReadvalueSuffix()WritesetValueSuffix()NotifyvalueSuffixChanged()QString centerText- Read
centerText()WritesetCenterText()NotifycenterTextChanged() QString centerCaption- Read
centerCaption()WritesetCenterCaption()NotifycenterCaptionChanged() bool loadingShows a loading state while data is prepared externally.
ReadisLoading()WritesetLoading()NotifyloadingChanged()bool autoYRange- Read
isAutoYRange()NotifyyRangeChanged() bool legendVisible- Read
isLegendVisible()WritesetLegendVisible()NotifylegendVisibleChanged() int maximumPointCount- Read
maximumPointCount()WritesetMaximumPointCount()NotifymaximumPointCountChanged() int maximumFrameRate- Read
maximumFrameRate()WritesetMaximumFrameRate()NotifymaximumFrameRateChanged() bool autoRange- Read
isAutoRange()NotifyxRangeChanged()
Methods
void setModel(ChartModel* model)Sets a single chart model (still managed by the caller); pass nullptr to clear.
bool addSeries(ChartModel* model)Adds a series model (up to 32, caller-managed); duplicates are ignored. Pie and Donut only render seriesModel(0); prefer setModel() for those types.
void setChartType(ChartType type)Changes the chart type on a generic ChartView; dedicated subclasses keep a fixed type.
QString valueSuffix() constUnit suffix appended to value readouts (e.g. " ms" or "%").
void setValueSuffix(const QString& suffix)Unit suffix appended to value readouts (e.g. " ms" or "%").
bool isLoading() constShows a loading state while data is prepared externally.
void setLoading(bool loading)Shows a loading state while data is prepared externally.
void setYRange(double minimum, double maximum)Sets a finite increasing Y range (e.g. [0, 100]); invalid ranges are ignored.
void setMaximumPointCount(int count)Sets the sampled point budget in [512, 65536], capped by viewport width.
void setMaximumFrameRate(int rate)Throttles model updates to [1, 60] Hz; hidden charts pause updates.
void setXRange(double minimum, double maximum)Sets a finite increasing X range; invalid ranges are ignored.
void setCurrentPoint(int series, int row)Moves the data cursor to a series row; pass -1 to clear.
int renderedPointCount() constSampled point count from the most recent paint pass.
QImage exportImage(double scale = 1.0)Exports the chart image at the given scale (without hover cursor or focus outline); call on the GUI thread.
QByteArray exportPng(double scale = 1.0)Encodes exportImage() as PNG bytes, returning empty on failure.
QByteArray exportCsv(bool visibleRangeOnly = false) constExports raw model rows as UTF-8 CSV (columns: series, name, x, y, label, unit); call on the GUI thread. Pass visibleRangeOnly = true to restrict Cartesian charts to the current X range.
void copyImage(double scale = 1.0)Copies the chart PNG to the clipboard and emits imageCopied().
void copyData(bool visibleRangeOnly = false)Copies exported CSV rows to the clipboard and emits dataCopied(). Must be called on the GUI thread (off-thread calls emit dataCopied(false)).
Signals
void valueSuffixChanged(const QString& suffix)Unit suffix appended to value readouts (e.g. " ms" or "%").
void loadingChanged(bool loading)Shows a loading state while data is prepared externally.
void rangeActivated(int series, int first, int last)Emitted when a displayed point or bucket [first, last) is activated.
Enumerations
enum ChartTypeLineAreaBarHorizontalBarPieDonutScatterSparkline
Inherited from fluent::FluentElement
Methods
static void setTheme(Theme theme)Updates the global theme and notifies active FluentElement instances.
static void setThemeDeferred(Theme theme)Schedules a visible-first batched theme refresh without blocking the current interaction.
static Theme currentTheme()Returns the currently active global theme.
static bool themeUsesDarkAppearance(Theme theme)Returns whether a theme uses dark-backed chrome and material tokens.
static void refreshTheme()Re-broadcasts the current theme to repaint after a design-token change.
static int themeGeneration()Monotonic counter bumped on every theme change, for staleness checks.
Theme effectiveTheme() constResolves the theme used by this element, honoring an inherited QWidget override.
bool effectiveThemeUsesDarkAppearance() constReturns whether this element's effective theme uses dark-backed chrome.
bool setThemeOverrides(const QJsonObject& overrides)Replaces this element's sparse color, radius, and font token overrides.
QJsonObject themeOverrides() constReturns this element's authored overrides.
void clearThemeOverrides()Restores all token fields to global theme defaults.
const Colors& themeColorsRef() constNon-copying access to the active color set for hot paint paths.
Material::AcrylicToken themeAcrylic() constMaterial, elevation, and adaptive layout tokens.
QColor themeBackdrop(bool active) constWindow-chrome backdrop color for the given activation state.
virtual void onThemeUpdated()Called after the global theme changes.
Enumerations
enum ThemeGlobal visual theme used when resolving design tokens.
Light = 0Dark = 1HighContrast = 2
Types and aliases
struct ColorsDesign token snapshots returned to components.
Inherited from fluent::QMLPlus
Methods
AnchorLayout::Anchors* anchors()Returns mutable anchors for the QWidget host.
void setState(const QString& name)Applies a registered state by name, or restores the default state when @p name is empty. Unknown names are ignored, and existing bindings resume when leaving the state.
void addState(const QMLState& state)Registers or replaces a named state definition; replacing the active state applies it immediately.
void evaluateStates()Reevaluates state conditions in registration order and activates the first match, or the default state if none match. Also runs automatically when dependency properties notify; derived states using extend inherit ancestor changes unless cyclic or missing.
QMLPlusRuntime* runtime()Returns the lazily created state observer owned by this host.
void setAnchors(const AnchorLayout::Anchors& anchors)Replaces all host anchors and invalidates the parent layout.
void resetAnchors()Clears all host anchors and invalidates the parent layout.
void bind(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction dir = PropertyBinder::OneWay)Binds @p sourceProp on @p source to @p targetProp on this QWidget host via PropertyBinder::bind().
BindingHandle bindManaged(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction direction = PropertyBinder::OneWay, BindingOptions options = {})Installs a managed direct binding on this QWidget host.
BindingHandle bindComputed(const char* targetProp, const QVector<BindingDependency>& dependencies, std::function<QVariant()> evaluate, BindingOptions options = {})Installs an explicit-dependency C++ expression on this QWidget host.
void addTransition(const StateTransition& transition)Registers a state transition in precedence order.
void setBehavior(const char* propertyName, const PropertyAnimation& animation)Sets the default animation used when @p propertyName is written via writeProperty() or a binding. Explicit StateTransition rules take precedence; direct C++ setter calls are not animated.
void clearBehavior(const char* propertyName)Removes the default animation for future managed writes.
bool writeProperty(const char* propertyName, const QVariant& value)Writes a host property through Behavior without removing its binding.
Qt base class docs: QWidget