ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  How to expand the realtimezoomscroll sample to multiple charts?
Posted by Mike Dd on Apr-19-2016 22:49
Hi all,

I am experimenting with the realtimezoomscroll example and it is really nice.

I am wondering if there is a way to expand this example into one that can have multiple chart windows, i.e. on each of the window/chart, there is a realtimezoomscroll live streaming data that's plotting in realtime.

Is there a simple way of doing that?

Thanks a lot!

  Re: How to expand the realtimezoomscroll sample to multiple charts?
Posted by Peter Kwan on Apr-20-2016 05:13
Hi Mike,

Yes, you just need to add multiple charts into your user interface. The exact details depend on your programming language, application type and development framework. For example, the code for C++ on Windows using Qt is different from the code for PHP for a web application. If you need further details, would you mind to clarify your programming language, application type (web or desktop) and development framework?

Regards
Peter Kwan

  Re: How to expand the realtimezoomscroll sample to multiple charts?
Posted by Mike Dd on Apr-20-2016 13:53
Thanks a lot for your help!

I am targeting at MFC/VC++. And this is on Win7 x64. And I am using VS 2013 and/or VS2015.

My goal is to find the simplest way so that I can show quite a number of real-time updating ticking windows simultaneously.

For example, if I can have a main GUI setting a few plot parameters and then dynamically load one window at a time, that would be great. That's to say, On the main GUI, I set the data source to be 1, and then press "Display" button, it fires off one chart window.

And then I move to another set of parameters, and set data sources to be 2 and 3, and then press "Display" button, it fires off another chart window, showing two ticking lines.

And then I move to another set of parameters, and set data sources to be 4, 5 and 6, and then press "Display" button, it fires off another chart window, showing three ticking lines(much like the current example, alpha, beta, gamma).

It seems that what I need is a way to dynamically configure and generate multiple ticking plots.

What is the simplest way to do that?

Thanks again for your help!

  Re: How to expand the realtimezoomscroll sample to multiple charts?
Posted by Peter Kwan on Apr-21-2016 04:20
Hi Mike,

Yes, you can always create a Window to allow the user to enter parameters. When the user press the display button, you can create the realtimezoomscroll dialog dynamically, set the parameters based on the user input, and then display the dialog. These can be achieve with normal MFC code and are not related to ChartDirector.

// Create the dialog and set the parameters
MyDialog *d = new MyDialog();
d->setParameters(..... set any parameters you like .....);

// Display the dialog
if (d->Create((UINT)IDD_REALTIMEZOOMSCROLL_DIALOG, myMainWindow))
   d->ShowWindow(SW_SHOW);

For the realtime chart with zooming and scrolling, you can use CRealtimezoomscrollDlg  as the MyDialog above. You can add a "setParameters" function in CRealtimezoomscrollDlg to allow you to set the parameters, and in your actual charting code, instead of using random numbers, you can obtain the data based on the parameters.

Note that the above is just a simple example. In your real code, you would need to eventually "delete" the dialog to avoid memory leak, and to guard against various user errors (such as the user press the same button more than once when the dialog has already been created, etc).

Regards
Peter Kwan

  Re: How to expand the realtimezoomscroll sample to multiple charts?
Posted by Mike Dd on Apr-21-2016 11:56
Thanks a lot for your reply.

When the plots are generated dynamically, do I reuse the following ID, or I have to dynamically generate different IDs?

IDD_REALTIMEZOOMSCROLL_DIALOG

Thanks again!

  Re: How to expand the realtimezoomscroll sample to multiple charts?
Posted by Peter Kwan on Apr-21-2016 15:12
Hi Mike,

You can reuse the same ID. The ID is used to determine the template to create the dialog. See:

https://msdn.microsoft.com/en-us/library/yhth57kd.aspx

Hope this can help.

Regards
Peter Kwan