Difference between revisions of "IOSTutorial3"

From Steema Software Reference Wiki
Jump to: navigation, search
(Paging by code)
(Paging by code)
 
(7 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
|- valign="TOP"
 
|- valign="TOP"
 
|
 
|
[[Image:IOSHeaderLogo.gif]]
+
[[Image:net_iphone.png|200px]]
 
| align="RIGHT" | <font size="2">  [[IOSTutorials|Contents page]]<br />[[IOSTutorial2|Previous]] | [[IOSTutorial4|Next]]
 
| align="RIGHT" | <font size="2">  [[IOSTutorials|Contents page]]<br />[[IOSTutorial2|Previous]] | [[IOSTutorial4|Next]]
  
Line 9: Line 9:
 
| width="20" |
 
| width="20" |
 
|}
 
|}
 
+
{{DISPLAYTITLE:<span style="position: absolute; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);">{{FULLPAGENAME}}</span>}}
 +
= Tutorial 3 - Chart Paging =
 
__TOC__
 
__TOC__
 
<br>
 
<br>
 
== Tutorial 3 - Chart Paging <br /> ==
 
 
 
If the data source for your Chart contains more data than can legibly be displayed on one Chart screen you may wish to divide the Chart into pages that can be leafed through. This can be achieved programmatically. <br />
 
If the data source for your Chart contains more data than can legibly be displayed on one Chart screen you may wish to divide the Chart into pages that can be leafed through. This can be achieved programmatically. <br />
  
=== Paging by code<br /> ===
+
== Paging by code<br /> ==
  
 
Paging properties and methods are available via the Page class. <br />Steps required to add paging to your Chart: <br /><br />
 
Paging properties and methods are available via the Page class. <br />Steps required to add paging to your Chart: <br /><br />
Line 42: Line 40:
 
* Show the user a page number
 
* Show the user a page number
 
The PageNumber Chart Tool may be used to achieve this end:  
 
The PageNumber Chart Tool may be used to achieve this end:  
[C#.Net] <br />private void Initialize() <br />{ <br />     Bar bar1 = new Bar(); <br />     PageNumber pageNumber1 = new PageNumber(); <br />     tChart1.Series.Add(bar1); <br />     tChart1.Tools.Add(pageNumber1); <br />     bar1.FillSampleValues(100); <br />     tChart1.Page.MaxPointsPerPage = 10; <br />} <br /> <br />        button1.Click  = delegate <br />        { <br />          tChart1.Page.Previous(); <br />        };  <br /> <br />        button2.Click  = delegate <br />        { <br />          tChart1.Page.Next(); <br />        };
 
 
  [C#.Net] <br />private void Initialize() <br />{<br />      Bar bar1 = new Bar(); <br />    PageNumber pageNumber1 = new PageNumber(); <br />    tChart1.Series.Add(bar1); <br />    tChart1.Tools.Add(pageNumber1);  
 
  [C#.Net] <br />private void Initialize() <br />{<br />      Bar bar1 = new Bar(); <br />    PageNumber pageNumber1 = new PageNumber(); <br />    tChart1.Series.Add(bar1); <br />    tChart1.Tools.Add(pageNumber1);  
<br />    bar1.FillSampleValues(100); <br />    tChart1.Page.MaxPointsPerPage = 10; <br />} <br /><br />
+
<br />    bar1.FillSampleValues(100); <br />    tChart1.Page.MaxPointsPerPage = 10; <br />} <br />
         {<br /><br />      this.button1.TouchUpInside += (sender, e) => <br />     { <br />   tChart1.Page.Previous(); <br />     }; <br />      this.button2.TouchUpInside += (sender, e) => <br />      { <br />       tChart1.Page.Next(); <br />};  
+
         {<br />       this.button1.TouchUpInside += (sender, e) => <br />       { <br />       tChart1.Page.Previous(); <br />       }; <br />      this.button2.TouchUpInside += (sender, e) => <br />      { <br />       tChart1.Page.Next(); <br />};  
 
That's all for this tutorial ! The next tutorial deals with advanced Axis manipulation.  
 
That's all for this tutorial ! The next tutorial deals with advanced Axis manipulation.  
  
Line 66: Line 63:
 
</center>
 
</center>
 
----
 
----
© 1998-2014 Steema Software SL. All rights reserved.
+
© 1998-{{CURRENTYEAR}} Steema Software SL. All rights reserved.

Latest revision as of 14:16, 29 April 2016

Net iphone.png

Contents page
Previous | Next

Tutorial 3 - Chart Paging


If the data source for your Chart contains more data than can legibly be displayed on one Chart screen you may wish to divide the Chart into pages that can be leafed through. This can be achieved programmatically.

Paging by code

Paging properties and methods are available via the Page class.
Steps required to add paging to your Chart:

  • Define Points per page

Use MaxPointsPerPage to define the number of points to display on each page:

[C#.Net] 
tChart1.Page.MaxPointsPerPage = 10;


  • Add Navigation buttons to the Chart's Form.

Example: First Page

[C#.Net] 
tChart1.Page.Current = 0;

Advance a page

[C#.Net] 
tChart1.Page.Next();

Goto previous page

[C#.Net] 
tChart1.Page.Previous();

Last Page

[C#.Net] 
tChart1.Page.Current = tChart1.Page.Count;
  • Decide what to do with the last page.

The last page is unlikely to have exactly the correct number of points to match the point quantity in the other Chart pages. You may choose to Scale the Last page which will 'best fit' the remaining points to the page, adjusting the axis scale accordingly, or you may treat the page as previous pages with the same number of points which may leave the last page rather empty if there are not many points for the page.

[C#.Net] 
tChart1.Page.ScaleLastPage = false;   (default = true)
  • Show the user a page number

The PageNumber Chart Tool may be used to achieve this end:

[C#.Net] 
private void Initialize()
{
Bar bar1 = new Bar();
PageNumber pageNumber1 = new PageNumber();
tChart1.Series.Add(bar1);
tChart1.Tools.Add(pageNumber1);
bar1.FillSampleValues(100);
tChart1.Page.MaxPointsPerPage = 10;
}
{
this.button1.TouchUpInside += (sender, e) =>
{
tChart1.Page.Previous();
};
this.button2.TouchUpInside += (sender, e) =>
{
tChart1.Page.Next();
};

That's all for this tutorial ! The next tutorial deals with advanced Axis manipulation.



PREVIOUS

NEXT


© 1998-2019 Steema Software SL. All rights reserved.