I followed this link to bind data to view .But I am unable to display results using CompositeDataSource uisng MVVM.
pixelX = new double[grayScaleData.Length];
grayLevelY = new double[grayScaleData.Length];
for (int i = 0; i < grayScaleData.Length; i++)
{
pixelX[i] = i;
grayLevelY[i] = grayScaleData[i];
if (i >= (leftEdge + avgGrayoffset) && i <= (rightEdge - avgGrayoffset))
{
totalGrayScale += grayScaleData[i];
totalPixels++;
}
}
EnumerableDataSource<double> xSrc = new EnumerableDataSource<double>(pixelX);
xSrc.SetXMapping(x => x);
grayScaleDataSource = new EnumerableDataSource<double>(grayLevelY);
grayScaleDataSource.SetYMapping(y => y);
CompositeDataSource source= new CompositeDataSource(xSrc, grayScaleDataSource);
for (int i = 0; i < grayScaleData.Length; i++)
{
//here I am not able to convert a CompositeDataSource to a point source
// list.Add(new Point(??,??));
}
GrayScalePlotData = new ObservableDataSource<Point>(list);
using just a Point
I am able to see some random plot
list.Add(new Point(pixelX[i], grayLevelY[i]));
can anyone suggest what is the better way to do it?