! * \brief two datasets, stacked, with a negative value */
| 124 | * \brief two datasets, stacked, with a negative value |
| 125 | */ |
| 126 | void BarPlotTest::testRange04() { |
| 127 | Project project; |
| 128 | auto* ws = new Worksheet(QStringLiteral("worksheet")); |
| 129 | project.addChild(ws); |
| 130 | |
| 131 | auto* p = new CartesianPlot(QStringLiteral("plot")); |
| 132 | ws->addChild(p); |
| 133 | |
| 134 | auto* barPlot = new BarPlot(QStringLiteral("barplot")); |
| 135 | barPlot->setType(BarPlot::Type::Stacked); |
| 136 | p->addChild(barPlot); |
| 137 | |
| 138 | // set the data |
| 139 | QVector<const AbstractColumn*> dataColumns; |
| 140 | |
| 141 | auto* c1 = new Column(QStringLiteral("data1")); |
| 142 | c1->setValueAt(0, 3.); |
| 143 | c1->setValueAt(1, 6.); |
| 144 | c1->setValueAt(2, 9.); |
| 145 | c1->setValueAt(3, 12.); |
| 146 | dataColumns << c1; |
| 147 | |
| 148 | auto* c2 = new Column(QStringLiteral("data2")); |
| 149 | c2->setValueAt(0, 2.); |
| 150 | c2->setValueAt(1, 5.); |
| 151 | c2->setValueAt(2, 8.); |
| 152 | c2->setValueAt(3, -11.); |
| 153 | dataColumns << c2; |
| 154 | |
| 155 | barPlot->setDataColumns(dataColumns); |
| 156 | |
| 157 | // check the min and max range values |
| 158 | QCOMPARE(barPlot->minimum(Dimension::X), 0.0); |
| 159 | QCOMPARE(barPlot->maximum(Dimension::X), 4.0); |
| 160 | QCOMPARE(barPlot->minimum(Dimension::Y), -11.); |
| 161 | QCOMPARE(barPlot->maximum(Dimension::Y), 17.); |
| 162 | } |
| 163 | |
| 164 | /*! |
| 165 | * \brief two datasets, stacked 100% |
nothing calls this directly
no test coverage detected