-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOPY_CLASS_DataRange-Add.html
More file actions
55 lines (52 loc) · 4.63 KB
/
OPY_CLASS_DataRange-Add.html
File metadata and controls
55 lines (52 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<h1 class="firstHeading">8.1.6.1 DataRange::Add</h1><table class="noborder"><tr>
<td style="vertical-align:top" width="60"><img src="../images/OPY_CLASS_DataRange-Add/Tip_icon.png?v=21427" width="57" border="0" /></td><td><h3><a name="It_is_recommended_that_you_switch_to_the_originpro_package._PyOrigin_is_primarily_for_users_who_need_to_work_with_Origin_version_prior_to_2021."></a><span class="mw-headline"><span style="color: red">It is recommended that you switch to the <a href="../../Python/Python/RunPython_(Python).html" title="Python:RunPython (Python)">originpro</a> package. PyOrigin is primarily for users who need to work with Origin version prior to 2021.</span></span></h3>
</td></tr></table>
<p><br />
</p>
<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#Description"><span class="tocnumber">1</span> <span class="toctext">Description</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Syntax"><span class="tocnumber">2</span> <span class="toctext">Syntax</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#Parameters"><span class="tocnumber">3</span> <span class="toctext">Parameters</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#Return"><span class="tocnumber">4</span> <span class="toctext">Return</span></a></li>
<li class="toclevel-1 tocsection-5"><a href="#Examples"><span class="tocnumber">5</span> <span class="toctext">Examples</span></a></li>
</ul>
</div>
<h2><a name="Description"></a><span class="mw-headline">Description</span></h2>
<p>Add a new subrange to the DataRange.
</p>
<h2><a name="Syntax"></a><span class="mw-headline">Syntax</span></h2>
<pre class="python" style="font-family:monospace;">Add<span style="color: #000;">(</span>Type<span style="color: #000;">,</span> pPyWks<span style="color: #000;">,</span> R1<span style="color: #000;">,</span> C1<span style="color: #000;">,</span> R2<span style="color: #000;">,</span> C2<span style="color: #000;">)</span></pre>
<h2><a name="Parameters"></a><span class="mw-headline">Parameters</span></h2>
<dl><dt>Type</dt></dl>
<p>The name of the subrange like "X", "Y", "Z", or "ED" for Y error. "X" is a general usage, if no need to specify data is XY, XYZ etc.
</p>
<dl><dt>pPyWks</dt></dl>
<p>Worksheet or MatrixLayer in which range reside
</p>
<dl><dt>R1</dt></dl>
<p>Row range begin
</p>
<dl><dt>C1</dt></dl>
<p>Column range begin
</p>
<dl><dt>R2</dt></dl>
<p>Row range end, use -1 to indicate end of column
</p>
<dl><dt>C2</dt></dl>
<p>Column range end, if only one column then put in same value as nC1, if to end of worksheet use -1
</p>
<h2><a name="Return"></a><span class="mw-headline">Return</span></h2>
<p>Returns the number of subranges in the DataRange after execution.
</p>
<h2><a name="Examples"></a><span class="mw-headline">Examples</span></h2>
<p><b>EX1</b>
</p>
<pre class="python" style="font-family:monospace;"><span style="color: #d00; font-style: italic;"># Prepare book1 with data in Col(1) and Col(2)</span>
<span style="color: #ff7700;font-weight:bold;">import</span> PyOrigin
data<span style="color: #000;">=</span>PyOrigin.<span style="color: #000;">NewDataRange</span><span style="color: #000;">(</span><span style="color: #000;">)</span>
Sheet<span style="color: #000;">=</span>PyOrigin.<span style="color: #000;">WorksheetPages</span><span style="color: #000;">(</span><span style="color: #0a0;">'Book1'</span><span style="color: #000;">)</span>.<span style="color: #000;">Layers</span><span style="color: #000;">(</span><span style="color: #000;">0</span><span style="color: #000;">)</span>
<span style="color: #ff7700;font-weight:bold;">if</span> data.<span style="color: #000;">IsValid</span><span style="color: #000;">(</span><span style="color: #000;">)</span>:
data.<span style="color: #000;">Add</span><span style="color: #000;">(</span><span style="color: #0a0;">'X'</span><span style="color: #000;">,</span> Sheet<span style="color: #000;">,</span> <span style="color: #000;">0</span><span style="color: #000;">,</span> <span style="color: #000;">0</span><span style="color: #000;">,</span> -<span style="color: #000;">1</span><span style="color: #000;">,</span> -<span style="color: #000;">1</span><span style="color: #000;">)</span>
gp <span style="color: #000;">=</span> PyOrigin.<span style="color: #000;">FindGraphLayer</span><span style="color: #000;">(</span><span style="color: #0a0;">'Graph1'</span><span style="color: #000;">)</span>
gp.<span style="color: #000;">AddPlot</span><span style="color: #000;">(</span>data<span style="color: #000;">,</span> <span style="color: #000;">1</span><span style="color: #000;">)</span></pre>