|
Getting started in MFC |
Posted by Matt on May-12-2011 20:41 |
|
I am just getting started with ChartDirector.
I have literally cut-n-pasted the "Hello World" script into my own MFC MultiDoc CFormView
Project.
Here is my CChartView::OnInitialUpdate() method.
void CChartView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
ResizeParentToFit();
double data[] = {85, 156, 179.5, 211, 123};
// The labels for the bar chart
const char *labels[] = {"Mon", "Tue", "Wed", "Thu", "Fri"};
// Create a XYChart object of size 250 x 250 pixels
XYChart *c = new XYChart(250, 250);
// Set the plotarea at (30, 20) and of size 200 x 200 pixels
c->setPlotArea(30, 20, 200, 200);
// Add a bar chart layer using the given data
c->addBarLayer(DoubleArray(data, sizeof(data)/sizeof(data[0])));
// Set the labels on the x axis.
c->xAxis()->setLabels(StringArray(labels, sizeof(labels)/sizeof(labels[0])));
// Output the chart
ChartControl.setChart(c);
}
Why does my app only show the bounding box for the CStatic picture control and not the
same graph as the Hello World example? |
Re: Getting started in MFC |
Posted by Peter Kwan on May-13-2011 02:31 |
|
Hi Matt,
Could you verify that the CStatic picture control in your Dialog editor is really a CStatic control for display a bitmap?
Usually, such a control should be like an icon showing a cactus in a desert. (It should be like the icon in the HelloWorld sample code.) If you see a frame (a rectangle), it is possible it is just a CStatic frame? (Click on the icon, look at its Properties, go to the "Type" field - is the type being a "Bitmap" or a "Frame"? Make sure the type is "Bitmap".)
Hope this can help.
Regards
Peter Kwan |
|