Thanks to visit codestin.com
Credit goes to Github.com

Skip to content
/ QWT Public

Deeply extended from the classic QWT library, Adds CMake support, a Figure window container, multi-axis capabilities, real-time panner, axis interaction, data picking, and other features, aiming to serve as a protocol-friendly LGPL-compliant plotting widget.

License

Notifications You must be signed in to change notification settings

czyt1988/QWT

Repository files navigation

Overview

There are only a handful of plotting libraries in the Qt ecosystem, the mainstream ones being QCustomPlot, Qwt, Qt Charts, and KDChart.
After Qt 6.8 the former Qt Charts (2-D) and Qt DataVisualization (3-D) were merged into a unified Qt Graphs module (note: not Qt Graphics). The new back-end is built entirely on Qt Quick Scene Graph (QSG) + Qt Quick 3D, completely abandoning the aging Graphics-View / QPainter pipeline.
However, Qt Graphs must be embedded through QQuickWidget or QQuickWindow, which means the QML runtime is mandatory and C++ support is poor—complaints on the forum are numerous.
Although Qt Graphs is Qt’s official “unified” future, that future probably will not arrive within the next three years, and it drops support for older systems such as Windows 7 and is unfriendly to embedded devices.
Therefore, QCustomPlot, Qwt, Qt Charts, and KDChart will remain the practical choices for the next few years.

  • QCustomPlot is the simplest and most attractive, and enjoys the widest adoption.
    Just include qcustomplot.h and qcustomplot.cpp and you are ready to go (official docs).
    It also supports Qt 6.
    Its biggest drawback, however, is the GPL license, which is highly “viral”: any program that uses QCustomPlot must itself be GPL—a deal-breaker for commercial use.

  • Qwt is a veteran plotting library (official docs) with solid performance, yet its deployment difficulty deters many users.
    It is licensed under LGPL, which is relatively commercial-friendly.

  • Qt Charts is Qt’s own plotting package (official docs) but its performance is poor—arguably very low—and unsuitable for scientific computing.
    Worse, Qt Charts has no LGPL option; the open-source version is GPL v3, so using it in a project forces the entire project to be open-sourced under GPL v3.

  • KDChart is KDAB’s plotting library (official docs).
    Starting with KDChart 3.0 it is MIT-licensed, making it extremely commercial-friendly.
    Its rendering style, however, is mediocre—reminiscent of Excel 2003.
    A unique feature is Gantt charts, unavailable in the other three.

Hence, for commercial projects you are effectively limited to Qwt and KDChart 3.0.
Because the Qwt author has ceased maintenance, I personally prefer Qwt: its architecture conforms better to software-engineering principles and its large-scale rendering performance is superior.
QCustomPlot delivers out-of-the-box interactive features such as mouse zooming and axis scaling, whereas Qwt requires more code to achieve the same, yet it offers finer-grained control.
When my own projects need plotting I therefore choose Qwt, enhancing and optimizing it with the features I need—hence this project.

docmenthttps://czyt1988.github.io/QWT/zh/

Qwt7.0

I have taken over maintenance of the final official Qwt release, adding the features I need while gradually refining existing ones, e.g., its outdated default styling.

Project repositories:

Goals and current progress:

  • CMake support
  • Qt 6 support
  • C++11 modernization
  • Merged into single header/source for easier inclusion
  • Optimize rendering for ultra-large data sets
  • Provide integrated interaction helpers for simpler usage
  • Modernized visual style
  • Figure class for layout management
  • Add parasite-axis support for unlimited axes

In short, I will keep maintaining Qwt so it becomes a license-friendly, high-performance, and easy-to-use Qt plotting library.

New Features in Qwt7.0

CMake Support

Qwt7.0 now supports CMake; qmake may be dropped in the future.
After installing Qwt you can simply link it in your project:

target_link_libraries(${YOUR_APP_TARGET} PUBLIC qwt::qwt)

Single Header & Source File

Following the example of QCustomPlot, I have merged the entire Qwt library into QwtPlot.h and QwtPlot.cpp.
Drop these two files into your project and you are ready to go.

Example CMakeLists.txt:

# QwtPlot requires Core Gui Widgets Svg Concurrent OpenGL PrintSupport
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} 5.8 COMPONENTS Core Gui Widgets Svg Concurrent OpenGL PrintSupport REQUIRED)

add_executable(YOUR_APP_TARGET
    main.cpp
    QwtPlot.h
    QwtPlot.cpp
)

