[vtk-developers] vtkChartXY lines not visible when using logarithmic x axis

Andrew Maclean andrew.amaclean at gmail.com
Mon Jul 25 19:52:41 EDT 2016


Hi Hagen,
  I just tested your example and I get similar behaviou using an NVIDIA
Video card, OpenGL2,  VS2015 and the VTK Master.

I can zoom in and, at some point the line disappears, but zooming out
immediately restores the line.

It seeme to me that once a certain zoom level is reached the line is not
drawn, however zooming out restores it.

Attached are two pngs showing the effect.When the line disappears it should
still be visible as the scales on the axes have only changed slightly.

Andrew

---------- Forwarded message ----------
> From: "Hagen Mölle" <h.moelle at googlemail.com>
> To: vtk-developers at vtk.org
> Cc:
> Date: Mon, 25 Jul 2016 10:14:21 +0200
> Subject: [vtk-developers] vtkChartXY lines not visible when using
> logarithmic x axis
> Hi,
>
> Due to spam reasons the bug tracker's user login is disabled right now.
> One should send bug reports to the vtk's user mailing list, which I did
> twice. My bug report was totally ignored. That's why I send it here again.
> Hopefully someone can finally create a ticket in the bug tracker. Thanks.
>
> I want to report a bug for vtkChartXY. So I already send this Email two
> days ago to the vtkUsers mailing list without receiving any answer. The bug
> is not visible in the vtk bug tracker too. Thus I send the Email again.
>
> Bug environment:
> a) I am using VTK 6.2. I checked my test code on machines running Windows
> 7 (Visual Studio 2012/2015) and Ubuntu 15.10/Ubuntu 16.04 (gcc). On all
> these systems the bug is visible.
> b) I can also reproduce the bug in VTK 7.0 (here I used an Ubuntu 16.04
> machine and compiled VTK 7.0 using OpenGL2 interface).
>
> Bug description:
>
> I am using vtkChartXY to display one line. I also enabled logarithmic x
> axis (chartXY->GetAxis(vtkAxis::BOTTOM)->SetLogScale(true);). Nothing more
> special. In the compiled application I start zooming into the chart using
> the mouse wheel, making sure I always have a line displayed in the view. At
> some zoom level this line just disappears. At the zoom level the line
> disappears I did the following:
>
> 1. Zooming more into the chart the line will not appear again.
> 2. Zooming out twice (with mouse wheel) the line will reappear.
>
> How to reproduce the bug:
>
> I basically used the LinePlot example for vtkChartXY (see
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Plotting/LinePlot).
>
> I added one line to the example code marked with *** (line was added after
> line 54 in example code).
> I added the full code to the end of the Email.
> ---------------
>
> // Add multiple line plots, setting the colors etc
>     vtkSmartPointer<vtkChartXY >  chart= vtkSmartPointer<vtkChartXY
> >::New(); *** chart.Get()->GetAxis(vtkAxis::BOTTOM)->SetLogScale(true);
> view->GetScene()->AddItem(chart);
>
> ---------------
>
> Compile and execute the program. See my bug description above to visualize
> the bug.
>
>
> Please contact me if you need more information. I can also provide images
> of the bug if needed.
> I hope the bug can be fixed.
>
> Hagen.
>
>
>
>
> #include <vtkVersion.h>
> #include <vtkRenderer.h>
> #include <vtkRenderWindowInteractor.h>
> #include <vtkRenderWindow.h>
> #include <vtkSmartPointer.h>
> #include <vtkChartXY.h>
> #include <vtkAxis.h>
> #include <vtkTable.h>
> #include <vtkPlot.h>
> #include <vtkFloatArray.h>
> #include <vtkContextView.h>
> #include <vtkContextScene.h>
> #include <vtkPen.h>
>
> int main(int, char *[])
> {
>     // Create a table with some points in it
>     vtkSmartPointer<vtkTable> table =
>       vtkSmartPointer<vtkTable>::New();
>
>     vtkSmartPointer<vtkFloatArray> arrX =
>       vtkSmartPointer<vtkFloatArray>::New();
>     arrX->SetName("X Axis");
>     table->AddColumn(arrX);
>
>     vtkSmartPointer<vtkFloatArray> arrC =
>       vtkSmartPointer<vtkFloatArray>::New();
>     arrC->SetName("Cosine");
>     table->AddColumn(arrC);
>
>     vtkSmartPointer<vtkFloatArray> arrS =
>       vtkSmartPointer<vtkFloatArray>::New();
>     arrS->SetName("Sine");
>     table->AddColumn(arrS);
>
>     // Fill in the table with some example values
>     int numPoints = 69;
>     float inc = 7.5 / (numPoints-1);
>     table->SetNumberOfRows(numPoints);
>     for (int i = 0; i < numPoints; ++i)
>     {
>       table->SetValue(i, 0, i * inc);
>       table->SetValue(i, 1, cos(i * inc));
>       table->SetValue(i, 2, sin(i * inc));
>     }
>
>     // Set up the view
>     vtkSmartPointer<vtkContextView> view =
>       vtkSmartPointer<vtkContextView>::New();
>     view->GetRenderer()->SetBackground(1.0, 1.0, 1.0);
>
>     // Add multiple line plots, setting the colors etc
>     vtkSmartPointer<vtkChartXY> chart =
>       vtkSmartPointer<vtkChartXY>::New();
>     chart.Get()->GetAxis(vtkAxis::BOTTOM)->SetLogScale(true);
>     view->GetScene()->AddItem(chart);
>     vtkPlot *line = chart->AddPlot(vtkChart::LINE);
> #if VTK_MAJOR_VERSION <= 5
>     line->SetInput(table, 0, 1);
> #else
>     line->SetInputData(table, 0, 1);
> #endif
>     line->SetColor(0, 255, 0, 255);
>     line->SetWidth(1.0);
>     line = chart->AddPlot(vtkChart::LINE);
> #if VTK_MAJOR_VERSION <= 5
>     line->SetInput(table, 0, 2);
> #else
>     line->SetInputData(table, 0, 2);
> #endif
>     line->SetColor(255, 0, 0, 255);
>     line->SetWidth(5.0);
>
>     // For dotted line, the line type can be from 2 to 5 for different
> dash/dot
>     // patterns (see enum in vtkPen containing DASH_LINE, value 2):
> #ifndef WIN32
>     line->GetPen()->SetLineType(vtkPen::DASH_LINE);
> #endif
>     // (ifdef-ed out on Windows because DASH_LINE does not work on Windows
>     //  machines with built-in Intel HD graphics card...)
>
>     //view->GetRenderWindow()->SetMultiSamples(0);
>
>     // Start interactor
>     view->GetInteractor()->Initialize();
>     view->GetInteractor()->Start();
>
>     return EXIT_SUCCESS;
> }
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>



-- 
___________________________________________
Andrew J. P. Maclean

___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160726/9e94896f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: JustAfterLineDisappearance.PNG
Type: image/png
Size: 27648 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160726/9e94896f/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: JustBeforeLineDisappearance.PNG
Type: image/png
Size: 35481 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160726/9e94896f/attachment-0003.png>


More information about the vtk-developers mailing list