Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

UnMatched QChart YAxis



  • Hi All
    i can't under stand unmatched data

    • chart
      0_1534811707050_chart (2).PNG

    • data
      0_1534810906768_data.PNG

    -sourece code

    d->mChart->removeAllSeries();
    

    QSplineSeries* series = new QSplineSeries();
    this->setXRange(0, grayImg.size().width);
    this->setYRange(0, 285);

    for(int x = 0; x< grayImg.size().width; x++)
    {
            const QPoint point(x, value); // value == 255 / but graph is 285
            series->append(point);
    }
    
    qDebug() << series->pointsVector();
    
    
    d->mChart->addSeries(series);
    

    plz help

    thanks


  • Qt Champions 2019

    @dont-do-that All your points have y == 255, so you're drawing a horizontal line.



  • @jsulm thx reply but i find answer

    //all charts are need createDefaultAxes Function
    // Document - > The axes specific to the series can be later obtained from the chart by providing the series as the parameter for the axes() function call. QPieSeries does not create any axes.

    d->mChart->removeAllSeries();
    d->mChart->addSeries(series);
    d->mChart->createDefaultAxes(); // always need this function after addSeries


Log in to reply