Bottom Axis for PointFigure series showing incorrect.

TeeChart for ActiveX, COM and ASP
Post Reply
amol
Advanced
Posts: 231
Joined: Tue Mar 29, 2005 5:00 am

Bottom Axis for PointFigure series showing incorrect.

Post by amol » Fri Aug 21, 2020 8:35 am

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.

Yeray
Site Admin
Site Admin
Posts: 8973
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Bottom Axis for PointFigure series showing incorrect.

Post by Yeray » Tue Sep 01, 2020 7:40 am

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
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply