是否可以在单个qbarset中为每个bar设置颜色?
QBarSet *set0 = new QBarSet("Jane");
*set0 << 1 << 2 << 3 << 4 << 5 << 6;
QHorizontalBarSeries *series = new QHorizontalBarSeries();
series->append(set0);
QChart *chart = new QChart();
chart->addSeries(series);
每个QBarSet
都是独立的。您可以在它们上创建一个QLIST并迭代它们,并使用SetColor((。例如:
QList<QBarSet *> barsets;
barsets.append(set0);
[...]
QColor color("blue");
for(auto barset: barsets){
barset->setColor(color);
}