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

Message ListMessage List     Post MessagePost Message

  Continuous Real Time graph over time
Posted by Nicole on Feb-13-2012 18:04
Attachments:
Hi,

I'm wondering if it's possible for ChartDirector to produce a real time graph of valence and
arousal over time? The values of valence and arousal ranges from -1 to 1 and time is
continuous so there are no labels along the y axis. An image is attached to show my desired
output. May I know how this can be done? Also, is ChartDirector capable of outputting the
graph directly into a form in C++ instead of outputting into an image file?


Thank you very much! Any help would be greatly appreciated!
desired graph.png

  Re: Continuous Real Time graph over time
Posted by Peter Kwan on Feb-13-2012 22:22
Hi Nicole,

The graph in your case is just a normal realtime line chart. It is essentially the same same the realtime chart sample code included in ChartDirector. You just need to set the plot area border, grid lines and the x-axis to transparent if you do not want to see them. For the y-axis, you can configure the y-axis to be (-1, 0, 1) by using Axis.setLinearScale. You can configure the y-axis color so that the axis stem is transparent, while the axis labels (-1, 0, 1) are visible. For the line at y = 0, you can add it as a mark line.

So the code should be something like:

// Set the plotarea at (55, 6280) and of 520 x 175pixels in size. Use transparent border and grid lines
PlotArea *plotArea = c->setPlotArea(55, 62, 520, 175, -1, -1, Chart::Transparent, Chart::Transparent, Chart::Transparent);

c->xAxis()->setColors(Chart::Transparent, Chart::Transparent);
c->yAxis()->setColors(Chart::Transparent);
c->yAxis()->setLinearScale(-1, 1, 1);
c->yAxis()->addMark(0, 0x000000, "0");

You modify the above code to configure other aspects of the chart, such as the font size, line widths, etc..

The MFC and QT sample code included in ChartDirector for C++ outputs directly to an MFC or QT form, and does not require outputting to an image file first. In MFC, the code outputs the chart in memory as a DIB (Device Independent Bitmap), then create an HBITMAP, which can be displayed in the MFC CStatic control. In QT, the code outputs the chart as a DIB, then create a QPixmap, then displays it using the QLabel setPixmap method.

In general, ChartDirector can output the chart in standard formats in memory. In C++, there is no standard on what is a "Form" or how to display or perform anything at all in Windows. It all depends on your GUI framework. All GUI frameworks I am aware of can display some kind of standard formats in memory, so they should be able to display the charts. The MFC and QT sample code are examples on how to do that in these two GUI frameworks.

Hope this can help.

Regards
Peter Kwan

  Re: Continuous Real Time graph over time
Posted by Nicole on Feb-14-2012 21:10
Hi Peter,

Thank you very much for your quick response and detailed explanation. I'll try to implement
what you have said.


Many thanks!