ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  [MFC] X-axis as time
Posted by Kaiden on Feb-10-2014 21:50
Hi Peter,

I haven't finished the one I was doing before, but here is a new thing that I am trying.

This is what I want to do exactly,
http://www.chartdir.com/forum/download_thread.php?
bn=chartdir_general&pattern=hh%3Amm%3Ass.&thread=1163426182

and following that I made a code and tried.


m_vecX[0] = _T("15:38:12.123"); //->realDouble
m_vecX[1] = _T("15:38:12.406");
m_vecX[2] = _T("15:38:14.896");
m_vecX[3] = _T("15:38:59.949");
m_vecX[4] = _T("15:39:02.856");
m_vecX[5] = _T("15:39:16.874");


m_vecX2[0] = _T("15:38:37.123"); //->realDouble2
m_vecX2[1] = _T("15:38:54.841");
m_vecX2[2] = _T("15:39:09.546");
m_vecX2[3] = _T("15:39:12.123");
m_vecX2[4] = _T("15:39:21.254");
m_vecX2[5] = _T("15:39:59.456");
.
.
.
StepLineLayer *layer0 = m_pChart->addStepLineLayer(DoubleArray(m_double,
(int)(sizeof( m_double) / sizeof(m_double[0]))), 0xff0000, "DATA 1");
layer0->setXData(DoubleArray(realDouble, (int)(sizeof(realDouble) /
sizeof(realDouble[0]))));
layer0->setLineWidth(2);

// Add a blue (0000ff) step line layer to the chart and set the line width to 2
// pixels
StepLineLayer *layer1 = m_pChart->addStepLineLayer(DoubleArray(m_double2,
(int)(sizeof( m_double2) / sizeof(m_double2[0]))), 0x0000ff, "DATA 2");
layer1->setXData(DoubleArray(realDouble2, (int)(sizeof(realDouble2) /
sizeof(realDouble2[0]))));
layer1->setLineWidth(2);
m_pChart->xAxis()->setTickDensity(100);
m_pChart->xAxis()->setDateScale("{value|hh:nn:ss}.{={value}%1|3}");
m_pChart->xAxis()->setLabelStyle("arialbd.ttf", 7, 0x008000)-
>setFontAngle(45);
m_pChart->xAxis()->setLabelStep(1000);

everything is good except for the X-axis label.
it should look like hh:nn:ss.XXX
but it's shown like hh:nn:ss.0.000

last 3 number- centisecond all changed to 0.
and there is unnecessary .0 in between second and centisecond.

Can you help me out?
Thanks always!

Best Regards,
Kaiden

  Re: [MFC] X-axis as time
Posted by Peter Kwan on Feb-11-2014 02:06
Hi Kaiden,

For the current version of ChartDirector, please use "fff" for milliseconds and "ff" for
centiseconds. For example:

c->xAxis()->setDateScale("{value|hh:nn:ss.fff}");

Hope this can help.

Regards
Peter Kwan