private void UpdateTrailSeries(Series series, IEnumerable <DataPoint> dataSource) { ScatterSplineSeries trailSeries = series.Tag as ScatterSplineSeries; if (trailSeries != null) { trailSeries.Brush = series.ActualBrush; trailSeries.MarkerBrush = series.ActualBrush; trailSeries.ItemsSource = dataSource; } }
private ScatterSplineSeries CopySeries(BubbleSeries series) { ScatterSplineSeries trailSeries = new ScatterSplineSeries(); trailSeries.MarkerType = MarkerType.None; trailSeries.YMemberPath = series.YMemberPath; trailSeries.XMemberPath = series.XMemberPath; trailSeries.TransitionDuration = series.TransitionDuration; trailSeries.Title = series.Title; trailSeries.XAxis = series.XAxis; trailSeries.YAxis = series.YAxis; MotionDataSource <DataPoint> ds = new MotionDataSource <DataPoint>(); trailSeries.ItemsSource = ds; return(trailSeries); }
private void InitializeSeries(string name, int dataOrder, IEnumerable dataSource = null) { BubbleSeries motionSeries = new BubbleSeries(); motionSeries.Name = this.GetSeriesName(dataOrder); motionSeries.YMemberPath = this.SeriesYMemberPath; motionSeries.XMemberPath = this.SeriesXMemberPath; motionSeries.RadiusMemberPath = this.SeriesRadiusMemberPath; motionSeries.TransitionDuration = this.TransitionDuration; motionSeries.TransitionEasingFunction = this.TransitionFunction; motionSeries.Title = name; motionSeries.XAxis = this.Chart.FindName(XAxisName) as NumericXAxis; motionSeries.YAxis = this.Chart.FindName(YAxisName) as NumericYAxis; motionSeries.MarkerTemplate = this.MarkerTemplate; if (this.ChartLegend != null) { motionSeries.Legend = this.ChartLegend; } if (this.LegendItemTemplate != null) { motionSeries.LegendItemTemplate = this.LegendItemTemplate; } // adding the single data point that will be changed in order to be animated over time List <MotionDataPoint> newDataSource = new List <MotionDataPoint>(); newDataSource.Add(new MotionDataPoint { ValueX = 0, ValueY = 0, ValueR = 0 }); motionSeries.ItemsSource = newDataSource; if (dataSource != null) { motionSeries.ItemsSource = dataSource; } ScatterSplineSeries trailSeries = CopySeries(motionSeries); trailSeries.Thickness = 2; motionSeries.Tag = trailSeries; this.Chart.Series.Add(trailSeries); this.Chart.Series.Add(motionSeries); }
/// <summary> /// Initializes a new instance of the ScatterSplineSeriesAutomationPeer class. /// </summary> public ScatterSplineSeriesAutomationPeer(ScatterSplineSeries owner) : base(owner) { }
public ScatterSplineSeriesPage() { InitializeComponent(); var grid = new CartesianChartGrid(); var model = new MainViewModel(); model.Data1 = MainViewModel.GetNumericData2(20, 30, 3, (i) => 60 * i + 450, (i) => 20 * (Math.Sin(0.13 * i)) + 6); model.Data2 = MainViewModel.GetNumericData2(20, 30, 5, (i) => 60 * i + 450, (i) => 20 * (Math.Sin(0.13 * i)) + 6, true); var chart = new Telerik.XamarinForms.Chart.RadCartesianChart { VerticalAxis = new Telerik.XamarinForms.Chart.NumericalAxis(), HorizontalAxis = new Telerik.XamarinForms.Chart.NumericalAxis() { LabelFitMode = Telerik.XamarinForms.Chart.AxisLabelFitMode.MultiLine, }, Grid = grid, }; grid.MajorLinesVisibility = GridLineVisibility.XY; grid.MajorYLineDashArray = Device.OnPlatform(null, new double[] { 4, 2 }, new double[] { 4, 2 }); grid.MajorXLineDashArray = Device.OnPlatform(null, new double[] { 4, 2 }, new double[] { 4, 2 }); grid.MajorLineColor = Color.FromHex("D3D3D3"); grid.MajorLineThickness = Device.OnPlatform(0.5, 2, 2); var series = new ScatterSplineSeries(); series.ItemsSource = model.Data1; series.XValueBinding = new PropertyNameDataPointBinding { PropertyName = "XData" }; series.YValueBinding = new PropertyNameDataPointBinding { PropertyName = "YData" }; chart.Series.Add(series); var series1 = new ScatterSplineSeries(); series1.ItemsSource = model.Data2; series1.XValueBinding = new PropertyNameDataPointBinding { PropertyName = "XData" }; series1.YValueBinding = new PropertyNameDataPointBinding { PropertyName = "YData" }; chart.Series.Add(series1); this.Content = chart; }