more work on the pie chart

This commit is contained in:
Peter Hartmann 2020-05-22 16:05:07 +02:00
parent fd668c23e6
commit fbc9c563ee
1 changed files with 12 additions and 4 deletions

View File

@ -42,10 +42,19 @@ QSGNode* PieChartSkinlet::updatePanelNode( const PieChart* pieChart, QSGNode* no
boxNode = new QskBoxNode;
}
const auto panelRect = subControlRect( pieChart, pieChart->contentsRect(), PieChart::Panel );
auto panelRect = subControlRect( pieChart, pieChart->contentsRect(), PieChart::Panel );
// ### when displaying a legend we might want to revise this
if( panelRect.width() > panelRect.height() )
{
panelRect.setWidth( panelRect.height() );
}
else if( panelRect.width() < panelRect.height() )
{
panelRect.setHeight( panelRect.width() );
}
const qreal radius = panelRect.width() / 2;
qDebug() << "radius:" << radius << panelRect;
QskBoxShapeMetrics shapeMetrics( radius, radius, radius, radius );
QskBoxBorderMetrics borderMetrics = pieChart->boxBorderMetricsHint( PieChart::Panel );
@ -60,8 +69,7 @@ QSGNode* PieChartSkinlet::updateLabelsNode( const PieChart* pieChart, QSGNode* n
{
const int labelsCount = pieChart->labels().count();
// ### actually, we could draw labels with only one entry
if ( labelsCount <= 1 )
if ( labelsCount < 1 )
{
return nullptr;
}