Skip to content

Commit

Permalink
ENH: Add Parallel Coordinates support to ctkVTKChartView
Browse files Browse the repository at this point in the history
  • Loading branch information
spyridon97 authored and jcfr committed Oct 27, 2023
1 parent f2ae4b7 commit 365718b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Libs/Visualization/VTK/Widgets/ctkVTKChartView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
// VTK includes
#include <vtkAxis.h>
#include <vtkChart.h>
#include <vtkChartParallelCoordinates.h>
#include <vtkChartXY.h>
#include <vtkContext2D.h>
#include <vtkContextMouseEvent.h>
Expand Down Expand Up @@ -91,6 +92,9 @@ void ctkVTKChartViewPrivate::setChartType(int chartType)
case ctkVTKChartView::ChartType::XYChart:
this->Chart = vtkSmartPointer<vtkChartXY>::New();
break;
case ctkVTKChartView::ChartType::ParallelCoordinatesChart:
this->Chart = vtkSmartPointer<vtkChartParallelCoordinates>::New();
break;
case ctkVTKChartView::ChartType::UnknownChart:
#if (QT_VERSION >= QT_VERSION_CHECK(5,8,0))
Q_FALLTHROUGH();
Expand Down Expand Up @@ -120,6 +124,10 @@ int ctkVTKChartView::chartType()const
{
return ctkVTKChartView::ChartType::XYChart;
}
else if (d->Chart->IsA("vtkChartParallelCoordinates"))
{
return ctkVTKChartView::ChartType::ParallelCoordinatesChart;
}
else
{
return ctkVTKChartView::ChartType::UnknownChart;
Expand Down Expand Up @@ -307,6 +315,13 @@ vtkChart* ctkVTKChartView::abstractChart()const
return d->Chart;
}

// ----------------------------------------------------------------------------
vtkChartParallelCoordinates* ctkVTKChartView::parallelCoordinatesChart()const
{
Q_D(const ctkVTKChartView);
return vtkChartParallelCoordinates::SafeDownCast(d->Chart);
}

// ----------------------------------------------------------------------------
vtkChartXY* ctkVTKChartView::chartXY()const
{
Expand Down
3 changes: 3 additions & 0 deletions Libs/Visualization/VTK/Widgets/ctkVTKChartView.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ctkVTKChartViewPrivate;

// VTK includes
class vtkChart;
class vtkChartParallelCoordinates;
class vtkChartXY;
class vtkContextScene;
class vtkPlot;
Expand Down Expand Up @@ -60,6 +61,7 @@ class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKChartView : public ctkVTKOpenGL
/// Utility function that returns the view chart. It can be used for customizing
/// the chart display options (axes, legend...)
Q_INVOKABLE vtkChart* abstractChart()const;
Q_INVOKABLE vtkChartParallelCoordinates* parallelCoordinatesChart()const;
Q_INVOKABLE vtkChartXY* chartXY()const;
/// \deprecated Use chartXY() instead
Q_INVOKABLE vtkChartXY* chart()const;
Expand All @@ -70,6 +72,7 @@ class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKChartView : public ctkVTKOpenGL
{
UnknownChart,
XYChart,
ParallelCoordinatesChart,
};
Q_ENUM(ChartType)

Expand Down

0 comments on commit 365718b

Please sign in to comment.