Crash in bar chart
Posted: Thu Dec 04, 2003 3:43 pm
Hi
Im using Tchart version 5.0.6.0, VC++ 6.0. Im getting an exception fired in debug mode, if I
1) Create a bar chart
2) Turn on color each point
3) Open the editor dialog and select the Data tab.
Note* This only happends when the color each point property is set to true.
I think theres an exception fired somewhere, probably when the it tries to fill in the data in the color column of the data table. I have not tried this in relase mode, so Im not sure if its isolated to debig only.
Heres my code snippet
const xercesc::DOMElement* elem = someXmlelement
vector<double> x;
vector<double> y;
create2Ddata(elem,x,y);
assert(x.size() == y.size());
int id = chartCtrl->AddSeries(scBar);
//horiz line is derived from line, so we can set style on line
//for both types
CBarSeries barChart = chartCtrl->Series(id).GetAsBar();
//get the percent width of the bars from xml file
//this will be first child of current element node
XMLCh* val;
wchar_t** stopStr = 0;
ChartUtils::getFirstChildNode(elem,ChartXmlString::percentBarWidthStr(),val);
double barWidth = 50;
if(val) barWidth = wcstod(val,stopStr);
//set bar width. Clip width to deal with roundoff
if(barWidth < 0.0) barWidth = 0.0;
if(barWidth > 100.0) barWidth = 100.0;
barChart.SetBarWidthPercent(barWidth);
//set style of bar chart to rectangular gradient
barChart.SetBarStyle(bsRectGradient);
//disable repaint while adding data.
chartCtrl->SetAutoRepaint(FALSE);
int len = x.size();
for(int i=0; i<len; ++i)
{
chartCtrl->Series(id).AddXY(x,y,"",clTeeColor);
}
//turn off marks on top of bars
chartCtrl->Series(id).GetMarks().SetVisible(FALSE);
chartCtrl->Series(id).SetColorEachPoint(TRUE);
//reactivate autorepaint and repaint
chartCtrl->SetAutoRepaint(TRUE);
chartCtrl->Repaint();
Im using Tchart version 5.0.6.0, VC++ 6.0. Im getting an exception fired in debug mode, if I
1) Create a bar chart
2) Turn on color each point
3) Open the editor dialog and select the Data tab.
Note* This only happends when the color each point property is set to true.
I think theres an exception fired somewhere, probably when the it tries to fill in the data in the color column of the data table. I have not tried this in relase mode, so Im not sure if its isolated to debig only.
Heres my code snippet
const xercesc::DOMElement* elem = someXmlelement
vector<double> x;
vector<double> y;
create2Ddata(elem,x,y);
assert(x.size() == y.size());
int id = chartCtrl->AddSeries(scBar);
//horiz line is derived from line, so we can set style on line
//for both types
CBarSeries barChart = chartCtrl->Series(id).GetAsBar();
//get the percent width of the bars from xml file
//this will be first child of current element node
XMLCh* val;
wchar_t** stopStr = 0;
ChartUtils::getFirstChildNode(elem,ChartXmlString::percentBarWidthStr(),val);
double barWidth = 50;
if(val) barWidth = wcstod(val,stopStr);
//set bar width. Clip width to deal with roundoff
if(barWidth < 0.0) barWidth = 0.0;
if(barWidth > 100.0) barWidth = 100.0;
barChart.SetBarWidthPercent(barWidth);
//set style of bar chart to rectangular gradient
barChart.SetBarStyle(bsRectGradient);
//disable repaint while adding data.
chartCtrl->SetAutoRepaint(FALSE);
int len = x.size();
for(int i=0; i<len; ++i)
{
chartCtrl->Series(id).AddXY(x,y,"",clTeeColor);
}
//turn off marks on top of bars
chartCtrl->Series(id).GetMarks().SetVisible(FALSE);
chartCtrl->Series(id).SetColorEachPoint(TRUE);
//reactivate autorepaint and repaint
chartCtrl->SetAutoRepaint(TRUE);
chartCtrl->Repaint();