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

Message ListMessage List     Post MessagePost Message

  how to modify someone Label in many Labels?
Posted by Kun on Jan-22-2015 09:29
Attachments:
      There are 540 Labels on xAxis, but the 270th Label is special, I want to modify it`s format. Like the pictrue:
      // code
     DoubleArray timeStamps1 = r.getDateSeries(270, Chart::chartTime(2011, 1, 1, 9, 15), 30);
DoubleArray timeStamps2 = r.getDateSeries(270, Chart::chartTime(2011, 1, 1, 13, 0, 30), 30);
double time[540];
memcpy(time, timeStamps1.data, sizeof(double)*timeStamps1.len);
memcpy(time+270, timeStamps2.data, sizeof(double)*timeStamps2.len);

DoubleArray timeStamps(time, 541);

c->xAxis()->setLabels(timeStamps, "{value|hh:nn}");
c->xAxis()->setLabelStep(30);
QQ截图20150122092433.png
QQ截图20150122092519.png

  Re: how to modify someone Label in many Labels?
Posted by Peter Kwan on Jan-23-2015 00:58
Hi Kun,

You can use Axis.addLabel. For example:

//add all the labels
c->xAxis()->setLabels(timeStamps, "{value|hh:nn}");

//modify the 270th label (index = 269) to the special text "ABC"
c->xAxis()->addLabel(269, "ABC");

Hope this can help.

Regards
Peter Kwan

  Re: how to modify someone Label in many Labels?
Posted by Kun on Jan-23-2015 09:14
Thank you, Peter Kwan!

It works. thank you!

Regards
Kun