@@ -824,6 +824,10 @@ void QgsVectorLayerProperties::apply()
824
824
{
825
825
diagram = new QgsPieDiagram ();
826
826
}
827
+ else if ( mDiagramTypeComboBox ->currentText () == tr ( " Histogram" ) )
828
+ {
829
+ diagram = new QgsHistogramDiagram ();
830
+ }
827
831
828
832
QgsDiagramSettings ds;
829
833
ds.font = mDiagramFont ;
@@ -857,11 +861,11 @@ void QgsVectorLayerProperties::apply()
857
861
858
862
if ( mIncreaseSmallDiagramsCheckBox ->isChecked () )
859
863
{
860
- ds.mMinimumSize = mIncreaseMinimumSizeSpinBox ->value ();
864
+ ds.minimumSize = mIncreaseMinimumSizeSpinBox ->value ();
861
865
}
862
866
else
863
867
{
864
- ds.mMinimumSize = 0 ;
868
+ ds.minimumSize = 0 ;
865
869
}
866
870
867
871
ds.backgroundColor = mBackgroundColorButton ->color ();
@@ -878,6 +882,24 @@ void QgsVectorLayerProperties::apply()
878
882
ds.maxScaleDenominator = -1 ;
879
883
}
880
884
885
+ // Diagram orientation (histogram)
886
+ if ( tr ( " Up" ) == mOrientationButtonGroup ->checkedButton ()->text () )
887
+ {
888
+ ds.diagramOrientation = QgsDiagramSettings::Up;
889
+ }
890
+ else if ( tr ( " Down" ) == mOrientationButtonGroup ->checkedButton ()->text () )
891
+ {
892
+ ds.diagramOrientation = QgsDiagramSettings::Down;
893
+ }
894
+ else if ( tr ( " Right" ) == mOrientationButtonGroup ->checkedButton ()->text () )
895
+ {
896
+ ds.diagramOrientation = QgsDiagramSettings::Right;
897
+ }
898
+ else if ( tr ( " Left" ) == mOrientationButtonGroup ->checkedButton ()->text () )
899
+ {
900
+ ds.diagramOrientation = QgsDiagramSettings::Left;
901
+ }
902
+
881
903
if ( mFixedSizeCheckBox ->isChecked () )
882
904
{
883
905
QgsSingleCategoryDiagramRenderer* dr = new QgsSingleCategoryDiagramRenderer ();
@@ -1500,8 +1522,8 @@ void QgsVectorLayerProperties::on_mFixedSizeCheckBox_stateChanged( int state )
1500
1522
// enable / disable all widget in the scaling layout
1501
1523
mLinearlyScalingLabel ->setEnabled ( state != Qt::Checked );
1502
1524
mIncreaseSmallDiagramsCheckBox ->setEnabled ( state != Qt::Checked );
1503
- mIncreaseMinimumSizeLabel ->setEnabled ( state != Qt::Checked && mIncreaseSmallDiagramsCheckBox ->isChecked () == Qt::Checked );
1504
- mIncreaseMinimumSizeSpinBox ->setEnabled ( state != Qt::Checked && mIncreaseSmallDiagramsCheckBox ->isChecked () == Qt::Checked );
1525
+ mIncreaseMinimumSizeLabel ->setEnabled ( state != Qt::Checked && mIncreaseSmallDiagramsCheckBox ->isChecked () );
1526
+ mIncreaseMinimumSizeSpinBox ->setEnabled ( state != Qt::Checked && mIncreaseSmallDiagramsCheckBox ->isChecked () );
1505
1527
QWidget* currentWidget = 0 ;
1506
1528
for ( int i = 0 ; i < mLinearlyScalingLayout ->count (); ++i )
1507
1529
{
@@ -1614,6 +1636,7 @@ void QgsVectorLayerProperties::initDiagramTab()
1614
1636
1615
1637
mDiagramTypeComboBox ->addItem ( tr ( " Pie chart" ) );
1616
1638
mDiagramTypeComboBox ->addItem ( tr ( " Text diagram" ) );
1639
+ mDiagramTypeComboBox ->addItem ( tr ( " Histogram" ) );
1617
1640
1618
1641
mLabelPlacementComboBox ->addItem ( tr ( " Height" ) );
1619
1642
mLabelPlacementComboBox ->addItem ( tr ( " x-height" ) );
@@ -1708,8 +1731,28 @@ void QgsVectorLayerProperties::initDiagramTab()
1708
1731
mLabelPlacementComboBox ->setCurrentIndex ( 1 );
1709
1732
}
1710
1733
1711
- mIncreaseSmallDiagramsCheckBox ->setChecked ( settingList.at ( 0 ).mMinimumSize != 0 );
1712
- mIncreaseMinimumSizeSpinBox ->setValue ( settingList.at ( 0 ).mMinimumSize );
1734
+ switch ( settingList.at ( 0 ).diagramOrientation )
1735
+ {
1736
+ case QgsDiagramSettings::Left:
1737
+ mOrientationLeftButton ->setChecked ( true );
1738
+ break ;
1739
+
1740
+ case QgsDiagramSettings::Right:
1741
+ mOrientationRightButton ->setChecked ( true );
1742
+ break ;
1743
+
1744
+ case QgsDiagramSettings::Up:
1745
+ mOrientationUpButton ->setChecked ( true );
1746
+ break ;
1747
+
1748
+ case QgsDiagramSettings::Down:
1749
+ mOrientationDownButton ->setChecked ( true );
1750
+ break ;
1751
+
1752
+ }
1753
+
1754
+ mIncreaseSmallDiagramsCheckBox ->setChecked ( settingList.at ( 0 ).minimumSize != 0 );
1755
+ mIncreaseMinimumSizeSpinBox ->setValue ( settingList.at ( 0 ).minimumSize );
1713
1756
1714
1757
QList< QColor > categoryColors = settingList.at ( 0 ).categoryColors ;
1715
1758
QList< int > categoryIndices = settingList.at ( 0 ).categoryIndices ;
@@ -1758,6 +1801,10 @@ void QgsVectorLayerProperties::initDiagramTab()
1758
1801
{
1759
1802
mDiagramTypeComboBox ->setCurrentIndex ( mDiagramTypeComboBox ->findText ( tr ( " Pie chart" ) ) );
1760
1803
}
1804
+ else if ( diagramName == " Histogram" )
1805
+ {
1806
+ mDiagramTypeComboBox ->setCurrentIndex ( mDiagramTypeComboBox ->findText ( tr ( " Histogram" ) ) );
1807
+ }
1761
1808
}
1762
1809
}
1763
1810
0 commit comments