Pre loader

IEnumerable Concat Missing, does not contain a definition for 'Concat'

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

I am trying to implement the DigitalFastLine Series from the example given in ‘http://support.scichart.com/index.php?/Knowledgebase/Article/View/17224/37/how-to-make-line-series-draw-to-the-right-edge-of-the-chart’

public class LinesEnumerable : IEnumerable<Point>
{
    protected readonly IPointSeries _pointSeries;
    protected readonly ICoordinateCalculator<double> _xCoordinateCalculator;
    protected readonly ICoordinateCalculator<double> _yCoordinateCalculator;
    protected readonly bool _isDigitalLine;

    /// <summary>
    /// Initializes a new instance of the <see cref="LinesEnumerable" /> class.
    /// </summary>
    /// <param name="pointSeries">The point series.</param>
    /// <param name="xCoordinateCalculator">The x coordinate calculator.</param>
    /// <param name="yCoordinateCalculator">The y coordinate calculator.</param>
    /// <param name="isDigitalLine">if set to <c>true</c> return a digital line .</param>
    public LinesEnumerable(IPointSeries pointSeries, ICoordinateCalculator<double> xCoordinateCalculator, ICoordinateCalculator<double> yCoordinateCalculator, bool isDigitalLine)
    {
        _pointSeries = pointSeries;
        _xCoordinateCalculator = xCoordinateCalculator;
        _yCoordinateCalculator = yCoordinateCalculator;
        _isDigitalLine = isDigitalLine;
    }

    /// <summary>
    /// Returns an enumerator that iterates through a collection.
    /// </summary>
    /// <returns>
    /// An <see cref="T:System.Collections.IEnumerator" /> object that can be used to iterate through the collection.
    /// </returns>
    public virtual IEnumerator<Point> GetEnumerator()
    {
        return _isDigitalLine ?
            (IEnumerator<Point>)new DigitalLinesIterator(_pointSeries, _xCoordinateCalculator, _yCoordinateCalculator) :
            new LinesIterator(_pointSeries, _xCoordinateCalculator, _yCoordinateCalculator);
    }

    /// <summary>
    /// Returns an enumerator that iterates through a collection.
    /// </summary>
    /// <returns>
    /// An <see cref="T:System.Collections.IEnumerator" /> object that can be used to iterate through the collection.
    /// </returns>
    IEnumerator IEnumerable.GetEnumerator()
    {
        return GetEnumerator();
    }
}

However, when I try to do the following:

linesEnumerable = linesEnumerable.Concat(new[] { new Point(viewportWidth, lastYCoordinate) });

it says ‘System.Collections.IEnumerable’ does not contain a definition for ‘Concat’ and the best extension method overload ‘System.Linq.Queryable.Concat(System.Linq.IQueryable, System.Collections.Generic.IEnumerable)’ has some invalid arguments

I already have System.Linq and Collections namespace added

using System;
using System.Data;
using System.Linq;
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Abt.Controls.SciChart;
using Abt.Controls.SciChart.Model.DataSeries;
using Abt.Controls.SciChart.Utility;
using Abt.Controls.SciChart.Visuals;
using Abt.Controls.SciChart.Visuals.Axes;
using Abt.Controls.SciChart.Visuals.RenderableSeries;
using System.Globalization;
using System.Windows.Data;
using Abt.Controls.SciChart.Rendering.Common;
using Abt.Controls.SciChart.Numerics.CoordinateCalculators;

What’s going on here? Can you improve your sample?

Thanks!

  • You must to post comments
0
0

Hi, Ive managed to figure it out…
You may want to update your code though to avoid others confused with it

Thanks

it should be as follows, ‘< Point >’ was missing infront of ‘as IEnumerable’:

 protected override void InternalDraw(IRenderContext2D renderContext, IRenderPassData renderPassData)
        {
            var pointSeries = CurrentRenderPassData.PointSeries;

            // Collate data into points (x1, y1, x2, y2 ...)
            var linesEnumerable = new LinesEnumerable(pointSeries, renderPassData.XCoordinateCalculator, renderPassData.YCoordinateCalculator, IsDigitalLine) as IEnumerable<Point>;

            // New Code here
            if (DrawLineToEnd)
            {
                var dataToRender = renderPassData.PointSeries;
                double viewportWidth = this.GetParentSurface().RenderSurface.ActualWidth;
                double lastYDataValue = dataToRender[dataToRender.Count - 1].Y;
                double lastYCoordinate = renderPassData.YCoordinateCalculator.GetCoordinate(lastYDataValue);

                linesEnumerable = linesEnumerable.Concat(new[] { new Point(viewportWidth, lastYCoordinate) });
            }

            using (var pen = renderContext.CreatePen(SeriesColor, AntiAliasing, StrokeThickness, Opacity, StrokeDashArray))
            {
                renderContext.DrawLines(pen, linesEnumerable);
            }
        }
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies