| | | | Browse by category |
Question
How to remove points from a chart?
Answer
Just call the method IlvDefaultDataSet.setData(double[] xValues, double[] yValues, int count) passing the double [] that does not contain the unwanted points.
Here is a code snippet that shows the typical routine:
public void removeOnePoint(int pointIndex)
{
int count= this.getSeries(0).getDataCount();
if (count>0) {
//REMOVE POINT
double XAxis[] = new double[count - 1];
double YAxis[] = new double[count - 1];
for (int i=0; i
XAxis[i] = this.getSeries(0).getXData(i);
YAxis[i] = this.getSeries(0).getYData(i);
}
for (int i=pointIndex+1; i
XAxis[i-1] = this.getSeries(0).getXData(i);
YAxis[i-1] = this.getSeries(0).getYData(i);
}
//UPDATE THE DATA
this.getSeries(0).setData(XAxis, YAxis, count - 1);
}
}
Note: In order to run this sample in JViews 8.7 and later, you must call the ilog.views.util.IlvProductUtil.DeploymentLicenceRequired method with the appropriate argument.