
QSint Charts
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
BarChartPlotter is a simple Bar Chart plotting widget.
This is a technical preview only - BarChartPlotter will be included into QSint::Charts library.
BarChartPlotter provides easy-to-use API and performs fast "native" painting (directly via QPainter).
Currently it allows to draw Bar Charts of 2 types: Stacked and Column.
BarChartPlotter follows MVC ideology using QAbstractItemModel as data source.
Karbofos
8 years ago
Many thanks for this project. :)
My question: i try to colorize the separate items of the chart, for example:
itemModel->setData(itemModel->index(i, j), Qt::red, Qt::BackgroundRole);
or
itemModel->setData(itemModel->index(i, j), Qt::blue, Qt::ForegroundRole);
and the objects are not colorized. what is wrong?
thank you!
Report
Karbofos
8 years ago
replaced in BarChartPlotter::drawContent
// QPen pen(qvariant_cast<QColor>(m_model->headerData(j, Qt::Vertical, Qt::ForegroundRole)));
// QBrush brush(qvariant_cast<QBrush>(m_model->headerData(j, Qt::Vertical, Qt::BackgroundRole)));
QPen pen(qvariant_cast<QColor>(m_model->data(m_model->index(j,i), Qt::ForegroundRole)));
QBrush brush(qvariant_cast<QBrush>(m_model->data(m_model->index(j,i), Qt::BackgroundRole)));
this solution i need for colorized displaing of percent information, f. ex: about 35% is red and so on
Report