[vtkusers] Problem with vtkChartXY::SetTitle and vtkAxis::SetTitle
Andrew Wiles
awiles at ndigital.com
Mon Oct 24 14:57:51 EDT 2011
Hello,
I have been using the vtkChartXY in previous release versions for a while now without any problems. However, I recently upgraded to VTK 5.8 and I having some difficulties. I am wondering if it has anything to do with the vtkChartXY::SetTitle being changed from a "const char* title" to a "const vtkStdString &title" -- but I am just guessing.
At any rate, I create the vtkChartXY using a vtkSmartPointer and the axis get their titles initialized to "X Axis" and "Y Axis" without any difficulties. However, when I go to change the Axis titles or the chart title to something useful, I get an unhandled exception: access violation. I tried to change the input from a quoted string to an actual vtkStdString but it crashes as well. I saw a post online (http://vtk.org/pipermail/vtkusers/2011-May/116473.html) that this is due to mismatched build types, but I build VTK with RelWithDebInfo and my project is build with RelWithDebInfo.
I am working with VTK 5.8 Release Tag, on Windows XP 32Bit and using MSVC2010 and Qt 4.7.2.
Here is my code:
In Header:
vtkSmartPointer<vtkChartXY> m_Chart;
In Source:
m_Chart = vtkSmartPointer<vtkChartXY>::New();
m_Chart->SetShowLegend(true);
//const vtkStdString xAxisLabel = "Index";
//m_Chart->GetAxis(vtkAxis::BOTTOM)->SetTitle(xAxisLabel);
m_Chart->GetAxis(vtkAxis::BOTTOM)->SetTitle("Index");
//const vtkStdString yAxisLabel = "Position (mm)";
//m_Chart->GetAxis(vtkAxis::LEFT)->SetTitle(yAxisLabel);
m_Chart->GetAxis(vtkAxis::LEFT)->SetTitle("Position (mm)");
if( this->getName().isEmpty() ) // Note: getName() returns a QString
{
const vtkStdString title = "Position Data";
m_Chart->SetTitle(title);
}
else
{
const vtkStdString title = "Position Data - " + this->getName().toStdString();
m_Chart->SetTitle(title);
}
Any help is appreciated!
Thanks.
Andrew
---------------------------------------------------------------
1981-2011: Celebrating 30 Years of Innovation
Follow us on Twitter: @NDIMedResearch
Andrew D. Wiles, PhD, PEng
Research Scientist, Medical Division
NDI
103 Randall Drive
Waterloo, ON, Canada, N2V 1C5
Telephone: +1 (519) 884-5142 ext. 314
Toll Free: +1 (877) 634-6340
Global: ++ (800) 634-634-00
Facsimile: +1 (519) 884-5184
Website: www.ndigital.com
--------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111024/78ee7ef1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/bmp
Size: 36150 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111024/78ee7ef1/attachment.bin>
More information about the vtkusers
mailing list