Jump to content
Software FX Community

Re: Many Dates on X-Axis


User (Legacy)

Recommended Posts

Hi Eric, 

Thanks for your reply..

I am afraid I am a bit of a dullard with C++, but I think I can work out

what it is doing!

I am using Visual FoxPro and when I do what I think your C code does it does

not like me setting the Min to 0.. in case you can see something obvious, I

have included my code....

Cheers,

Jon Sherren

** get data

sele close, date from p_1 into array ppp

npoints = _tally

nYearskip = int(npoints/365)+1

sele close from p_2 into array psect

** rebase overlay data

x1 = psect(1) / ppp(1,1)

with thisform.chartfx1

.Gallery = 1

.ChartFX1.OpenDataEx (1,2,nPoints)

.ChartFX1.OpenDataEx (6,1,npoints)

.ChartFX1.Axis(AXIS_X).min = 0 &&& this line causes the module to crash

.chartFx1.adm(CSA_XGAP) = nYearSkip && cannot use 'step' as reserved word

For j = 0 To nPoints -1

if j/nYearSkip = int(j/nYearSkip)

cFdate = dtos(ppp(j+1,2))

.chartfx1.Axis(AXIS_X).label(j) = substr(cFdate,1,4)

endif

.ChartFX1.ValueEx(0,j) = ppp(j+1,1)

.ChartFX1.ValueEx(1,j) = psect(j+1)/ x1

.ChartFX1.Series(0).XValue(j) = ppp(j+1,2)

.ChartFX1.Series(1).XValue(j) = ppp(j+1,2)

Next j

.ChartFX1.CloseData (1)

.ChartFX1.CloseData (6)

.ChartFX1.Series(0).Legend = "BAA"

.ChartFX1.Series(1).Legend = "Transport"

.ChartFX1.Axis(AXIS_X).format = "Ddd-MMM-yy"

endwith

thisform.caption = "BAA "+dtoc(fdate)+" to "+dtoc(ldate)

etc...

Eric J. Holtman wrote in message ...

>Here's what I do in those situations: Basically, set the Min and Step

>attirbutes for the X axis to 0, and some large value (I use #prices / 10),

>so in your case 3750/10 = 375. This way, there will be 10 distinct labels

>along your X axis.....

>

>Then, set the X axis label at each tick point to be the label you want. So,

>in your case, point 0, point 375, point 750... here's the C++ code I use,

>you'll do something similiar.....

>

>

> int xtick = m_nprices / 10;

>

> if (!xtick) xtick = 1;

>

>

> pChartFX->Axis->Item[AXIS_X]->Min = 0;

> pChartFX->Axis->Item[AXIS_X]->STEP = xtick;

>

> for (i=0;i<m_nprices;i++) {

> if (! (i%xtick)) {

> sprintf (buf, "%02d/%02d/%02d",

> m_prices[i].date.GetMonth (),

> m_prices[i].date.GetDay (),

> m_prices[i].date.GetYear () % 100

> );

> pChartFX->Axis->Item[AXIS_X]->Label[i] = buf;

> }

> }

>

>

>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...