QLogValueAxis doesn't show up help



  • I have some Problems with the log axis.
    The axis doesn't show up
    Anyone any idea ?

    // Here i set up the charts -> 2 Charts
        QChart *Buger = new QChart();
        Buger->legend()->setVisible(true);
        QChart *BugerFlux = new QChart();
        BugerFlux->legend()->setVisible(true);
    
    //Here i set up the X Axis which with a DateTimes
        QDateTimeAxis *axisX = new QDateTimeAxis;
        axisX->setFormat("dd MMM yyyy - hh:mm");
        axisX->setTitleText("Time Step");
        Buger->addAxis(axisX, Qt::AlignBottom);
    
    // This is the same Axis for the second chart
        QDateTimeAxis *axisXflux = new QDateTimeAxis;
        axisXflux->setFormat("dd MMM yyyy - hh:mm");
        axisXflux->setTitleText("Time Step");
        BugerFlux->addAxis(axisXflux, Qt::AlignBottom);
    
    // Here i set up a normal value axis as Y axis for the first Chart which works fine (the second chart is the Problem)
        QValueAxis *axisY = new QValueAxis;
        axisY->setTitleText("Mean Speed [<html>kms<sup>-1</sup></html>]");
        Buger->addAxis(axisY, Qt::AlignLeft);
    
    //Here i want to set up the Log Axis 
        QLogValueAxis *axisYflux = new QLogValueAxis;
        axisYflux->setLabelFormat("%g");
        axisYflux->setTitleText("Values");
        axisYflux->setBase(10.0);
        BugerFlux->addAxis(axisYflux, Qt::AlignLeft); // Here i add it to the QChart
    
    // Here i set up the Series in a (It depends how many the user has selected) MicronStatus is a vector with true or 
    // False  
    
     for(int m =0;m<MicronStatus.size();m++)
                {
                        QLineSeries *bugerseries1 = new QLineSeries();
                        QLineSeries *bugerseriesFlux = new QLineSeries();
    
                        if(MicronStatus[m]==true) //If the Status is True 
                        {
    
                        for(int i = 0 ; i<value[m].size();i++)
                            {
                                  bugerseries1->append(AllStepDatesAsQDatetime[i].toMSecsSinceEpoch(), value[m][i])
                            }
    
                        for(int i = 0 ; i<value2[m].size();i++)
                            {
                              bugerseriesFlux->append(AllStepDatesAsQDatetime[i].toMSecsSinceEpoch(), value2[m][i])
                            }
                                 bugerseries1->setColor(Qt::red);
                                 bugerseries1->setName("1");
                                 bugerseriesFlux->setColor(Qt::red);
                                 bugerseriesFlux->setName("1");
    
                        }
                       
    // This is maybe the Problem :/
                        BugerFlux->addSeries(bugerseriesFlux);
                        bugerseriesFlux->attachAxis(axisXflux);
                        bugerseriesFlux->attachAxis(axisYflux);
    
                            Buger->addSeries(bugerseries1);
                            bugerseries1->attachAxis(axisX);
                            bugerseries1->attachAxis(axisY);
    
                    }
                        
                }
    
                axisY->setRange(0,maxplotvalue+maxplotvalue/4);
                Buger->addAxis(axisY, Qt::AlignLeft);
    
               BugerFlux->addAxis(axisYflux, Qt::AlignLeft); // Or this could be the Problem 
    
                QChartView *BugerView = new QChartView(Buger);
                BugerView->setRenderHint(QPainter::Antialiasing);
                QChartView *BugerViewFlux = new QChartView(BugerFlux);
                BugerView->setRenderHint(QPainter::Antialiasing);
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.