|
Issue With Interactive Financial Chart |
Posted by subodh on Sep-08-2010 19:59 |
|
I tried to run JSP Code of Interactive Finacial Chart,it work fine with a ur data which is genrating data by generateRandomData() method FinanceSimulator db = new FinanceSimulator(ticker, startDate, endDate, resolution) ,
But when I changed the data like this
protected void generateRandomData(String ticker, Date startDate, Date endDate,
int resolution)
{
double[] highData1 = {1004, 1003, 1007, 1006, 1004, 1005, 1007, 1003, 1002, 1043, 1071, 1085, 1034, 1031, 1056, 1028, 1080, 1083, 1092, 1013, 1030, 1081, 1072};
double[] lowData1 = {1091, 1091, 1098, 1002, 1098, 1094, 1099, 1058, 1043, 1044, 1062, 1011, 1075, 1062, 1028, 1059, 1012, 1003, 1051, 1027, 1023, 1052, 1012};
double[] openData1 = {1000, 1057, 1093, 1037, 1018, 1021, 1045, 1009, 1059, 1085, 1008, 1048, 1006,1010, 1071, 1080, 1016, 1037, 1070,1072, 1071, 1091,1040};
double[] closeData1 = {1050, 1091, 1026, 1029, 1004, 1053, 1011, 1062, 1087, 1019, 1040, 1016, 1096, 1085, 1006, 1013, 1042, 1067, 1058, 1001, 1088, 1031, 1042};
double[] volData1 = {1.2, 3.5, 12, 3.4, 34.5,12.0,21.89, 12.9,12.8, 5.4, 6.6,7.6,12.0, 19.85, 20.06, 21.13, 21.42, 21.67, 21.58, 22.01, 21.88, 22.31, 22.42};
FinanceSimulator db = new FinanceSimulator(ticker, startDate, endDate, resolution
);
timeStamps = db.getTimeStamps();
highData =highData1; //db.getHighData();
lowData = lowData1; //db.getLowData();
openData =openData1;//db.getOpenData();
closeData =lowData1;//db.getCloseData();
volData = volData1;
}
I m getting issue to Display Chart,can u plz let me know wht can be issue? I m attaching the File.
Thanks
|
Re: Issue With Interactive Financial Chart |
Posted by subodh on Sep-08-2010 20:06 |
|
can anyone tell me wht is the issue when i changed the data chart is not displaying , i m working in this issue from last two days but i m not able to figure out the issue.
Plz Anyone know resolve this issue
Thanks in advance. |
Re: Issue With Interactive Financial Chart |
Posted by Peter Kwan on Sep-08-2010 20:19 |
|
Hi subodh,
The sample code will remove the first N data points (N = the maximum moving average period you need, but will be at least 20). For example, in your screen shot, the sample code will remove at least 25 data points.
It is because to copmute 25 days moving average, you need the previous 25 data points. So for the first 24 data points, no 25 days moving average can be computed. Instead of showing incomplete data, the sample code will remove the first 25 data points. It is expected the code that implements "generateRandomData" will get the data according to the startDate and endDate, which will should contain much more than 25 days if the moving average is 25 days.
In your case, to display the data, please perform one of the follows:
(a) Provide more data.
(b) Modify the sample code so as not to remove the "lead points" (hard coded extraPoints to 0 in FinanceChart.setData).
Hope this can help.
Regards
Peter Kwan |
Re: Issue With Interactive Financial Chart |
Posted by subodh on Sep-08-2010 20:39 |
|
Firstly Thanks to u ,to resolve my issue which was not resolved by me from last two days(Wht i changed? hard coded extraPoints to 0 in FinanceChart.setData).),Next thing i have to ask why the Chart is not displaying in whole Area why it looks too conjusted also y axis is changed to according the data like if max(Highdata)=1250 and min(Lowdata)=900 the y-Axis between 900-1250 or we have to change it manually..I m also attaching the ScreenShot.
Thanks
|
Re: Issue With Interactive Financial Chart |
Posted by Peter Kwan on Sep-09-2010 00:25 |
|
Hi subodh,
You asked "Next thing i have to ask why the Chart is not displaying in whole area?". I assume you are referring to the horizontal area.
ChartDirector does use the whole area. You can see the x-axis labels are from 6 Sept 9:30pm to 8 Sept 4:00pm, and it occurs the whole area (from the left edge to the right edge). The x-coordinates are from your timeStamps array.
The candlesticks stops are around 6 Sept 3:00pm, because you only provide OHLC and volume data up to 6 Sept 3:00pm.
If your want the candlesticks to cover the entire chart, you may:
(a) Add more data, so that there are data up to 8 Sept 4:00pm.
or
(b) Use less timeStamps, so that your timeStamps is only up to 6 Sept 3:00pm.
For the y-axis scale, the scale is automatically determined based on the plots on the chart. It may not be based on the max(Highdata) and min(Lowdata)=900, because there are other things on the chart too. For example, in your chart, there is a Bollinger Band. It happens the top/bottom points of the BollingerBand are higher/lower than your data, so they will be used to determine the axis scale.
Hope this can help.
Regards
Peter Kwan |
|