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

Message ListMessage List     Post MessagePost Message

  Multichart & addMark
Posted by Fabian on Sep-19-2011 17:50
Hello Peter,

how could be used addMark for a multichart?

With this code the markline won't be appear:


m = new MultiChart(iWindowX, iWindowY);

c = (XYChart*)
DrawChartLine(true, m_iVStartIndex, 180, iHGab+10, iWindowX, iHeight+iHGab);

// 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->setDrawOnTop(true);

pArr.Add(c);
m->addChart(0, 0, c);

for(i=1; i<m_iMinV; i++) {
c = (XYChart*)DrawChartLine(false, i+m_iVStartIndex, 180, 3, iWindowX, iHeight);
pArr.Add(c);
m->addChart(0, iHeight*i+iHGab, c);
}

delete m_Chart.getChart(); // delete old Multichart!!!
m_Chart.setChart(m);

//include tool tip for the chart
CString sImageMap;
sImageMap.Format("%s", m->getHTMLImageMap("", ""));
// "index={field0}", "title='{x|dd.mm.yyyy}\\n{field1}\\n{value} Stunden'"));
m_Chart.setImageMap(sImageMap);

for(i=0;i<pArr.GetSize();i++) delete (XYChart*)pArr.GetAt(i);

  Re: Multichart & addMark
Posted by Peter Kwan on Sep-20-2011 00:54
Hi Fabian,

You can use addMark on an XYChart as usual. The XYChart can be included in a MultiChart.

Whereas I cannot find any error in your code, there is an "unusual feature". Your code adds the mark line to the y-axis, in which the mark value is a date. Is this correct, or should the mark line be added to the x-axis? (In most charts with dates, the x-axis is the date axis, while the y-axis is the numeric axis.)

Also, as you are using a date value as the mark line, it works only if your axis is really a date/time axis. It means your code must be using setXData to provide date/time x-coordinates to the layer, and your axis is not using setLabels (otherwise it is a label based axis, not a date/time axis). Since I do not know what is inside DrawChartLine, I cannot verify if the above is the case.

Regards
Peter Kwan

  Re: Multichart & addMark
Posted by Fabian on Sep-20-2011 01:14
Hi Peter,

thank you. My mistake, I should use xAxis. Now it's working! :-)