User (Legacy) Posted April 21, 2003 Report Share Posted April 21, 2003 ChartFX Client/server: Is there a way that I can set the MAX size for a chart and it's series legend? Even if I don't necessarily know the max width for the legend? For example we have a project where the user can specify the maximum size that a chart should take up when it is published. However when it has a legend docked on the chart, the output size always exceeds the maximum( width in this case with the legend docked on the right side ). This is how I output the chart as a metafile: HENHMETAFILE GetMetaFile() { if( chart_fx ){ HRESULT hr = chart_fx->CreateWnd( NULL, 0, 0, 0, size.cx, size.cy, WS_POPUP ); if( SUCCEEDED( hr ) ){ chart_fx->UpdateSizeNow(); IPictureDisp *pic_disp = chart_fx->GetPicture( CHART_METAFILE ); if( pic_disp ){ CComPtr<IPicture> pict = NULL; HRESULT hr = pic_disp->QueryInterface( IID_IPicture, (void**)&pict ); if( SUCCEEDED( hr ) ){ HENHMETAFILE handle; pict->get_Handle( (OLE_HANDLE*)&handle ); return handle; } } } } return NULL; } Is there a way I can force the legend( if present ) to fit within the maximum size, thereby making the chart area smaller? -Mac Quote Link to comment Share on other sites More sharing options...
Software FX Posted April 24, 2003 Report Share Posted April 24, 2003 The problem here is with the style you are passing to the window. You can use either WS_OVERLAPPEDWINDOW (no parent) or WS_CHILD (you will need to specify a parent). Either way you will get the desired results. Note: If you create the window without an owner it will not be destroyed until the application ends, chart object is freed or you call DestroyWindow(). -- FP Software FX, Inc. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.