Jump to content
Software FX Community

plot xy chart with logarithm x-axis


User (Legacy)

Recommended Posts

Dear Support People,

When I plotted a XY chart with logarithm x-axis in VC++/MFC, except the

curve i should get, i found the chart also draws a straight line from the

first point to somewhere else. What can I do with it?

The codes I wrote is:

m_pChartFX->Axis->Item[AXIS_X]->LogBase = 10;

VARIANT var;

VariantInit(&var);

V_VT(&var) = VT_I4;

var.intVal = AF_SCIENTIFIC;

m_pChartFX->Axis->Item[AXIS_X]->Format = var;

m_pChartFX->Axis->Item[AXIS_X]->Min = 0.000001;

m_pChartFX->Axis->Item[AXIS_X]->Max = 1;

m_pChartFX->Axis->Item[AXIS_Y]->Min = 0;

m_pChartFX->Axis->Item[AXIS_Y]->Max = 1;

m_pChartFX->OpenDataEx(COD_XVALUES, 1, 41);

for(i=60; i<101; i++)

{

m_pChartFX->ValueEx[0][i] = 1-y[i]/100;

m_pChartFX->XValueEx[0][i] = (x[i]/100);

}

m_pChartFX->CloseData((CfxCod) (COD_XVALUES));

Thanks!

LH

Link to comment
Share on other sites

This is because you are leaving some point uninitialized (from 0 to 59). 

Uninitialized points will default to ZERTO for both X and Y values. The line

that you see is the one going from (0,0) to the first data point you are

setting.

You need to set values to ALL points. If you want to hide a point, set

CHART_HIDDEN to its Y-Value.

--

FP

Software FX

Link to comment
Share on other sites

Thanks for the help!

I tried to set CHART_HIDDEN to those hidden points' y values, but I got

error:

"CHART_HIDDEN": undeclared identifier'.

My codes are (in VC++/MFC):

m_pChartFX->OpenDataEx(COD_XVALUES, 1, 101);

for(int i=0; i<101; i++)

{

if(x[i] == 0)

m_pChartFX->ValueEx[0][i] = CHART_HIDDEN;

else

{

m_pChartFX->ValueEx[0][i] = 1-y[i]/100;

m_pChartFX->XValueEx[0][i] = x[i]/100;

}

}

Could you tell me what is the problem? Thanks a lot!

LH

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...