|
two scales on yAxis |
Posted by Steve on Oct-28-2011 22:45 |
|
Hi Peter,
I am trying to create a financial chart (price and volume) where the ticks on the yAxis are for the price ticks. I am adding a Mark for each tick except for the bottom few ticks. The bottom I am keeping blank because I want to add Marks from yAxis2 to yAxis. Is it possible to do this?
mc.yAxis().copyAxis(mc.yAxis2()); copies the yAxis2 to the yAxis.. but i want to keep the yAxis as the price scale.
Thanks for any suggestions |
Re: two scales on yAxis |
Posted by Peter Kwan on Oct-31-2011 03:11 |
|
Hi Steve,
I have just tried myself, and the following method seem to work (in C#):
.... set up FinanceChart as usual ....
//layout financial chart so we know the axis scale and ticks
myFinanceChart.layout();
//the top y-coordinate of yAxis2
int yAxis2Top = mc.getYCoor(mc.yAxis2().getMaxValue(), mc.yAxis2());
//disable all yAxis grid lines below top of yAxis2
double[] ticks = mc.yAxis().getTicks();
for (int i = 0; i < ticks.Length; ++i)
if (mc.getYCoor(ticks[i]) >= yAxis2Top) mc.yAxis().addLabel(ticks[i], "");
//add grid lines for yAxis2
ticks = mc.yAxis2().getTicks();
for (int i = 0; i < ticks.Length; ++i)
mc.yAxis2().addMark(ticks[i], 0xdddddd).setDrawOnTop(false);
Hope this can help.
Regards
Peter Kwan |
|