target_link_libraries(YOUR_APP_TARGET
    PUBLIC
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Gui
    Qt${QT_VERSION_MAJOR}::Widgets
    Qt${QT_VERSION_MAJOR}::Svg
    Qt${QT_VERSION_MAJOR}::Concurrent
    Qt${QT_VERSION_MAJOR}::OpenGL
    Qt${QT_VERSION_MAJOR}::PrintSupport
)

Modernized Visual Style

The original Qwt style used an outdated beveled look inconsistent with modern aesthetics.
I therefore redesigned it.
Qwt 6.3:

qwt6.3 effect

Qwt 7.0:

qwt7.0 effect

Key changes: removed the default sunken style, placed axes flush against the plot area, overall appearance now aligns with contemporary design.

Added Figure Container

Similar to Python's matplotlib, Qwt provides a Figure plotting container that enables convenient layout of multiple plots.

With the newly added QwtFigure class, arranging multiple plots becomes effortless, supporting grid layouts (analogous to matplotlib's subplot).

The QwtFigureWidgetOverlay class has been configured synchronously, integrating several operations of QwtFigure—such as adjusting plot sizes and moving plots.

For details, refer to the tutorial: Figure Plotting Container

Added Parasite Axes

Qwt7 now supports parasite axes, allowing multiple plots to share the same axes.

For details, refer to the tutorial:Creating Multiple Coordinate Axes

Added Axis Interactions

Axis interaction functionality has been added, supporting drag-and-drop and mouse wheel zoom directly on the axes.

Panning: qwt-scale-builtin-action-pan

Zooming: qwt-scale-builtin-action-zoom

For details, refer to the tutorial:Coordinate Axis Interactive Actions

Added Data Picking Functionality

Added the QwtPlotSeriesDataPicker class to support data picking.

series-data-picker-yvalue

series-data-picker-nearest-value

For details, refer to the tutorial:Series Data Picker

Enhanced Canvas Panning

Refactored QwtPlotPicker to enable real-time canvas panning; the original implementation has been renamed QwtPlotCachePanner.
The new panner simultaneously supports dragging on any number of axes.

Preview:

qwt-realtime-panner

For details, refer to the tutorial: Panning

New Canvas Zoomer

The legacy QwtPlotZoomer requires you to specify two axes for every zoom operation.
If your plot uses four axes you must attach two zoomers—cumbersome and multi-axis-unfriendly.

The new QwtPlotCanvasZoomer needs no axis specification; it zooms the entire canvas as a whole and works seamlessly with any number of axes.

For details, refer to the tutorial: Zoomer

Other Modifications

  • Fixed the impact of NAN and INF values on plotting

Changelog

See CHANGES.MD for detailed logs.

Gallery

Basic Charts

Simple Plot
examples/simpleplot

Bar Chart - Grouped
examples/barchart

Bar Chart - Stacked
examples/barchart

Scatter Plot
examples/scatterplot

Curve Demo
examples/curvedemo

Real-Time Visualization

CPU Monitor
examples/cpuplot

Real-Time Plot
examples/realtime

Oscilloscope
examples/oscilloscope

Advanced Charts

Polar Demo
examples/polardemo

Spectrogram
examples/spectrogram

Contour Spectrogram
examples/spectrogram

Vector Field
playground/vectorfield

Stock Chart
examples/stockchart

Bode Plot
examples/bode

Tube Display
examples/friedberg

plot matrix
playground/plotmatrix

Scale Engine
playground/scaleengine

Rescaler
playground/rescaler

Graphics Scale
playground/graphicscale

Spline Editor
examples/splineeditor

System Info
examples/sysinfo

Distro Watch
examples/distrowatch

Raster View 1
examples/rasterview

Raster View 2
examples/rasterview

SVG Map
playground/svgmap

Animated Demos

Animated Demo
examples/animated

Curve Tracker
playground/curvetracker

Refresh Test
examples/refreshtest

Styles & Symbols

Legends Demo
examples/legends

Symbols Demo
playground/symbols

Shape Rendering
playground/shapes

Control Widgets

Dial Controls
examples/controls

Knob Controls
examples/controls

Slider Controls
examples/controls

Wheel & Thermo
examples/controls

Radio Buttons
examples/radio

Time Scale Demo
playground/timescale

Instrument Panels

Compass Dial
examples/dials

Cockpit Dials
examples/dials

About

Deeply extended from the classic QWT library, Adds CMake support, a Figure window container, multi-axis capabilities, real-time panner, axis interaction, data picking, and other features, aiming to serve as a protocol-friendly LGPL-compliant plotting widget.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages