QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
Public 类型 | Public 成员函数 | 静态 Public 成员函数 | 所有成员列表
QwtColorCycle类 参考

Provides cyclic color selection from predefined palettes. 更多...

#include <qwt_color_cycle.h>

Public 类型

enum  Palette {
  Default10 , Tab10 , Tab20 , Set1 ,
  Set2 , Set3 , OkabeIto
}
 Built-in color palettes 更多...
 

Public 成员函数

 QwtColorCycle ()
 Construct with the Default10 palette (matplotlib classic)
 
 QwtColorCycle (Palette palette)
 Construct with a built-in palette
 
 QwtColorCycle (const QVector< QColor > &colors)
 Construct with custom colors
 
QColor color (int index) const
 Get a color by index (wraps around)
 
int count () const
 Get the number of colors in the cycle
 
void setPalette (Palette)
 Set the palette from a built-in preset
 
void setColors (const QVector< QColor > &)
 Set custom colors
 
QVector< QColor > colors () const
 Get the current color list
 

静态 Public 成员函数

static QVector< QColor > paletteColors (Palette)
 Get the colors for a built-in palette
 

详细描述

Provides cyclic color selection from predefined palettes.

QwtColorCycle manages an ordered list of colors and returns them in a cyclic manner using the color() method. This is used by QwtPlot to automatically assign distinct colors to plot items (curves, bar charts, etc.) when they are attached without a user-specified pen or brush.

Several built-in palettes are available, inspired by matplotlib, Tableau, ColorBrewer, and the Okabe-Ito colorblind-safe palette.

Example
QwtPlot plot;
auto* curve1 = new QwtPlotCurve("Series 1"); // gets color[0]
curve1->attach(&plot);
auto* curve2 = new QwtPlotCurve("Series 2"); // gets color[1]
curve2->attach(&plot);
@ OkabeIto
Okabe-Ito — 8 colorblind-safe colors
Definition qwt_color_cycle.h:72
QwtColorCycle()
Construct with the Default10 palette (matplotlib classic)
Definition qwt_color_cycle.cpp:17
A plot item, that represents a series of points
Definition qwt_plot_curve.h:75
A 2-D plotting widget
Definition qwt_plot.h:99
void setColorCycle(const QwtColorCycle &)
Set the color cycle used for automatic item coloring
Definition qwt_plot.cpp:1175
参见
QwtPlot::setColorCycle(), QwtPlot::colorCycle()

成员枚举类型说明

◆ Palette

Built-in color palettes

枚举值
Default10 

matplotlib classic 10 colors

Tab10 

Tableau Tab10 — high-contrast categorical colors

Tab20 

Tableau Tab20 — 20 colors with light/dark pairs

Set1 

ColorBrewer Set1 — 9 colors for qualitative data

Set2 

ColorBrewer Set2 — 8 colors for qualitative data

Set3 

ColorBrewer Set3 — 12 colors for qualitative data

OkabeIto 

Okabe-Ito — 8 colorblind-safe colors

构造及析构函数说明

◆ QwtColorCycle() [1/2]

QwtColorCycle::QwtColorCycle ( Palette  palette)
explicit

Construct with a built-in palette

参数
paletteBuilt-in palette selector

◆ QwtColorCycle() [2/2]

QwtColorCycle::QwtColorCycle ( const QVector< QColor > &  colors)
explicit

Construct with custom colors

参数
colorsCustom color list

成员函数说明

◆ color()

QColor QwtColorCycle::color ( int  index) const

Get a color by index (wraps around)

Get a color by index with cyclic wrap-around

参数
indexZero-based index (negative values are handled)
返回
Color at position (index % count)

◆ colors()

QVector< QColor > QwtColorCycle::colors ( ) const

Get the current color list

返回
Copy of the internal color list

◆ count()

int QwtColorCycle::count ( ) const

Get the number of colors in the cycle

返回
Number of colors

◆ paletteColors()

QVector< QColor > QwtColorCycle::paletteColors ( Palette  palette)
static

Get the colors for a built-in palette

Get the color list for a built-in palette

参数
paletteBuilt-in palette selector
返回
Color list for the specified palette

◆ setColors()

void QwtColorCycle::setColors ( const QVector< QColor > &  colors)

Set custom colors

Replace current colors with a custom list

参数
colorsCustom color list

◆ setPalette()

void QwtColorCycle::setPalette ( Palette  palette)

Set the palette from a built-in preset

Replace current colors with a built-in palette

参数
paletteBuilt-in palette selector

该类的文档由以下文件生成: