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

Message ListMessage List     Post MessagePost Message

  syncAxis and setReverse
Posted by Tobias Reu on Mar-23-2012 21:20
Attachments:
Hi Peter,

I have a problem with syncAxis() and setReverse(1):

First, I added two line-layer to the mainChart:
my $o_layer0   = $r_opts->{'mainChart'}->addLineLayer2();
my $o_layer1   = $r_opts->{'mainChart'}->addLineLayer2();

Second, I added the data-sets:
my $o_dataSet0 = $o_layer0->addDataSet(...);
my $o_dataSet1 = $o_layer1->addDataSet(...);

Then, I created and synced the axis:
$r_opts->{'yAxis2'} = $r_opts->{'mainChart'}->yAxis2();
$r_opts->{'yAxis2'}->syncAxis($r_opts->{'yAxis'}, $r_data->{'axisFactor'});

Finally, I tried to reverse the right axis:
$r_opts->{'yAxis2'}->setReverse(1);

This has no effect! When I reverse the main-y-axis both axis will be drawn reversed. Is it possible to sync both axis and reverse only the second one? Or is there any other possibilty?

I have a second problem on the top grid line: There is a grey line (perhaps from the top axis?) and an orange one (from the grid). Is it possible to remove the grey one? I tried:
$r_opts->{'mainChart'}->xAxis2()->setColors($perlchartdir::Transparent);

Thank's for your help!
Tobias
chart.png

  Re: syncAxis and setReverse
Posted by Peter Kwan on Mar-24-2012 00:36
Hi Tobias,

By reversing the right y-axis, do you mean that the zero point of the right y-axis should start at the top of the plot area?

For your particular chart, reserving the second y-axis is equivalent to:

$r_opts->{'yAxis2'}->syncAxis($r_opts->{'yAxis'}, -$r_data->{'axisFactor'}, 120000);

The number 120000 above come from the top range of the left y-axis in your chart.

In your real chart, if your code specifies and therefore knows the top range of the left y-axis, then of course it can dynamically sync the y-axis. However, if the top range is determined automatically by ChartDirector, it can be any arbitrary number. It means that the zero point of your right y-axis is aligned to an arbitrary number, and so the left and right y-axes are just randomly sychronized (that is, it is not possible to predict how the labels on the left and right y-axis will match). In this case, to achieve what you need, I may need to know exactly how the axes are used. Should the two axes really be synchronzied (even the synchronization is somewhat random), or can they be independently scaled? Are you data layers really using the right y-axis, or is it just for display purpose?

Regards
Peter Kwan

  Re: syncAxis and setReverse
Posted by Tobias Reu on Mar-26-2012 19:14
Attachments:
Hi Peter,

when I read your comment, I found the solution. I used the right y-axis just for display purpose. That was my mistake. Now, I assigned the second layer to the right y-axis and reversed it:
$o_layer1->setUseYAxis2(1);
$r_opts->{'yAxis2'}->setReverse(TRUE);

Do you have an idea how I can remove the grey line on top of the plot-area?
I switched all colors from the axis and the grid to transparent, but the grey line is still visible:

Thank you
Tobias
chartNG2.png

  Re: syncAxis and setReverse
Posted by Peter Kwan on Mar-27-2012 01:46
Hi Tobias,

Are you using a FinanceChart for your chart, or is it a standalone XYChart?

The FinanceChart by default will have a semi-transparent grey legend box at the top of the plot area. If there is no financial indicator and ohlc data in the chart, the legend box will become zero in size, but you can still see the legend box border. This will become a semi-transparent grey line at the top.

If the above is the cause of the problem, and you would still like to use a FinanceChart for your chart, you may set the legend box color to transparent.

$r_opts->{'mainChart'}->getLegend()->setBackground($perlchartdir::Transparent, $perlchartdir::Transparent);

Hope this can help.

Regards
Peter Kwan

  Re: syncAxis and setReverse
Posted by Tobias Reu on Mar-28-2012 00:00
Hi Peter,

I have a finance-chart. By setting the border color of the legend-box to transparent the grey line is invisible.

Thank you for your help!