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

Message ListMessage List     Post MessagePost Message

  How to put color in the chart area and put a label between the X Axis values
Posted by Mooseon Choi on Dec-16-2020 12:22
Attachments:
Hi

I have Two Questions

Frist, How to put color in the chart area

Second, How to put a label between the X Axis values
Questions.png

  Re: How to put color in the chart area and put a label between the X Axis values
Posted by Peter Kwan on Dec-17-2020 13:47
Hi Mooseon,

For filling the region under the bell curve, you may use an InterLineLayer together with a x-zone color. For example:

// The color is light blue (0x99ccff) between x=100 and x=110, and transparent outside the range
int color = c->xZoneColor(100, Chart::Transparent, c->xZoneColor(110, 0x99ccff, Chart::Transparent));

// Use the color to fill the region between the spline layer (for the bell curve) and the x-axis (y=0 line)
c->addInterLineLayer(mySplineLayer->getLine(), c->yAxis()->addMark(0, Chart::Transparent)->getLine(), color);

For the x-axis labels, there are many ways to put labels on x-axis. The addMark method below is the most flexible method:

// Add a mark at 115 with the label "Good". Set the mark line to transparent and the text  to black (0x000000)
c->xAxis()->addMark(115, -1, "Good", "arialbd.ttf", 10)->setMarkColor(Chart::Transparent, 0x000000, Chart::Transparent);

Regards
Peter Kwan