[vtkusers] Issue when setting number of ticks on a vtkAxis

joaoroberto88 joaorobertojr88 at gmail.com
Thu Dec 24 06:43:06 EST 2015


Hi VTK Users,

I'm having an issue when defining the number of ticks of vtkChartXY bottom
axis, even using SetNumberOfTicks method. The axis values are shown as time
stamp strings (by using SetCustomTickPositions). Since there are many
values, they appear overlapped (as shown in the attached image). I would
like to show only 2 ticks as implemented in the code bellow:

vtkSmartPointer<vtkDoubleArray> timeStamps =
vtkSmartPointer<vtkDoubleArray>::New();
vtkSmartPointer<vtkStringArray> timeStampStrings =
vtkSmartPointer<vtkStringArray>::New();
vtkSmartPointer<vtkDoubleArray> scalars =
vtkSmartPointer<vtkDoubleArray>::New();

vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();

// Populate the three arrays and set up vtkTable and vtkChartXY

vtkSmartPointer<vtkAxis> bottomAxis = chart->GetAxis(vtkAxis::BOTTOM);
bottomAxis->SetNumberOfTicks(2);
bottomAxis->SetCustomTickPositions(timeStamps, timeStampStrings);

<http://vtk.1045678.n5.nabble.com/file/n5735645/Screen_Shot_2015-12-24_at_08.png> 

Thanks for any help.

Joao.



--
View this message in context: http://vtk.1045678.n5.nabble.com/Issue-when-setting-number-of-ticks-on-a-vtkAxis-tp5735645.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list