[vtkusers] vtkXYPlotActor fit viewport?

Elvis Stansvik elvis.stansvik at orexplore.com
Fri Aug 12 03:01:34 EDT 2016


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?

Thanks,
Elvis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160812/0c5acdc2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xyplotactor.png
Type: image/png
Size: 13872 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160812/0c5acdc2/attachment-0001.png>


More information about the vtkusers mailing list