Questions on paging

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Philipp P.
Newbie
Newbie
Posts: 3
Joined: Thu Dec 16, 2010 12:00 am

Questions on paging

Post by Philipp P. » Mon Jan 10, 2011 11:21 am

Hi,
I have some questions on paging.

1) Is it possible to somehow tell TeeChart to automatically show the current graph page when paging is used? Right now I can see the first page, but when the next page is created the view is still only showing the first page. For my application I want to implement two modes of paging:
First, the user should be able to navigate between multiple pages manually. Each page holds the data of several hours (<= 24). I use a numerical up-down button that the user can use to switch between pages. There is also an automatic mode (activated by a checkbox) which completely deactivates the manual navigation and makes sure that the current page is always the most current one.
Right now I implemented the automatic mode by explicitly setting the page index to the maximum number of pages in the TeeChart.BeforeDraw event (see code below). Is this the proper way to do this?

Code: Select all

...
// calculate and set paging parameters
int maxPointsPerPage = 
  60 * this.configData.ChartParameters.MinutesRecordedPerChartPage / this.configData.PublishResultsInterval;

// enable paging
this.tcChart.Page.MaxPointsPerPage = maxPointsPerPage ;
this.tcChart.Page.AutoScale = false;
this.tcChart.BeforeDraw +=
  (s, a) =>
  {
    // if, show latest page checkbox is enabled automatically always keep the last
    // page the current one...
    if (this.cbShowLatestPage.Checked && this.tcChart.Page.Current != this.tcChart.Page.Count)
    {
      this.tcChart.Page.Current = this.tcChart.Page.Count;
      this.numCurrentPage.Value = this.tcChart.Page.Count;
     }
   };
2) How can I get the minimum and maximum index of the series data entries on a specific page. I want to calculate the timespan of the data covered on each page and for this I need the timestamp of the first and last data entry.

Thanks in advance
Philipp P.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Questions on paging

Post by Narcís » Tue Jan 11, 2011 9:22 am

Hi Philipp,
Philipp P. wrote:Right now I implemented the automatic mode by explicitly setting the page index to the maximum number of pages in the TeeChart.BeforeDraw event (see code below). Is this the proper way to do this?
I don't see any inconvenient in doing so if it works fine for you.
Philipp P. wrote:2) How can I get the minimum and maximum index of the series data entries on a specific page. I want to calculate the timespan of the data covered on each page and for this I need the timestamp of the first and last data entry.
You can use FirstVisibleIndex and LastVisibleIndex properties for that, for example:

Code: Select all

      public Form1()
      {
        InitializeComponent();
        InitializeChart();
      }

      private void InitializeChart()
      {
        tChart1.Dock = DockStyle.Fill;

        tChart1.Series.Add(new Steema.TeeChart.Styles.Line()).FillSampleValues();
        tChart1.Page.MaxPointsPerPage = 10;
        tChart1.Page.Current = tChart1.Page.Count;

        tChart1.Draw();
        tChart1.Header.Text = tChart1[0].FirstVisibleIndex.ToString() + " - " + tChart1[0].LastVisibleIndex.ToString();
      }
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply