[vtkusers] vtkXYPlotActor fit viewport?

Elvis Stansvik elvis.stansvik at orexplore.com
Fri Aug 12 03:20:57 EDT 2016


2016-08-12 9:01 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:

> I have a little debug widget in which I show a vtkXYPlotActor like this:
>
>     auto imageAccumulate = vtkSmartPointer<vtkImageAccumulate>::New();
>     imageAccumulate->SetComponentSpacing(0.01, 0, 0);
>     imageAccumulate->SetComponentExtent(0, 499, 0, 0, 0, 0);
>     imageAccumulate->SetInputData(imageData);
>     imageAccumulate->Update();
>
>     auto plot = vtkSmartPointer<vtkXYPlotActor>::New();
>     plot->ExchangeAxesOff();
>     plot->SetXTitle("");
>     plot->SetYTitle("");
>     plot->SetLabelFormat("%g");
>     plot->SetXValuesToValue();
>     plot->AddDataSetInputConnection(imageAccumulate->GetOutputPort());
>
>     renderer()->AddActor(plot);
>     auto camera = renderer()->GetActiveCamera();
>     camera->Zoom(3);
>
> The camera->Zoom(3) seems to have no effect (see attached screenshot). My
> goal is actually to set a zoom level such that the vtkXYPlotActor is as
> large as it can be without going outside the viewport.
>
> How can this be done?
>

Nevermind, I figured out that I can do

    plot->GetPositionCoordinate()->SetValue(0, 0);
    plot->GetPosition2Coordinate()->SetValue(1, 1);

Elvis


> Thanks,
> Elvis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160812/6e1f3d83/attachment.html>


More information about the vtkusers mailing list