Hi Eric,<br><br>I've set both X and Y axis to '0':<br><br>...<br>line->SetUseIndexForXSeries(true);<br>line->SetInput(mPath->toTable->GetOutput(), 0, 0);<br>...<br><br>But now it just crashes... <br>
<br>Here's the relevant part of the stack:<br><br>#6 0x00007ffff24c70ce in std::__throw_logic_error(char const*) () from /usr/lib/libstdc++.so.6<br>#7 0x00007ffff2eeedab in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_construct<char const*> (__beg=0x0, <br>
__end=0xffffffffffffffff <Address 0xffffffffffffffff out of bounds>, __a=...) at /usr/include/c++/4.4/bits/basic_string.tcc:134<br>#8 0x00007ffff2501e32 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) () from /usr/lib/libstdc++.so.6<br>
#9 0x00007ffff6ce24d2 in vtkStdString::vtkStdString (this=0x7fffffffdd00, s=0x0) at /home/marc/tmp/vtk/VTK/Common/vtkStdString.h:54<br>#10 0x00007ffff6d17488 in vtkPlot::SetInput (this=0xd07b00, table=0xcf7370, xColumn=0, yColumn=0)<br>
at /home/marc/tmp/vtk/VTK/Charts/vtkPlot.cxx:372<br>#11 0x0000000000411883 in AmplitudeView::buildRenderingPath (this=0x7fffffffdf00)<br> at /home/marc/g3/vtk/ut/dojo/vtk/demoview/amplitudeview.cpp:89<br>#12 0x000000000041266f in main (argc=3, argv=0x7fffffffe0f8) at /home/marc/g3/vtk/ut/dojo/vtk/demoview/demo.cpp:74<br>
<br>The string allocator throws a logic error...?!<br><br>What I'm trying to achieve is something similar to this test: <a href="http://vtk.org/gitweb?p=VTK.git;a=blob;f=Widgets/Testing/Cxx/TestSplineWidget.cxx">http://vtk.org/gitweb?p=VTK.git;a=blob;f=Widgets/Testing/Cxx/TestSplineWidget.cxx</a><br>
<br>but by using the chart API which seems to be the new "preferred" way of plotting data.<br><br>Regards,<br><br>Marc<br><br><br><div class="gmail_quote">On Mon, Jun 20, 2011 at 2:36 PM, Eric E. Monson <span dir="ltr"><<a href="mailto:emonson@cs.duke.edu">emonson@cs.duke.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hey Marc,<br>
<br>
I think you need to set the indices of the X and Y columns in your plot's SetInput() call: e.g. line->SetInput(mPath->toTable->GetOutput(), 0, 1);<br>
<br>
It does look like vtkPlot has a plain SetInput(table) method which gets inherited by vtkPlotPoints and Line, but I get the same errors as you do when I try to set the input to the plot as just a table without specifying the indices.<br>
<br>
If you're using the index as X, then it just won't use the column you pass in as X (you can just give it the Y column index twice, if you want).<br>
<br>
Hope this helps,<br>
-Eric<br>
<br>
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·<br>
Eric E Monson<br>
Duke Visualization Technology Group<br>
<div><div></div><div class="h5"><br>
<br>
On Jun 20, 2011, at 11:09 AM, Marc Ferland wrote:<br>
<br>
> Hi,<br>
><br>
> I'm currently trying to plot the output of a vtkProbeFilter with the new chart API using a vtkDataObjectToTable filter and I'm having difficulties getting a vtkTable that will be accepted by the plotter. I get errors like:<br>
><br>
> ERROR: In /home/marc/tmp/vtk/VTK/Filtering/vtkAlgorithm.cxx, line 460<br>
> vtkContextMapper2D (0xd0d630): Attempt to get an input array for an index that has not been specified<br>
><br>
> ERROR: In /home/marc/tmp/vtk/VTK/Charts/vtkPlotPoints.cxx, line 600<br>
> vtkPlotLine (0xcf9ca0): No Y column is set (index 1).<br>
><br>
> ERROR: In /home/marc/tmp/vtk/VTK/Filtering/vtkAlgorithm.cxx, line 460<br>
> vtkContextMapper2D (0xd0d630): Attempt to get an input array for an index that has not been specified<br>
> ....<br>
><br>
> The code looks like this:<br>
> // Convert the polydata to a vtkTable using points data<br>
> mPath->toTable = vtkDataObjectToTable::New();<br>
> mPath->toTable->SetInputConnection(mProbeFilter->GetOutputPort());<br>
> mPath->toTable->SetFieldType(vtkDataObjectToTable::POINT_DATA);<br>
> mPath->toTable->Update();<br>
><br>
> // Test<br>
> vtkTable *table = mPath->toTable->GetOutput();<br>
> qDebug() << table->GetNumberOfColumns(); // returns 2<br>
> qDebug() << table->GetNumberOfRows(); // returns 6<br>
> qDebug() << table->GetValue(0, 0).GetTypeAsString(); // returns: "short"<br>
> qDebug() << table->GetValue(0, 1).GetTypeAsString(); // returns: "char" <-- weird?!<br>
><br>
> mPath->view = vtkContextView::New();<br>
> mPath->view->GetRenderer()->SetBackground(0.5, 0.5, 0.5);<br>
><br>
> mPath->chartxy = vtkChartXY::New();<br>
> mPath->view->GetScene()->AddItem(mPath->chartxy);<br>
> vtkPlot* line = mPath->chartxy->AddPlot(vtkChart::LINE);<br>
> line->SetUseIndexForXSeries(true);<br>
> line->SetInput(mPath->toTable->GetOutput());<br>
> line->SetColor(0.0, 255, 0.0, 255);<br>
> line->SetWidth(1.0);<br>
><br>
> FYI: The old XYPlot actor was working correctly with the same probe filter input.<br>
><br>
> So my question is: What am I doing wrong here? Also, is there an example somewhere showing how to correctly use a vtkProbeFilter and the new charting API?<br>
><br>
> Regards,<br>
><br>
> Marc<br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
</blockquote></div><br>