Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Java
 QCChart2D for Java
 Initializing TimeGroupDataset
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rixmith

26 Posts

Posted - 30 Oct 2009 :  12:12:38  Show Profile  Reply with Quote
I created a OHLCPlot based on a TimeGroupDataset and the example code of DataLoggerView. When I create the dataset using the constructor

TimeGroupDataset(java.lang.String sname, java.util.GregorianCalendar[] x, double[][] y)

everything works perfect. However, when I create the dataset using the default TimeGroupDataset constructor and add the data points one at a time (as is done in the DataLoggerView example) my plot does not show up. As points are added to the dataset I confirmed that the number of points in the dataset is increasing by 1, I can see the scale and the axises being updated correctly on the chart, but no data points are displayed.

When using the default TimeGroupDataset constructor do I have to do some setup before the OHLCPlot will recognize the datapoints?

I notice that the DataLoggerView example preloads some datapoints through the TimeGroupDataset constructor. My question could also be worded as: how would you make the DataLoggerView example work if it had to start with an empty dataset?



Rick

quinncurtis

1164 Posts

Posted - 30 Oct 2009 :  12:48:28  Show Profile  Reply with Quote
You have to establish the number of groups, which is 4 for an OHLC plot. So you can't use the default constructor. Use the constructor below, which specifies 4 groups, and 0 initial data values. Then add each new set of values.

TimeGroupDataset Dataset1 = new TimeGroupDataset("TimeGroupDataset", 4, 0);		
		
for (i = 0; i < nNumPnts; i++) {
  double [] yvalues = {stockPriceData[0][i], stockPriceData[1][i], stockPriceData[2][i], stockPriceData[3][i]};    
  Dataset1.addTimeGroupDataPoints(xValues[i], yvalues);
}
Go to Top of Page

rixmith

26 Posts

Posted - 31 Oct 2009 :  21:47:51  Show Profile  Reply with Quote
Thank you for the quick response.
Works like a charm now.

Rick
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07