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
 ChartConstants.rBadDataValue displays temp line
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

johnbutler

23 Posts

Posted - 09 Nov 2005 :  09:53:28  Show Profile  Reply with Quote
I am trying to show breaks in data sets on a dynamic chart. I am using the SimpleDataset class to hold the data. When I set a point's x or y value to ChartConstants.rBadDataValue to make that point not valid, the chart temporarily displays a line off the graph. Is there another way to specify a point as not valid and thereby show a break in the series?

quinncurtis

1164 Posts

Posted - 09 Nov 2005 :  10:10:33  Show Profile  Reply with Quote
Use the datasets setValidData method.

For example, mark the data point an index 23 as bad.

dataset1.setValidData(23, false);
Go to Top of Page

johnbutler

23 Posts

Posted - 09 Nov 2005 :  11:10:18  Show Profile  Reply with Quote
When I do the following, the series line temporarily goes to 0.

datasets[i].addDataPoint(0, time); datasets[i].setValidData(datasets[i].getNumberDatapoints()-1, false);
Go to Top of Page

quinncurtis

1164 Posts

Posted - 09 Nov 2005 :  12:57:02  Show Profile  Reply with Quote
We cannot reproduce the problem you describe.

See if you can reproduce the problem by modifying one of our example programs, say the MultiLine class in the Multiline example program. That's what we did, updating the graphs dataset incrementally using a timer, marking every 10th data point invalid, and we could not see any of the lines going to zero. The update routine looks like:

void updateChart()
   {  double y[] = new double[numGroups];
    
       int j;
      double x =  (double)count * 0.2;
      for (j = 0; j < numGroups; j++)
         y[j] = (double) 5 * j;

      Dataset1.addGroupDataPoints(x, y);
      if ((count % 10) == 0)
      {
        Dataset1.setValidData(count-1, false);
        gWG.updateDraw();
      }
      count++;
   }
Go to Top of Page

johnbutler

23 Posts

Posted - 10 Nov 2005 :  07:41:58  Show Profile  Reply with Quote
The multiline example I have is not dynamic and doesn't have an updateChart method. I tried modifying the example dynamiccharts.

I modified MixedPlotDynamic as follows:


int count = 0;
void updateDynGraph()
{ double y[];
int i;
count++;

...
...

Dataset4.setDataPoint(numPoints-1, 10.0 * numPoints, 40 + 20 * (0.5 - Math.random()));

if (count%5 == 0)
//Dataset3.setValidData(numPoints-1, false);
Dataset3.setDataPoint(numPoints-1, 10.0 * numPoints,
ChartConstants.rBadDataValue);


gWG.repaint();
}

I also modified the timer to be 500ms to allow me to see the effect. First, when I used setValidData I did not see a break in the line (series) that I was exepecting. Second, when I used rBadDataValue, the line temporarily flashed up to infinity but then showed the break.
Go to Top of Page

quinncurtis

1164 Posts

Posted - 10 Nov 2005 :  08:33:36  Show Profile  Reply with Quote
Your example looks wrong. The code that you have will only affect the last point, since the value of numPoints is fixed. We changed it to

    Dataset1.setDataPoint(numPoints-1, 10.0 * numPoints,  20 + 20 * (0.5 - Math.random()));
    Dataset2.setDataPoint(numPoints-1, 10.0 * numPoints, 30 + 15 * (0.5 - Math.random()));
    Dataset3.setDataPoint(numPoints-1, 10.0 * numPoints, 50 + 20 * (0.5 - Math.random()));
    for (i=0; i < numPoints; i++)
    {
      if ((i % 5) == 0)
	    Dataset3.setValidData(i, false);
    }
    Dataset4.setDataPoint(numPoints-1, 10.0 * numPoints, 40 + 20 * (0.5 - Math.random()));


and it showed breaks in the line as we expect.
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