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

Message ListMessage List     Post MessagePost Message

  Can Chart Director be used to create vertically progressing chart?
Posted by Jack on Jun-12-2020 02:28
Attachments:
Hello,

I recently find Chat Director is very interesting and think of using it for my project.
The application is very similar to the "Real-Time Chart with scrollbar and zoom". However, there is a difference which I'm not sure if ChartDirector can handle. The chart I'm creating needs to progress vertically, namely x-axis will be vertical and y-axis will be horizontal.
In addition, multiple charts can be created dynamically, in each of the chart, multiple curves can be added or removed by the user with the scale of each being editable.

Please the the attached image as reference. Your help is appreciated in advance.

regards,

Jack
well logging chart.jpg

  Re: Can Chart Director be used to create vertically progressing chart?
Posted by Peter Kwan on Jun-12-2020 15:01
Hi Jack,

Yes, ChartDirector can do vertical charts. See:

https://www.advsofteng.com/doc/cdcpp.htm#rotatedline.htm

Basically, you can use the XYChart.swapXY call to make the chart vertical.

For the charts are real-time charts and they are updated and zoom and scroll together, you can create multiple XYChart objects, and then combine them together using a MultiChart.

For allowing the user to add/remove charts or lines or edit other chart parameters, you may use the following sample code for the basic code structure:

https://www.advsofteng.com/doc/cdcpp.htm#financedemo.htm

(Although the above is a horizontal chart, the method is the same for a vertical chart.)

In brief, you need a user interface to allow your user to add/removes charts and lines and configure other chart parameters. This part is separate from the charting code. In the above example, the user interface is on the left side.

The charting code simply draws the chart according to the settings in the user interface. In the above example, the subroutine that draws the chart on the right draws according to the state of the user interface on the left. Whenever the user interface changes, the draw chart subroutine is called to update the chart.

If you need further information, I can write a simple example for your. In this case, please let me know which programming language and framework you are using (eg. C#/Windows Forms, C++/MFC, VB/ASP.NET, PHP/Web, etc).

Regards
Peter Kwan

  Re: Can Chart Director be used to create vertically progressing chart?
Posted by Jack on Jun-13-2020 05:42
Hi, Peter,

Thank you so much for the quick response and thorough explanation. It's nice to hear that ChartDirector can handle what I need.
I would definitely appreciate a simple demo if it doesn't take too much of your time because I'm new to this.  I prefer C#/Window form to C++/MFC if the interface can respond and chart can display at comparable speed.
Thanks again for your help.

Regards,
Jack

  Re: Can Chart Director be used to create vertically progressing chart?
Posted by Peter Kwan on Jun-15-2020 02:24
Hi Jack,

I have just written a simple example with the following features:

(a) Contains multiple charts, with each chart contains multiple lines

(b) The charts update in real time and flows from top to bottom.

(c) Scrollable and zoomable

(d) With checkboxes to hide/show charts and hide/show lines.

I started from the "Real Time Chart with Zoom/Scroll and Track Line" sample code. I use swapXY to make the chart vertical, and change some other parts to reflect the orientation change (like changing "ViewPortLeft / ViewPortWidth" to "ViewPortTop / ViewPortHeight").

I then copy the charting code to make two charts. Then I use a MultiChart to contain the two charts.

I added two checkboxes to hide/show a chart and a line, just to provide an example.

I think the above demonstrates the essential features you need. The rest is just to fine tune the appearance and style (like how to label the axes, etc).

To try the sample code, please unzip the files and copy them to the "ChartDirector/NetWinCharts/CSharpWinCharts" folder in "ChartDirector for .NET". This will replace the original "Real Time Chart with Zoom/Scroll and Track Line" sample code. Now you can start NetWinCharts Visual Studio solution, try the C# sample code and select the "Real Time Chart with Zoom/Scroll" example to try it.

https://www.advsofteng.com/support/vertical_realtime_multi_zoom_scroll_winforms.zip

Regards
Peter Kwan

  Re: Can Chart Director be used to create vertically progressing chart?
Posted by Jack on Jun-16-2020 06:59
Hi, Peter,
I tried the example you provided. As you said, it has the essential features I need in terms of the chart display. What a wonderful tool! Great job.
Both the user interface and cursor response are very smooth.  One thing I noticed in the example is the minimum updating interval is set to 250 ms, what's the reason behind it?can it be set lower? Thank you very much.

regards,
Jack

  Re: Can Chart Director be used to create vertically progressing chart?
Posted by Peter Kwan on Jun-16-2020 11:26
Hi Jack,

You can modify the code to allow fast update interval.

The first real time chart sample code (the Simple Real Time Chart) was written many years ago, at the time "NetBook" computers are still common. A typical configuration is a N270 Atom CPU with 1G RAM. Its performance is about 3% of a typical modern computer. We want our sample code to run smoothly even on that kind of computer, so we set the update interval to very conversative values.

You can check your CPU utilization to see how much CPU is used for the real time update. I think with modern computers, it uses only a few percent of CPU.

For your information, there are some other real time sample code in the Library section of our web site that are written later and run at a faster default rate:

https://www.advsofteng.com/tutorials/extra.html

From experience, for charts, the data can update as fast as necessary, but updating the display at 10 times per second is already quite smooth. (For comparison, a DVD movie updates at 24fps and is very smooth. A chart can update slower because its content only change slowly compared to a movie screen.) At 10 fps, the CPU utilization should still be very low.

Regards
Peter Kwan

  Re: Can Chart Director be used to create vertically progressing chart?
Posted by Peter Kwan on Jun-16-2020 15:33
Hi Jack,

I forgot to mention that in the sample code, the random number generator is hard coded to product 4 numbers per second. So for the sample code, in addition to making the chart refresh faster, you would also need to modify the random number generator to generate random number more rapidly to see any difference.

Regards
Peter Kwan

  Re: Can Chart Director be used to create vertically progressing chart?
Posted by Jack on Jun-18-2020 00:02
Hi, Peter,

Thanks for the clarification. Your support is impressive. I'll buy the license and go for Chart Director.

regards,
Jack