Page 1 of 1

Bottom Axis for PointFigure series showing incorrect.

Posted: Fri Aug 21, 2020 8:35 am
by 9526439
Teechart Version Using—ActiveX2018 64bit
Hello I want to implement "PointFigure" series, for that I have written the code below,

Code: Select all

    ui->mChart->RemoveAllSeries();
    ui->mChart->AddSeries(scPointFigure);

    ui->mChart->Series(0)->Clear();
    ui->mChart->Series(0)->XValues()->SetDateTime(1);
    ui->mChart->Legend()->SetVisible(false);

    std::vector<double> closingPoint = {5, 10,15,20,25};
    std::vector<double> highestPoint = {8, 16,24,32,40};
    std::vector<double>  lowestPoint = {1, 2,3,4,5};
    std::vector<double> openingPoint = {2, 4,6,8,10};
    std::vector<std::string>  timeDate   = {"2019-08-19","2019-08-20","2019-08-21","2019-08-22","2019-08-23"};

   QDate baseDate = QDate::fromString("1899-12-30","yyyy-MM-dd");

    auto timesize=timeDate.size();
   ui->mChart->Series(0)->FillSampleValues(timesize);

    for(int j=0;j<openingPoint.size();j++)
    {
        auto tempclose=closingPoint.at(j);
        auto templow=lowestPoint.at(j);
        auto tempopen=openingPoint.at(j);
        auto temphigh=highestPoint.at(j);

        QString DateValue = QString::fromStdString(timeDate.at(j));
        QDate dt= QDate::fromString(DateValue,"yyyy-MM-dd");
        auto diff = baseDate.daysTo(dt);

        ui->mChart->Series(0)->asPointFigure()->DateValues()->SetValue(j, diff);

        ui->mChart->Series(0)->asPointFigure()->LowValues()->SetValue(j,templow);

        ui->mChart->Series(0)->asPointFigure()->HighValues()->SetValue(j,temphigh);

        ui->mChart->Series(0)->asPointFigure()->OpenValues()->SetValue(j,tempopen);

        ui->mChart->Series(0)->asPointFigure()->CloseValues()->SetValue(j,tempclose);  }

  ui->mChart->Axis()->Bottom()->Labels()->SetDateTimeFormat("MM-dd-yyyy");
  ui->mChart->Repaint();
But this code did not work, data is showing correct in data tab of teechart editor,
but bottom axis value shows wrong, what i have to do to make it right please suggest.
Bottom axis values as shown below:
12-31-1899
12-30-1899
12-30-1899
12-30-1899
12-30-1899
We are not expecting these dates, we are expecting the dates which we are proving from data structure.
std::vector<std::string> timeDate = {"2019-08-19","2019-08-20","2019-08-21","2019-08-22","2019-08-23"}, these dates we are expecting to show in bottom axis.

Re: Bottom Axis for PointFigure series showing incorrect.

Posted: Tue Sep 01, 2020 7:40 am
by yeray
Hello,

Here you can find the code from another customer who also wanted to show the PointFigure dates in the bottom axis:
http://www.teechart.net/support/viewtop ... 1224#p4390