public void AddSeries <T>(DataSeries <T> Series) { if (this.Chart.Series.Count == 0) { this.Chart.AxisY.Clear(); } LiveCharts.Wpf.Axis Y = new LiveCharts.Wpf.Axis() { Title = Series.AxisLabel }; this.Chart.AxisY.Add(Y); GLineSeries ChartSeries = new GLineSeries(Series.GetMapper()) { Values = Series.Data, Stroke = UIHelper.ScarletColour, Fill = UIHelper.ScarletBackColour, PointGeometry = null }; this.Chart.Series.Add(ChartSeries); object[] AllSeries = DataHandler.GetSeries(); if (AllSeries.Contains(Series)) { this.SeriesIndexList.Add(Array.IndexOf(AllSeries, Series)); } }
public void AddSeries(Interfaces.IIsChartSeries series) { series.ChangedData += ItemChanged; series.NewData += ItemAdded; series.DataCleared += ItemsCleared; _SeriesSource.Add(series); switch (series.SeriesType) { case "Candle": LiveCharts.Wpf.OhlcSeries chartseries = new LiveCharts.Wpf.OhlcSeries(); chartseries.Title = series.SeriesLabel; chartseries.Values = new LiveCharts.ChartValues <LiveCharts.Defaults.OhlcPoint>(); LiveCharts.Wpf.Axis axis = new LiveCharts.Wpf.Axis() { Title = series.YAxisLabel, ShowLabels = true }; Chart.AxisY.Add(axis); chartseries.ScalesYAt = Chart.AxisY.IndexOf(axis); Chart.Series.Add(chartseries); break; case "Line": LiveCharts.Wpf.LineSeries chartseriesline = new LiveCharts.Wpf.LineSeries(); chartseriesline.Title = series.SeriesLabel; chartseriesline.Values = new LiveCharts.ChartValues <double>(); chartseriesline.PointGeometry = null; LiveCharts.Wpf.Axis axisline = new LiveCharts.Wpf.Axis() { Title = series.YAxisLabel, ShowLabels = true }; Chart.AxisY.Add(axisline); chartseriesline.ScalesYAt = Chart.AxisY.IndexOf(axisline); Chart.Series.Add(chartseriesline); break; case "Column": LiveCharts.Wpf.ColumnSeries chartseriescolumn = new LiveCharts.Wpf.ColumnSeries(); chartseriescolumn.Title = series.SeriesLabel; chartseriescolumn.Values = new LiveCharts.ChartValues <double>(); LiveCharts.Wpf.Axis axiscolumn = new LiveCharts.Wpf.Axis() { Title = series.YAxisLabel, ShowLabels = true }; Chart.AxisY.Add(axiscolumn); chartseriescolumn.ScalesYAt = Chart.AxisY.IndexOf(axiscolumn); Chart.Series.Add(chartseriescolumn); break; case "Bar": default: break; } }
public CryptoChart() { InitializeComponent(); Chart.Series = new LiveCharts.SeriesCollection(); LiveCharts.Wpf.Axis xaxis = new LiveCharts.Wpf.Axis() { Title = "Time", ShowLabels = true }; xaxis.Labels = new[] { "" }; Chart.AxisX.Add(xaxis); Chart.AxisY.Clear(); Chart.Zoom = LiveCharts.ZoomingOptions.None; Chart.Pan = LiveCharts.PanningOptions.None; }
public ChartInstance(CartesianChart Chart, ListBox Chooser) { this.Chart = Chart; this.DataChooser = Chooser; this.Chart.AnimationsSpeed = TimeSpan.FromMilliseconds(100); LiveCharts.Wpf.Axis X = new LiveCharts.Wpf.Axis() { LabelFormatter = value => new DateTime((long)value).ToString("T") }; this.Chart.AxisX.Add(X); this.Chart.AxisY.Clear(); this.Chart.DisableAnimations = true; this.Chart.AllowDrop = true; }