|
Problem while adding custom Indicator in Finance chart |
Posted by Yogesh I on Jun-08-2011 19:03 |
|
Hi Peter,
There is a problem i m facing.
when i plot a custom indicator(in this case (SMA:SCRIP:S1,1,CLOSE:7) ) on a chart it just
gives me a straight line and not the actual chart.
what could be the problem.
I have used the following code.
FinanceChart m = new FinanceChart(_chartWidth);
....
....
XYChart newChart = m.addLineIndicator(_indicatorHeight, customChartLst[i].data
, customChartLst[i].rgb, customChartLst[i].title);
Attached image shows how it looks
|
Re: Problem while adding custom Indicator in Finance chart |
Posted by Peter Kwan on Jun-09-2011 02:28 |
|
Hi Yogesh,
I suspect that the custom indicator is a straight line because its data is really a straight line.
The customChartLst[i].data should be an array of values. The array length should be the same as the length of the timeStamps array. Each element of the array should contain values.
To diagnose the problem, you may try the following method (in C#):
int arrayLength = customChartLst[i].data.Length;
int timeStampLength = myTimeStamps.Length;
XYChart newChart = m.addLineIndicator(_indicatorHeight, customChartLst[i].data
, customChartLst[i].rgb
, "" + arrayLength + "," + timeStampLength + "," + customChartLst[i].data[arrayLength - 1]);
Now in the legend box, instead of "SMA:SCRIP:S1,1,CLOSE:7", you should see the array length of your custom indicator, the array lenght of your timestamps, and the last value of your custom indicator. You can then verify if those values are correct.
If you need further help, please inform me what is the resulting chart.
Hope this can help.
Regards
Peter Kwan |
Re: Problem while adding custom Indicator in Finance chart |
Posted by Yogesh I on Jun-09-2011 14:59 |
|
Hi Peter,
Thanks!!
The length of timestamp points and the data points are same as i cross verified.
I think the problem was with title. i removed brackets and spaces and it worked.
Check the image i have attached.
There is some problem with my chart i have marked them in red circle.
The y Axis values are overlapping and the line is getting cut why?
|
Re: Problem while adding custom Indicator in Finance chart |
Posted by Peter Kwan on Jun-09-2011 18:46 |
|
Hi Yogesh,
The y-axis values are overlapping because you have removed the y-axis margin (probably using FinanceChart.setYAxisStyle). If you look at the original FinanceChart sample code, you can see the y-axis labels do not overlap, because there is a margin there. The margin causes the top y-axis label to shift downwards.
To solve the problem, please do not remove the y-axis margin, or to use a larger gap between the plot area (see FinanceChart.setPlotAreaBorder).
I think the line is being cut because it is blocked by the legend box. It does not occur in the sample code because there is a y-axis margin, and because legend background is not opaque (it is a semi-transparent color). To solve the problem, please do not remove the y-axis margin, or use a transparent or semi-transparent legend background color.
Hope this can help.
Regards
Peter Kwan |
|