3D view issue(ArgumentOutOfRangeException)

A forum dedicated to WinForms version of LightningChart Ultimate.

3D view issue(ArgumentOutOfRangeException)

Postby ragebobber » Sun Feb 24, 2019 7:37 pm

HI, I want to create 3D graph derivative function like this Image,but have issue System.ArgumentOutOfRangeException
what I am doing wrong?
Code: Select all
void __3d(vector<int>y) {
lightningChartUltimate1 = gcnew LightningChartUltimate();

lightningChartUltimate1->BeginUpdate();
cli::array<SeriesPoint3D>^ points = gcnew cli::array<SeriesPoint3D>(y.size());
for (size_t i = 0; i < y.size()-1; i++) {
points[i].X = i * 0.2;
points[i].Y = y[i + 1] - y[i];
points[i].Z = i * 0.2;
}
lightningChartUltimate1->View3D->PointLineSeries3D[0]->Points = points; //System.ArgumentOutOfRangeException:Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
lightningChartUltimate1->EndUpdate();                                     
}
ragebobber
 
Posts: 2
Joined: Sat Feb 23, 2019 6:02 am

Re: 3D view issue(ArgumentOutOfRangeException)

Postby ArctionKestutis » Mon Feb 25, 2019 7:30 am

Hello,

You need to create PointLineSeries3D object and add it to collection View3D->PointLineSeries3D, because initially collection is empty.

Hope this helps.
ArctionKestutis
 
Posts: 353
Joined: Mon Mar 14, 2016 9:22 am

Re: 3D view issue(ArgumentOutOfRangeException)

Postby ragebobber » Mon Feb 25, 2019 2:49 pm

ArctionKestutis wrote:Hello,

You need to create PointLineSeries3D object and add it to collection View3D->PointLineSeries3D, because initially collection is empty.

Hope this helps.


Thx u a lot. You helped me

I just post it like 3D chart winforms c++ example
Code: Select all
void __3dchart(vector<int> y)
      {
      chart3d->BeginUpdate();
      chart3d->Parent = tabControl1->TabPages[1];
      chart3d->Name = "3D line plot";
      chart3d->ActiveView = ActiveView::View3D;
      //create Series obj
      auto series = gcnew PointLineSeries3D(chart3d->View3D, Axis3DBinding::Primary, Axis3DBinding::Primary, Axis3DBinding::Primary);
      series->PointStyle->Shape3D = PointShape3D::Sphere;
      series->PointStyle->Size3D->SetValues(1, 1, 1);
      series->Material->DiffuseColor = Color::Navy;
      series->Material->SpecularColor = Color::Red;
      series->Material->SpecularPower = 20;
      series->LineVisible = true;
      series->LineStyle->AntiAliasing = LineAntialias::Normal;
      series->LineStyle->Color = Color::FromArgb(100, Color::Red);
      series->LineStyle->Width = 0.2f;
      series->LineStyle->LineOptimization = LineOptimization::NormalWithShading;
      series->PointsVisible = false;
      chart3d->View3D->PointLineSeries3D->Add(series);//add series

      auto series1 = chart3d->View3D->PointLineSeries3D[0];
        series1->Clear();//clear for new  points
      cli::array<SeriesPoint3D> ^ points = gcnew cli::array<SeriesPoint3D>(y.size());      
      vector<double> yz;//for max min XYZ correction
      for (size_t i = 0; i < y.size() - 1;i++) {
         points[i].X = points[i].Z = i*0.2;
         double v = points[i].Y =  y[i+1] - y[i];
         yz.push_back(v);   
      }
      //XYZ correction
      chart3d->View3D->YAxisPrimary3D->Maximum = *std::max_element(std::begin(yz), std::end(yz));
      chart3d->View3D->YAxisPrimary3D->Minimum = *std::min_element(std::begin(yz), std::end(yz));
      chart3d->View3D->XAxisPrimary3D->Maximum = yz.size()*0.2;//maxX
      chart3d->View3D->ZAxisPrimary3D->Maximum = yz.size()*0.2;//maxZ

      series1->Points = points;
      chart3d->EndUpdate();
      }
ragebobber
 
Posts: 2
Joined: Sat Feb 23, 2019 6:02 am


Return to LightningChart Ultimate WinForms

Who is online

Users browsing this forum: Bing [Bot] and 4 guests

cron