Skip to main content

QCustomRangeBarChart

Pro widget

QCustomRangeBarChart ships in Custom Widgets Pro. It is not part of the free GPLv3 package from 2.6.0 onward — the free package keeps the import path so Qt Designer forms still load, and installing Pro activates the widget with no code change. Releases up to 2.5.0 included it under the GPLv3.

Pro is licensed software and is not installable from PyPI — the name there is a pointer package with no widgets in it. Licence holders download the wheel from their account:

# https://portal.customwidgets.org/downloads
pip install <the downloaded .whl>

See plans

QCustomRangeBarChart

A painted floating-bar / range chart.

Each bar spans a low-to-high pair rather than sitting on a baseline: a temperature min/max, a salary band, a project window, a confidence interval. A normal bar chart cannot express "from X to Y".

QPainter only, NO QtCharts (see docs/design/mui-charts-gap.md). Axis ticks come from the shared _chart_axis so this agrees with Scatter about where round numbers fall.

Data goes in with setRanges([...]) in code, or rangesCsv in Qt Designer:

rangesCsv = "Mon=4,12;Tue=6,15;Wed=3,9" categoriesCsv overrides the labels if you prefer them separate

Emits barHovered(int) and barClicked(int); -1 means "nothing".

At a glance​

TierPro
Importfrom Custom_Widgets.QCustomRangeBarChart import QCustomRangeBarChart
Qt DesignerYes — drag it from the palette

Quick start​

from Custom_Widgets.QCustomRangeBarChart import QCustomRangeBarChart

widget = QCustomRangeBarChart()

Dark theme​

Colours come from the design tokens, so the widget follows the app theme with no extra work.

QCustomRangeBarChart in dark theme

Properties​

Every property below is settable in code and in Qt Designer.

PropertyTypeDefault
rangesCsvstring—
categoriesCsvstring—
orientationenum: vertical/horizontal``vertical
barWidthRatiofloat0.55
cornerRadiusint4
tickCountint5
showGridboolTrue
showAxisboolTrue
showLabelsboolTrue
showBoundsboolFalse
barColorcolor#2563eb
gridColorcolor#e2e8f0
labelColorcolor#64748b
boundsColorcolor#0f172a

Signals​

Signal
barClicked(int)
barHovered(int)

Methods​

MethodDescription
barAt(pos)Bar at.
barClicked(...)Bar clicked.
barColor(*args, **kwargs)Bar color.
barCount()Bar count.
barHovered(...)Bar hovered.
barRects()Bar rects.
barWidthRatio(*args, **kwargs)Bar width ratio.
boundsColor(*args, **kwargs)Bounds color.
categoriesCsv(*args, **kwargs)Categories csv.
clearRanges()Clear the ranges.
cornerRadius(*args, **kwargs)Corner radius.
dataBounds()Data bounds.
gridColor(*args, **kwargs)Grid color.
labelColor(*args, **kwargs)Label color.
orientation(*args, **kwargs)Orientation.
ranges()Ranges.
rangesCsv(*args, **kwargs)Ranges csv.
setRanges(ranges)Set the ranges.
showAxis(*args, **kwargs)Show the axis.
showBounds(*args, **kwargs)Show the bounds.
showGrid(*args, **kwargs)Show the grid.
showLabels(*args, **kwargs)Show the labels.
tickCount(*args, **kwargs)Tick count.
valueRange()Value range.
valueToPixel(value)Value -> pixel along the value axis.

Theming​

Colours come from the design tokens, so they follow the active theme. Roles used: accent, on-surface, surface-muted.

See Design tokens.

QCustomAreaChart · QCustomBarChart · QCustomBeeswarm · QCustomBubbleChart · QCustomCandlestickChart · QCustomCompass · QCustomCompassDial · QCustomDivergingBarChart