 # FIFO Chart based on X axis data

0
0

Hi,

I am creating a live chart chromatogram with x-axis as time and y-axis as frequency.

Also, I need to show a chart with the last 5 min of data on the y-axis. for that purpose, we have used “FIFOCapacity” property of DataSeries which hold data for last 5 min which is work perfectly, because there is only single value of y with repect to time.

eg,
x=>1 2 3 4 5 6
y=>3 5 6 3 3 2

With FIFOcapacity=5 in the above example when 6 come to collection 1 is get removed which is expected

FIFO chart is not working when multiple y value is present for a single x value.

eg,
x=>1 2 2 2 3 3 3 4 5 6
y=>3 5 6 3 3 2 5 5 6 1

With FIFOcapacity=5 in the above example when x value 3 come into the collection 1 is get removed from the collection which not expected. (only when 6 (x value) get into collection then 1 get removed is expected)

Could please suggest me any solution if available. Please let me know if there is any information required.

Note: basically I need FIFOCapacity with condition check attributes. I need to clear collection if there is no need of that values because the collection can contain any number of values.

Version
5.3.0.11954
• You must to post comments
0
0

Hi Ganesh,

I investigated this today and was unable to reproduce what you’re seeing here. Here is my unit test code (using v5.4.0 of SciChart)

``````    [Test]
public void ShouldTrimFifoBufferWhenXValuesAreDuplicated()
{
var dataSeries = new XyDataSeries<double, double>();
dataSeries.FifoCapacity = 5;

var xValues = new double[] { 1,2,2,2,3,3,3,4,5,6 };
var yValues = new double[] { 3,5,6,3,3,2,5,5,6,1 };

for (int i = 0; i < xValues.Length; i++)
{
dataSeries.Append(xValues[i], yValues[i]);

Console.WriteLine(\$"i = {i}\r\n" +
\$"xValues={string.Join(",", dataSeries.XValues.Select(x => x))}\r\n" +
\$"yValues={string.Join(",", dataSeries.YValues.Select(x => x))}");

if (i < 5)
{
Assert.That(dataSeries.Count, Is.EqualTo(i + 1), "Incorrect count before FIFOCapacity reached");
CollectionAssert.AreEqual(dataSeries.XValues, xValues.Take(i+1));
CollectionAssert.AreEqual(dataSeries.YValues, yValues.Take(i + 1));
}
else
{
Assert.That(dataSeries.Count, Is.EqualTo(5), "Incorrect count after FIFOCapacity reached");
CollectionAssert.AreEqual(dataSeries.XValues, xValues.Skip(i+1-5).Take(5));
CollectionAssert.AreEqual(dataSeries.YValues, yValues.Skip(i+1-5).Take(5));
}
}
}
``````

The output window of this unit test reports the following.

``````i = 0
xValues=1
yValues=3
i = 1
xValues=1,2
yValues=3,5
i = 2
xValues=1,2,2
yValues=3,5,6
i = 3
xValues=1,2,2,2
yValues=3,5,6,3
i = 4
xValues=1,2,2,2,3
yValues=3,5,6,3,3
i = 5
xValues=2,2,2,3,3
yValues=5,6,3,3,2
i = 6
xValues=2,2,3,3,3
yValues=6,3,3,2,5
i = 7
xValues=2,3,3,3,4
yValues=3,3,2,5,5
i = 8
xValues=3,3,3,4,5
yValues=3,2,5,5,6
i = 9
xValues=3,3,4,5,6
yValues=2,5,5,6,1
``````

are you 100% sure you have tested the FIFO series correctly?

Secondly, if you need to remove values from DataSeries based on a variable ‘FifoCapacity’ you can simply use DataSeries.Remove, for example:

``````        var dataSeries = new XyDataSeries<double, double>();

dataSeries.Append(x,y);
if (dataSeries.Count > someValue)
{
dataSeries.RemoveAt(0);
}
``````

Best regards,
Andrew

• You must to post comments
Showing 1 result