| 876 | } |
| 877 | |
| 878 | void PlotDataDialog::setAxesTitles(CartesianPlot* plot, const QString& name) const { |
| 879 | DEBUG(Q_FUNC_INFO) |
| 880 | const auto& axes = plot->children<Axis>(); |
| 881 | switch (m_plotType) { |
| 882 | case Plot::PlotType::Line: |
| 883 | case Plot::PlotType::LineHorizontalStep: |
| 884 | case Plot::PlotType::LineVerticalStep: |
| 885 | case Plot::PlotType::LineSpline: |
| 886 | case Plot::PlotType::Scatter: |
| 887 | case Plot::PlotType::ScatterYError: |
| 888 | case Plot::PlotType::ScatterXYError: |
| 889 | case Plot::PlotType::LineSymbol: |
| 890 | case Plot::PlotType::LineSymbol2PointSegment: |
| 891 | case Plot::PlotType::LineSymbol3PointSegment: |
| 892 | case Plot::PlotType::Formula: { |
| 893 | // x-axis title |
| 894 | const QString& xColumnName = ui->cbXColumn->currentText(); |
| 895 | // DEBUG(Q_FUNC_INFO << ", x column name = " << STDSTRING(xColumnName)) |
| 896 | |
| 897 | for (auto* axis : axes) { |
| 898 | if (axis->orientation() == Axis::Orientation::Horizontal) { |
| 899 | axis->title()->setText(xColumnName); |
| 900 | break; |
| 901 | } |
| 902 | } |
| 903 | |
| 904 | // y-axis title |
| 905 | for (auto* axis : axes) { |
| 906 | if (axis->orientation() == Axis::Orientation::Vertical) { |
| 907 | if (!name.isEmpty()) { |
| 908 | // multiple columns are plotted with "one curve per plot", |
| 909 | // the function is called with the column name. |
| 910 | // use it for the x-axis title |
| 911 | axis->title()->setText(name); |
| 912 | } else if (m_columnComboBoxes.size() == 2) { |
| 913 | // if we only have one single y-column to plot, we can set the title of the y-axes |
| 914 | const QString& yColumnName = m_columnComboBoxes[1]->currentText(); |
| 915 | axis->title()->setText(yColumnName); |
| 916 | } |
| 917 | |
| 918 | break; |
| 919 | } |
| 920 | } |
| 921 | break; |
| 922 | } |
| 923 | case Plot::PlotType::Histogram: |
| 924 | case Plot::PlotType::KDEPlot: { |
| 925 | // x-axis title |
| 926 | for (auto* axis : axes) { |
| 927 | if (axis->orientation() == Axis::Orientation::Horizontal) { |
| 928 | if (!name.isEmpty()) { |
| 929 | // multiple columns are plotted with "one curve per plot", |
| 930 | // the function is called with the column name. |
| 931 | // use it for the x-axis title |
| 932 | axis->title()->setText(name); |
| 933 | } else if (m_columnComboBoxes.size() == 1) { |
| 934 | const QString& yColumnName = m_columnComboBoxes.constFirst()->currentText(); |
| 935 | axis->title()->setText(yColumnName); |
nothing calls this directly
no test coverage detected