color related crash with waterfall + sidewall

TeeChart for ActiveX, COM and ASP
Post Reply
andrzej
Newbie
Newbie
Posts: 6
Joined: Fri Nov 15, 2002 12:00 am
Location: tucson, AZ

color related crash with waterfall + sidewall

Post by andrzej » Thu Dec 11, 2003 5:48 pm

Hi, here's antother on for Chris 8O
Im using Tchart version 5.0.6.0, VC++ 6.0. Attempting to set a sidewall color on a waterfall chart crashes if the data was set using addArrayXYZ.
Setting data points with AddXYZ works ok. I assume this is related to no color set for data points, using the addArrayMethod. Heres my test code snippet. Full test app available on request

Code: Select all

  //create chart and add as child of "this" view. 
  m_chart = new CTChart();
  m_chart->Create (CHART_CLASSNAME, "", WS_CHILD, rect, this,   IDC_TCHART);
	m_chart->SetVisible(TRUE);


  //add waterfall
  m_chart->AddSeries(scWaterfall);
  CWaterfallSeries  waterfall = m_chart->Series(0).GetAsWaterfall();

  //make irregular
  waterfall.SetIrregularGrid(TRUE);

  //copy over to safe arrays, first dimension them. 
  long size = 10;
 
  //create data arrays
  COleSafeArray XValues;
  COleSafeArray YValues;
  COleSafeArray ZValues;
  XValues.CreateOneDim(VT_R8, size*size);
  YValues.CreateOneDim(VT_R8, size*size);
  ZValues.CreateOneDim(VT_R8, size*size);


  //create 10x10 data grid. x in increments of 0.22, z integer increments 
  //y random
  long index[1];
  for(int ii = 0; ii<size; ++ii)
  {
    for(int jj = 0; jj<size; ++jj)
    {
      double val = jj*0.22;
      index[0] = jj + ii*size;
      XValues.PutElement(index,&val);

      val = 0.001*rand();
      YValues.PutElement(index,&val);

      val = ii;
      ZValues.PutElement(index,&val);
    }
  }

  //turn off paint
  m_chart->SetAutoRepaint(FALSE);

  //==============================
  //This code crashed after setting side brush
  //==============================
  waterfall.AddArrayXYZ(XValues,YValues,ZValues);

  //this line will fire an exception if adding data with arrays
  //adding data points individually and  then setting side color works
  waterfall.GetSideBrush().SetColor(RGB(255, 0, 0));

 
  //==============================
  //This code works
  //==============================
  //for(int i =0; i < 10; ++i) 
  //{ 
     //for(int j = 0; j<10; ++j)
     //{
      //notice X coord is non - integer, this will crash when data tab selected
      //on editor dialog. Change to integer and it will work.
      //waterfall.AddXYZ(j*0.22, 0.001*rand(),i,"", clTeeColor);
     //}
  //}
  //this works if data set point by point
  //waterfall.GetSideBrush().SetColor(RGB(255, 0, 0));
  m_chart->SetAutoRepaint(TRUE);
Regards Andrzej

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Mon Dec 15, 2003 12:22 pm

Hi Andrzej,
Hi, here's antother on for Chris
Eeek :wink: !!
Im using Tchart version 5.0.6.0, VC++ 6.0. Attempting to set a sidewall color on a waterfall chart crashes if the data was set using addArrayXYZ.
Setting data points with AddXYZ works ok. I assume this is related to no color set for data points, using the addArrayMethod. Heres my test code snippet. Full test app available on request
OK, I've been able to reproduce this problem in AXv5.0.6.0 and can confirm that this defect has been resolved in AXv6.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply