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

Message ListMessage List     Post MessagePost Message

  today-mark outside plotarea
Posted by Fabian on Dec-10-2011 23:55
Attachments:
Hi Peter,

I would like to add an mark at current day.
I used the following code, to add the markline, but I dont know, how I could draw this highlight zone, which is shown in the screenshot.

// Add a red (ff0000) dash line to represent the current day
COleDateTime dtToday = COleDateTime::GetCurrentTime();
Mark* pMark = c->yAxis()->addMark(chartTime(dtToday.GetYear(), dtToday.GetMonth(), dtToday.GetDay()), c->dashLineColor(0xff0000, Chart::DashLine));
pMark->setLineWidth(2);
// pMark->setText("<*font=arialbi.ttf,size=9,color=FF0000*>Heute");
pMark->setAlignment(TopLeft);
pMark->setDrawOnTop(true);
Unbenannt.png

  Re: today-mark outside plotarea
Posted by Peter Kwan on Dec-13-2011 02:31
Hi Fabian,

For your case, you may try the following code:

// Add a mark to represent the current day
COleDateTime dtToday = COleDateTime::GetCurrentTime();
Mark* pMark = c->yAxis()->addMark(chartTime(dtToday.GetYear(), dtToday.GetMonth(), dtToday.GetDay()), -1, "Do\\n1");

// The mark line is a red dash line. The mark text is black, with a red background. The tick is red too.
pMark->setMarkColor(c->dashLineColor(0xff0000, Chart::DashLine), 0x000000, 0xff0000);
pMark->setBackgrouind(0xff0000);

Hope this can help.

Regards
Peter Kwan

  Re: today-mark outside plotarea
Posted by Fabian on Dec-13-2011 05:27
Thank you Peter, this works for me!

const char* pWeekDays[] = {"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"};
COleDateTime dtToday = COleDateTime::GetCurrentTime();
CString strD;strD.Format("%s\\n%i", pWeekDays[dtToday.GetDayOfWeek()-1], dtToday.GetDay());
Mark* pMark = c->yAxis()->addMark(
chartTime(dtToday.GetYear(), dtToday.GetMonth(), dtToday.GetDay()), -1, strD);
pMark->setLineWidth(2);
pMark->setDrawOnTop(true);
pMark->setMarkColor(c->dashLineColor(0xff0000, Chart::DashLine), 0x000000, 0xff0000);
pMark->setBackground(0xff0000);