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 |