Salome HOME
Merge Python 3 porting.
[modules/paravis.git] / test / VisuPrs / SWIG_scripts / B7.py
1 # Copyright (C) 2010-2016  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # This case corresponds to: /visu/SWIG_scripts/B7 case
21 # Import a table from file and show it in 2D viewer
22
23 from paravistest import tablesdir
24 from presentations import *
25 import pvsimple
26
27 # Import table from CSV file
28 file_path = tablesdir + "table_test.csv"
29 table_csv = pvsimple.CSVReader(FileName=file_path)
30
31 # Set space as separator
32 table_csv.FieldDelimiterCharacters = ';'
33
34 # Display curve
35 cur_view = pvsimple.GetRenderView()
36 if cur_view:
37     delete_pv_object(cur_view)
38 xy_view = pvsimple.CreateXYPlotView()
39
40 xy_rep = pvsimple.Show(table_csv)
41 xy_rep.AttributeType = 'Row Data'
42 xy_rep.UseIndexForXAxis = 0
43 xy_rep.XArrayName = 'X'
44 xy_rep.SeriesVisibility = ['X', '0']
45
46 # Set view properties
47 title = xy_view.ChartTitle
48 xy_view.ChartTitle = "Change the title from python"
49 pvsimple.Render(xy_view)
50
51 xy_view.LeftAxisTitle = "Y axis"
52 xy_view.BottomAxisTitle = "X axis"
53 pvsimple.Render(xy_view)
54
55 xy_view.ShowLegend = 0
56 pvsimple.Render(xy_view)
57
58 xy_view.ShowLeftAxisGrid = 0
59 xy_view.ShowLeftAxisLabels = 0
60 xy_view.ShowBottomAxisGrid = 0
61 xy_view.ShowBottomAxisLabels = 0
62 xy_view.ShowRightAxisGrid = 0
63 xy_view.ShowRightAxisLabels = 0
64 xy_view.ShowTopAxisGrid = 0
65 xy_view.ShowTopAxisLabels = 0
66 pvsimple.Render(xy_view)
67 xy_view.ShowLeftAxisGrid = 1
68 xy_view.ShowLeftAxisLabels = 1
69 pvsimple.Render(xy_view)
70 xy_view.ShowBottomAxisGrid = 1
71 xy_view.ShowBottomAxisLabels = 1
72 pvsimple.Render(xy_view)
73
74 # Set logarithmic scaling
75 xy_view.LeftAxisLogScale = 1
76 pvsimple.Render(xy_view)
77 xy_view.BottomAxisLogScale = 1
78 pvsimple.Render(xy_view)
79
80 # Set representation properties
81
82 # Show/hide curves
83 xy_rep.SeriesVisibility = ['Y0', '0', 'Y1', '0',
84                            'Y2', '0', 'Y3', '0']
85 pvsimple.Render(xy_view)
86 xy_rep.SeriesVisibility = ['Y0', '1']
87 pvsimple.Render(xy_view)
88 xy_rep.SeriesVisibility = ['Y1', '1']
89 pvsimple.Render(xy_view)
90 xy_rep.SeriesVisibility = ['Y2', '1']
91 pvsimple.Render(xy_view)
92
93 xy_rep.SeriesVisibility = ['Y3', '1']
94 xy_rep.SeriesVisibility = ['Y3', '0']
95 xy_rep.SeriesVisibility = ['Y3', '1']
96 pvsimple.Render(xy_view)
97
98 # Line style
99 xy_rep.SeriesLineStyle = ['Y0', '5']
100 pvsimple.Render(xy_view)
101 xy_rep.SeriesLineStyle = ['Y1', '4']
102 pvsimple.Render(xy_view)
103 xy_rep.SeriesLineStyle = ['Y2', '3']
104 pvsimple.Render(xy_view)
105 xy_rep.SeriesLineStyle = ['Y3', '2']
106 pvsimple.Render(xy_view)
107
108 # Line thickness
109 values = (2, 4, 6, 8, 10, 1)
110 for val in values:
111     xy_rep.SeriesLineThickness = ['Y3', str(val)]
112     pvsimple.Render(xy_view)
113
114 xy_rep.SeriesLineStyle = ['Y3', '0']
115 pvsimple.Render(xy_view)
116
117 # Marker type
118 xy_rep.SeriesMarkerStyle = ['Y3', '5']
119 pvsimple.Render(xy_view)
120 xy_rep.SeriesMarkerStyle = ['Y2', '4']
121 pvsimple.Render(xy_view)
122 xy_rep.SeriesMarkerStyle = ['Y1', '3']
123 pvsimple.Render(xy_view)
124 xy_rep.SeriesMarkerStyle = ['Y0', '8']
125 pvsimple.Render(xy_view)
126
127 # Marker size
128 for val in values:
129     xy_rep.SeriesLineThickness = ['Y3', str(val)]
130     pvsimple.Render(xy_view)