Jump to content
Software FX Community

some problems with autoscale behavior

User (Legacy)

Recommended Posts

I am still seeing weird results for the scale( esp min/max vals ) that is

generated by chartfx.

Basically I have a little program where you can specify the amplitude of a

sign wave. The points are generated at intervals of PI/6:


//X is the amplitude which is passed in








m_pChartFX->Gallery = CURVE;

m_pChartFX->PointLabels = FALSE;

m_ pChartFX->CylSides = 0;

m_pChartFX->Axis->Item[AXIS_Y]->Style = (CfxAxisStyle)(

m_pChartFX->Axis->Item[AXIS_Y]->Style & ~AS_BREAKZERO );

double pi = 3.1415926535;

m_pChartFX->OpenDataEx((CfxCod) (COD_VALUES|COD_REMOVE), 1, 13);

for(i=0;i<=12;i++) {

double val = X * sin( i * pi/6 );

m_pChartFX->GetSeries()->GetItem( 0 )->PutYvalue( i, val );



///end snippet

I noticed that when i set the amplitude to 3 even though there is an actual

value of 3.00, the y scale does not display it, see attached picture.

I was also wondering why it is that if the amplitude is 14 or 15 that the

min/max is +-20.00 on the y scale.

I am doing anything noticeably wrong to produce these incorrect results? Am

I doing something in the improper order?

There is no guarantee that I know the max and min up front and I am just

using Chartfx to generate a metafile so those params can't be altered later

Thank you in advance


Link to comment
Share on other sites

Did you try setting the Max to 3.00. Trigonometrical functions are not exact

and even though it looks like is 3.00 it might be 3.0000001 or 2.999999 and

therefore is not reached by the step. Try assigning -3.00 and 3.00 Manually

to the Y0-Axis. Does it make a difference ?

Another explanation is this: Since you have Break zero at false, the Min is

always going to show (it is the starting point), then a step is chosen and

increments are made to the Min. In this case the step we chose is not so

that 3.00 will be reached. In other words the step we chose is not 2.80 but

2.8000001 or something like that.



Software FX, Inc.

Link to comment
Share on other sites


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

  • Create New...