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
 TimeCoordinates autoScale problem...
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

javaman

22 Posts

Posted - 28 Jun 2009 :  19:43:12  Show Profile  Reply with Quote
Hi,

I'm using a TimeCoordinates attached to a ChartView that seems to be getting stuck when doing an autoScale call. It'll just sit there for a minute or two (literally) hanging the UI and then it'll come back. There's no ryhme or reason that I can assertain. I'd like some advice on things to look for:

I pass in a datasetArray that's initially configured with 10 datasets with a maximum of 300 points of time data points. I've ensured that the time values were increasing after I discovered that sometimes the data in the datasets would start with inccreasing time and then sometimes jump back in time - causing a loop in the autoScale call that couldn't recover.

I've scrubbed the data till I'm certain that it's always increasing in time - and that the y values are valid double values.

Now, granted there are 10 datasets - that could update at anytime - so I've put a synchronized lock on the TimeCoordinates object to ensure that no two threads are accessing it or the data at the same time.

Nothing works - it still occaisionally hangs.

Oh, I've followed the example from the dynamicCharts - the MixedPlotDynamics code - and found an interesting problem. In that example, all you do is add the new points to the datasets, and then call repaint on the chartView - but if I do that with mine (without calling autoScale on the TimeCoordinates object) - my graphs disappear and don't come back - I have to autoscale every time my data changes.

So, can you send me some gotcha's or something to help point the way to get rid of this problem?

If you need code, please let me know - thanx.

peace. JOe...

Thanx - Joe!

quinncurtis

1164 Posts

Posted - 29 Jun 2009 :  09:25:19  Show Profile  Reply with Quote
Backtracking x time values should not cause the auto-scaling routines to hang like you describe. In any event, you can just call the dataset sortByX(true) method which will make the x-values always increasing. What could cause the problem is invalid time/date values. You should try and isolate the problem, by auto-scaling the datasets one by one, and trying to identify the dataset(s) that cause the problem. If you are still unable to identify why the data won't auto-scale, you should send the bad dataset(s) to us in a text file.


The MixedPlotDynamics is not a scrolling time graph with always increasing x-values. The range of x-values never changes, and the x-scale never changes. The y-values are shifted down one array index element with each update, creating the appearance of scrolling data. So it is very different than what you have. I would expect that if you are not constantly re-scaling the x-scale for the new data, the graph would appear to stop updating. You would be better off using the DataloggerView example, which is time based and the x-values always increase. The new x- and y-scale are auto-scaled with each update, and the axis and axis labels autocalc'd for the new ranges.


    Dataset1.addTimeGroupDataPoints(xvalue,temp);
    xValues = Dataset1.getTimeXData();
    nNumPnts = Dataset1.getNumberDatapoints();
    pTransform1.autoScale(Dataset1,ChartConstants.AUTOAXES_NEAR,  ChartConstants.AUTOAXES_NEAR);
    if (fixedStartTimeFlag)
      pTransform1.setTimeScaleStart(xValues[0]); // peg start of graph at start of data
    else // Set a 100 point view into data
      pTransform1.setTimeScaleStart(Dataset1.getTimeXDataValue(Dataset1.getNumberDatapoints()-100));

     xAxis1.calcAutoAxis();
     yAxis1.calcAutoAxis();
     xAxisLab1.calcAutoAxisLabels();
     yAxisLab1.calcAutoAxisLabels();
Go to Top of Page

javaman

22 Posts

Posted - 29 Jun 2009 :  13:30:43  Show Profile  Reply with Quote
Some excellent ideas - thanx.

Unfortunately, I can't just resort the data - it's telemetry based - and it's what's coming off the wire - so I don't know if the backtracking data can be resorted or not.

2) The idea of doing the autoScale dataset by dataset and see where it occurs is good. I'll give that a try - hadn't thought about that.

BTW, I do use your method checkValidData() for each and every point in the dataset - none get in that fail that test (or I can merely mark it as false in the setValidData() method...

Thanx - I'll keep you posted.

Thanx - Joe!
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