User (Legacy) Posted February 20, 2003 Report Share Posted February 20, 2003 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: SNIPPET: //X is the amplitude which is passed in m_pChartFX->ClearData(CD_STRINGS); m_pChartFX->ClearData(CD_PERSERIESATTRIBUTES); m_pChartFX->ClearData(CD_CONSTANTLINES); m_pChartFX->ClearData(CD_COLORSANDPATTERNS); m_pChartFX->ClearData(CD_TOOLS); m_pChartFX->ClearData(CD_XVALUES); m_pChartFX->ClearData(CD_STRIPES); 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 ); } m_pChartFX->CloseData(COD_VALUES); ///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 -Mac Link to comment Share on other sites More sharing options...
Software FX Posted February 21, 2003 Report Share Posted February 21, 2003 This is because the step we chose in some cases is not exact so that the Max is reached. You can fix this by doing: m_pChartFX->Axis->Item[AXIS_Y]->Style |= AS_SHOWENDS; Or you can set your own step: m_pChartFX->Axis->Item[AXIS_Y]->STEP = 0.5; -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted February 21, 2003 Author Report Share Posted February 21, 2003 But this still does not explain why the first picture( where the scale should go from [-3.00,3.00] ). It shows the lower bound on the axis, but not the upperbound. Any thoughts on why that happened? -Mac Dyer Link to comment Share on other sites More sharing options...
Software FX Posted February 22, 2003 Report Share Posted February 22, 2003 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. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.