|
reverse Finance Chart |
Posted by Satya on Jul-25-2010 15:04 |
|
Hi,
Currently we are using finance chart. We would like to show the Chart in reverse. How can we achieve the same in a Finance chart?
Satya |
Re: reverse Finance Chart |
Posted by Peter Kwan on Jul-26-2010 20:01 |
|
Hi Satya,
I am not sure exactly what you mean by "to show the Chart in reverse".
Do you mean to reverse the flow of time on the chart (so time on the x-axis flows from right to left, instead of from left to right), or to swap the positions of the two y-axes on the main price chart, reverse the flow of the y-axis (so it "points" down instead of "points" up), to show the chart upside down, or some other things? Please kindly clarify.
Regards
Peter Kwan |
Re: reverse Finance Chart |
Posted by Satya on Jul-27-2010 00:05 |
|
Peter Kwan wrote:
Hi Satya,
I am not sure exactly what you mean by "to show the Chart in reverse".
Do you mean to reverse the flow of time on the chart (so time on the x-axis flows from right to left, instead of from left to right), or to swap the positions of the two y-axes on the main price chart, reverse the flow of the y-axis (so it "points" down instead of "points" up), to show the chart upside down, or some other things? Please kindly clarify.
Regards
Peter Kwan
Hi Peter,
What i meant was, the chart can be make up-side down. please refer to attached image. The first chart is the actual chart and the second chart is shown up-side down.
Satya
|
Re: reverse Finance Chart |
Posted by Peter Kwan on Jul-27-2010 02:02 |
|
Hi Satya,
You may use Axis.setReverse to reverse the axis scale. For example, if you want to reverse the y-axis scale for the main price chart, you may (in VB/VBScript):
Set m = myFinanceChart.addMainChart(......)
Call m.yAxis().setReverse()
Hope this can help.
Regards
Peter Kwan |
Re: reverse Finance Chart |
Posted by Satya on Jul-27-2010 02:07 |
|
Peter Kwan wrote:
Hi Satya,
You may use Axis.setReverse to reverse the axis scale. For example, if you want to reverse the y-axis scale for the main price chart, you may (in VB/VBScript):
Set m = myFinanceChart.addMainChart(......)
Call m.yAxis().setReverse()
Hope this can help.
Regards
Peter Kwan
Hi Peter,
php code will help us a lot.
Satya |
Re: reverse Finance Chart |
Posted by Peter Kwan on Jul-28-2010 00:49 |
|
Hi Satya,
In PHP, the same code is:
$m = $myFinanceChart->addMainChart(......);
$m->yAxis->setReverse();
Hope this can help.
Regards
Peter Kwan |
Re: reverse Finance Chart |
Posted by Satya on Jul-28-2010 17:37 |
|
Peter Kwan wrote:
Hi Satya,
In PHP, the same code is:
$m = $myFinanceChart->addMainChart(......);
$m->yAxis->setReverse();
Hope this can help.
Regards
Peter Kwan
Hi Peter,
when i tried the code given, it returns below error
Fatal error: Call to a member function setReverse() on a non-object
our code is like this
addIndicator($m, $_REQUEST["Indicator1"], $indicatorHeight);
#
# Add the main chart
#
$m->addMainChart($mainHeight);
$m->yAxis->setReverse(); //error comes on this line
Regards
Satya |
Re: reverse Finance Chart |
Posted by Peter Kwan on Jul-29-2010 01:35 |
|
Hi Satya,
Your need to call yAxis using the XYChart object returned from addMainChart, as indicator in my suggested code. The code you are currently using the different from my code, and use the FinanceChart object instead of the XYChart object. The FinanceChart object does not have any y-axis, so PHP complains.
The variable names are arbitrarily, so you can freely change to use other names. For example, in my code, I use $m and $myFinanceChart to represent the XYChart object and the FinanceChart object. In your code, you have already used $m to represent the FinanceChart object. You may use another name for the XYChart object, such as $xy.
$xy = $m->addMainChart($mainHeight);
$xy->yAxis->setReverse();
Hope this can help.
Regards
Peter Kwan |
Re: reverse Finance Chart |
Posted by Thiago on Jan-06-2011 23:48 |
|
Peter Kwan wrote:
Hi Satya,
Your need to call yAxis using the XYChart object returned from addMainChart, as indicator in my suggested code. The code you are currently using the different from my code, and use the FinanceChart object instead of the XYChart object. The FinanceChart object does not have any y-axis, so PHP complains.
The variable names are arbitrarily, so you can freely change to use other names. For example, in my code, I use $m and $myFinanceChart to represent the XYChart object and the FinanceChart object. In your code, you have already used $m to represent the FinanceChart object. You may use another name for the XYChart object, such as $xy.
$xy = $m->addMainChart($mainHeight);
$xy->yAxis->setReverse();
Hope this can help.
Regards
Peter Kwan
Hi Peter,
I want to draw a graph as Satya wants.
I did what you sad, took the Y axis from my chart and used the setReverse function.
Although the labels were inverted the data wasn't.
Can you help me?
Regards
Castro, Thiago |
Re: reverse Finance Chart |
Posted by Peter Kwan on Jan-08-2011 00:46 |
|
Hi Thiago,
I am not too sure what is "the data wasn't inverted" means. May be you can include two chart images to help me understand the issue. You may include the chart obtained without setReverse, and the same chart obtained using setReverse. Please kindly indicate which part you think is in error in the setReverse chart.
Regards
Peter Kwan |
Re: reverse Finance Chart |
Posted by Thiago on Jan-08-2011 01:32 |
|
Peter Kwan wrote:
Hi Thiago,
I am not too sure what is "the data wasn't inverted" means. May be you can include two chart images to help me understand the issue. You may include the chart obtained without setReverse, and the same chart obtained using setReverse. Please kindly indicate which part you think is in error in the setReverse chart.
Regards
Peter Kwan
Hi Peter,
As you asked, the first file is the chart drawn without the setReverse command,
and the second is using the setReverse command. You may see that the ticks
of the Y axis are reversed although the plotted data isn't. The curve was drawn
in the same way in both charts.
Regards
Castro, Thiago
|
Re: reverse Finance Chart |
Posted by Peter Kwan on Jan-08-2011 02:49 |
|
Hi Thiago,
Is it possible that the line is not using the left y-axis? (Have you got another axis on the right side that the line is using?) Or, is it possible the Axis.setReverse is called after the line has already been drawn or layout? (Have you called BaseChart.layout in your code, and is it before Axis.setReverse?)
If the above still cannot solve the problem, would you mind to inform me the "charting part" of your code, so I can try to reproduce the problem.
Regards
Peter Kwan |
Re: reverse Finance Chart |
Posted by Thiago on Jan-10-2011 19:38 |
|
Peter Kwan wrote:
Hi Thiago,
Is it possible that the line is not using the left y-axis? (Have you got another axis on the right side that the line is using?) Or, is it possible the Axis.setReverse is called after the line has already been drawn or layout? (Have you called BaseChart.layout in your code, and is it before Axis.setReverse?)
If the above still cannot solve the problem, would you mind to inform me the "charting part" of your code, so I can try to reproduce the problem.
Regards
Peter Kwan
Hi Peter
Thanks a lot for your help, the problem was, in your words:
Axis.setReverse is called after the line has already been drawn... I didn't realize that I should do it before the line is draw. In my mind I thought that if I draw the line and set the axis to reverse than call layout it would do the job.
Thanks again.
Regards
Castro, Thiago |
|