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

Message ListMessage List     Post MessagePost Message

  Multiple Y-Axis | How to set one line at the front, and set the bar to back
Posted by Ma Ji on Mar-11-2011 12:17
Attachments:
Dear Professional,

I encounter an issue about:
I create a chart with Bar, but i need another line, like the example of "Dual Y-Axis", but now
the line I added is always at the back, the bar is at front, i would like to send the bar to the
back.

Thank you!
MJ-121515.jpg

  Re: Multiple Y-Axis | How to set one line at the front, and set the bar to back
Posted by Peter Kwan on Mar-11-2011 12:52
Hi Ma,

I assume the lines are added by using addLineLayer.

Please add the line layers first, and the bar layer last. In this way, the lines will be on the top, and the bars at the back.

You may also use Layer.moveFront and Layer.moveBack to move a layer in front of or behind another layer.

Hope this can help.

Regards
Peter Kwan

  Re: Multiple Y-Axis | How to set one line at the front, and set the bar to back
Posted by Ma Ji on Mar-11-2011 13:24
Attachments:
Dear Peter,

I have tried, but it gets error like the screenshot i attached

Please help, thank you

Ma Ji
MJ-131742.jpg

  Re: Multiple Y-Axis | How to set one line at the front, and set the bar to back
Posted by Ma Ji on Mar-11-2011 13:47
Attachments:
Dear Peter,

Thanks, I add the dataset first, then now the line is at front.
but i encounter another issue, how can i make the 2nd Y-Axis be forced to start from 0?
not from some offset value.

Sincerely,

Ma Ji
MJ-134540.jpg

  Re: Multiple Y-Axis | How to set one line at the front, and set the bar to back
Posted by Peter Kwan on Mar-11-2011 18:26
Hi Ma Ji,

The Layer.moveFront was introduced in ChartDirector Ver 5. It does not exist in earlier versions of ChartDirector. Are you using ChartDirector Ver 5 or an earlier version?

The alternative method of changing the order of adding the layers always work on all versions of ChartDirector.

Regards
Peter Kwan

  Re: Multiple Y-Axis | How to set one line at the front, and set the bar to back
Posted by Peter Kwan on Mar-11-2011 18:29
Hi Ma Ji,

You may use Axis.setAutoScale to configure how auto-scaling choose the axis starting and ending points. For your case, you may set the zero-affinity parameter to 1, in which case ChartDirector will always include zero in the axis scale. For example:

Call c.yAxis2().setAutoScale(0.05, 0.05, 1)

Hope this can help.

Regards
Peter Kwan