Jump to content
Software FX Community

Problem getting Pie charts to resize properly when exporting to a file.


User (Legacy)

Recommended Posts

Hi,

I am currently using a trial version of ChartFx Client-Server. I am

using it as a dll inside of VC++ and don't use MFC to generate classes, only

through COM interfaces. My current implementation takes data from a

database essentially record by record( I know that this is not the best way,

but for testing purposes that is the way I chose to do it ). I'd like to

add the data from a database ( say Summary table = Select SUM( F1 ) group by

F2 something like that ) where the values for the group represent the label

and the summary value is what is put into the chart. I put the data in no

problem, but for some reason when I export to a metafile, or any file for

that matter the pie chart doesn't want to resize propery and only ends up

taking up 1/4 to 1/3 of the space that it should. Bar and Line charts

behave properly for this part, but for some reason Pie charts do not. Am I

missing something?? Oh yeah I don't want to show the window because this

operation is sort of a batch operation and there is no need for the user to

interact with the control. And I also add the data as realtime data, since I

don't have access to the rowset itself...the row data is passed by seperate

calls to my function from inside of another component.

Exporting:

HWND hnd = AfxGetMainWnd()->m_hWnd;

HRESULT hr = m_pChartFX->CreateWnd( (long)hnd, IDC_CHART, 0, 0, 50, 50,

WS_CHILD );

BOOL ok = SetWindowPos( (HWND)m_pChartFX->hWnd, HWND_BOTTOM, 0, 0,

1000/*size.cx*/, 1000/*size.cy*/, SWP_NOMOVE );

if( SUCCEEDED( hr ) && ok ){

m_pChartFX->RecalcScale();

m_pChartFX->UpdateSizeNow();

cstring file_name = "c:\\chart_test.emf";

m_pChartFX->Export( CHART_METAFILE, (LPCSTR)file_name );

}

setup:

m_pChartFX->PutRGB2DBk( RGB( 255, 255, 255 ) );

m_pChartFX->PutChart3D( ( dbview->GetFlags( DBVIEW_GRAPH_MASK ) ==

DBVIEW_GRAPH_LINE ) ? 0 : 1 ); //if not line make it 3d

m_pChartFX->OpenDataEx( COD_VALUES, ~list, 0 );//setup the chart to accept

certain number of series, but don't have any data to add yet

m_pChartFX->CloseData( COD_VALUES );

adding pts:

//I store the values for each group as a tuple of index and value and add

them all at once to prevent NULLs from being added

m_pChartFX->OpenDataEx( (CfxCod)( COD_VALUES | COD_ADDPOINTS ),

~group_values, 1 );

frep_( i, ~group_values ) m_pChartFX->ValueEx[group_values[i].a][0] =

group_values[i].b;

m_pChartFX->CloseData( (CfxCod)( COD_VALUES | COD_REALTIME ) );

Link to comment
Share on other sites

I create an invisible window and call setwindow pos to set the size of the window.  I call the Export function on the IChartFX interface(see bold ) ( Code Follows )

HRESULT hr = m_pChartFX->CreateWnd( (long)hnd, IDC_CHART, 0, 0, 50, 50,WS_CHILD );

BOOL ok = SetWindowPos( (HWND)m_pChartFX->hWnd, HWND_BOTTOM, 0, 0, 500/*size.cx*/, 500/*size.cy*/, SWP_NOMOVE );

if( SUCCEEDED( hr ) && ok ){

m_pChartFX->RecalcScale();

m_pChartFX->UpdateSizeNow();

cstring file_name = "c:\\chart_test.emf";

m_pChartFX->Export( CHART_METAFILE, (LPCSTR)file_name );

}

The chart itself appears in the upper right hand side of the image produced from the Export call

"SoftwareFX Support" <support@softwarefx.com> wrote in message news:GRkTjUdWCHA.976@webserver1.softwarefx.com...

> What function are you suing to export to a file ? how a re you specifying

> the size of the picture ?

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

Uhhhh I meant the chart is on the upper LEFT hand side....not the right hand side.

-Mac

"Mac Dyer" <Mac@simxtech.com> wrote in message news:4NwP92dWCHA.3136@webserver1.softwarefx.com...

I create an invisible window and call setwindow pos to set the size of the window. I call the Export function on the IChartFX interface(see bold ) ( Code Follows )

HRESULT hr = m_pChartFX->CreateWnd( (long)hnd, IDC_CHART, 0, 0, 50, 50,WS_CHILD );

BOOL ok = SetWindowPos( (HWND)m_pChartFX->hWnd, HWND_BOTTOM, 0, 0, 500/*size.cx*/, 500/*size.cy*/, SWP_NOMOVE );

if( SUCCEEDED( hr ) && ok ){

m_pChartFX->RecalcScale();

m_pChartFX->UpdateSizeNow();

cstring file_name = "c:\\chart_test.emf";

m_pChartFX->Export( CHART_METAFILE, (LPCSTR)file_name );

}

The chart itself appears in the upper right hand side of the image produced from the Export call

"SoftwareFX Support" <support@softwarefx.com> wrote in message news:GRkTjUdWCHA.976@webserver1.softwarefx.com...

> What function are you suing to export to a file ? how a re you specifying

> the size of the picture ?

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...