using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using System.Globalization;
using C1.Xaml.Chart;

namespace TileViewSamples
{
    static class Helper
    {
        public static void AddChartSeries(C1Chart chart, string values, string label)
        {
            if (chart == null || string.IsNullOrEmpty(values))
                return;
            string[] strValues = values.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            if (strValues.Length == 0)
                return;
            DataSeries ds = new DataSeries();
            if (label != null)
                ds.Label = label;
            DoubleCollection dsValues = new DoubleCollection();
            foreach (string curStrVal in strValues)
            {
                dsValues.Add(double.Parse(curStrVal, CultureInfo.InvariantCulture));
            }
            ds.Values = dsValues;
            chart.Data.Children.Add(ds);
        }
    }
}
