private void GetCurrencyDevationChart(Context context) { chart = new SfChart(context); chart.Title.Text = "1 USD to INR form 1977 to 2019"; chart.Title.TextSize = 15; chart.SetBackgroundColor(Color.White); chart.Legend.Visibility = Visibility.Visible; chart.Legend.DockPosition = ChartDock.Top; chart.Legend.IconHeight = 14; chart.Legend.IconWidth = 14; chart.Legend.Orientation = ChartOrientation.Vertical; chart.ColorModel.ColorPalette = ChartColorPalette.Natural; NumericalAxis numericalaxis = new NumericalAxis(); numericalaxis.LineStyle.StrokeWidth = 0; numericalaxis.MajorTickStyle.TickSize = 0; numericalaxis.Title.Text = "Rupees against Dollars"; numericalaxis.LabelStyle.LabelFormat = "₹##"; chart.SecondaryAxis = numericalaxis; DateTimeAxis primaryAxis = new DateTimeAxis(); primaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Center; primaryAxis.ShowMajorGridLines = false; primaryAxis.Title.Text = "Years"; primaryAxis.ShowMinorGridLines = false; primaryAxis.IntervalType = DateTimeIntervalType.Years; primaryAxis.Interval = 5; chart.PrimaryAxis = primaryAxis; splineSeries1 = new SplineSeries(); splineSeries1.XBindingPath = "Date"; splineSeries1.YBindingPath = "YValue"; splineSeries1.ItemsSource = MainPage.GetTrendlineDataSource1(); splineSeries1.Label = "Rupees"; splineSeries1.LegendIcon = ChartLegendIcon.SeriesType; splineSeries1.DataMarker.ShowMarker = true; splineSeries1.DataMarker.ShowLabel = false; splineSeries1.DataMarker.MarkerHeight = 5; splineSeries1.DataMarker.MarkerWidth = 5; splineSeries1.DataMarker.MarkerStrokeWidth = 2; splineSeries1.DataMarker.MarkerStrokeColor = Color.ParseColor("#00bdae"); splineSeries1.Trendlines = new ChartTrendlineCollection(); linearTrendline = new ChartTrendline() { Type = ChartTrendlineType.Linear, StrokeColor = new Color(201, 23, 97), LegendIcon = ChartLegendIcon.SeriesType, VisibilityOnLegend = Visibility.Visible, Label = "Linear", }; splineSeries1.Trendlines.Add(linearTrendline); chart.Series.Add(splineSeries1); }
private void GetMeterDevationChart(Context context) { chart2 = new SfChart(context); chart2.Title.Text = "Distance Measurement"; chart2.Title.TextSize = 15; chart2.SetBackgroundColor(Color.White); chart2.Legend.Visibility = Visibility.Visible; chart2.Legend.DockPosition = ChartDock.Top; chart2.Legend.IconHeight = 14; chart2.Legend.IconWidth = 14; chart2.ColorModel.ColorPalette = ChartColorPalette.Natural; NumericalAxis numericalaxis = new NumericalAxis(); numericalaxis.LineStyle.StrokeWidth = 0; numericalaxis.MajorTickStyle.TickSize = 0; numericalaxis.Title.Text = "Meters"; chart2.SecondaryAxis = numericalaxis; NumericalAxis primaryAxis = new NumericalAxis(); primaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Center; primaryAxis.ShowMajorGridLines = false; primaryAxis.Title.Text = "Seconds"; primaryAxis.ShowMinorGridLines = false; chart2.PrimaryAxis = primaryAxis; splineSeries2 = new SplineSeries(); splineSeries2.ItemsSource = MainPage.GetTrendlineDataSource2(); splineSeries2.XBindingPath = "XValue"; splineSeries2.YBindingPath = "YValue"; splineSeries2.Label = "Rupees"; splineSeries2.LegendIcon = ChartLegendIcon.SeriesType; splineSeries2.DataMarker.ShowMarker = true; splineSeries2.DataMarker.ShowLabel = false; splineSeries2.DataMarker.MarkerHeight = 5; splineSeries2.DataMarker.MarkerWidth = 5; splineSeries2.DataMarker.MarkerStrokeWidth = 2; splineSeries2.DataMarker.MarkerStrokeColor = Color.ParseColor("#00bdae"); splineSeries2.Trendlines = new ChartTrendlineCollection(); powerTrendline = new ChartTrendline() { Type = ChartTrendlineType.Power, StrokeColor = new Color(201, 23, 97), LegendIcon = ChartLegendIcon.SeriesType, VisibilityOnLegend = Visibility.Visible, Label = "Power", }; splineSeries2.Trendlines.Add(powerTrendline); chart2.Series.Add(splineSeries2); }
public IActionResult TrendLines() { List <ChartTrendline> lines = new List <ChartTrendline>(); ChartTrendline line = new ChartTrendline(); line.Type = TrendlineTypes.Linear; line.Width = 3; line.Name = "Linear"; line.Fill = "#C64A75"; lines.Add(line); ViewBag.trendLines = lines; ViewBag.type = new String[] { "Linear", "Exponential", "Power", "Logarithmic", "Polynomial", "MovingAverage" }; return(View()); }
private void GetMeterDevationChart(Context context) { meterDevitionChart = new SfChart(context); meterDevitionChart.Title.Text = "Distance Measurement"; meterDevitionChart.Title.TextSize = 15; meterDevitionChart.SetBackgroundColor(Color.White); meterDevitionChart.ColorModel.ColorPalette = ChartColorPalette.Natural; NumericalAxis numericalaxis = new NumericalAxis(); numericalaxis.LineStyle.StrokeWidth = 0; numericalaxis.MajorTickStyle.TickSize = 0; numericalaxis.Title.Text = "Meters"; meterDevitionChart.SecondaryAxis = numericalaxis; NumericalAxis primaryAxis = new NumericalAxis(); primaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Center; primaryAxis.ShowMajorGridLines = false; primaryAxis.Title.Text = "Seconds"; primaryAxis.ShowMinorGridLines = false; meterDevitionChart.PrimaryAxis = primaryAxis; splineSeries2 = new ColumnSeries(); splineSeries2.ItemsSource = MainPage.GetPowerTrendlineDataSource(); splineSeries2.XBindingPath = "XValue"; splineSeries2.YBindingPath = "YValue"; splineSeries2.Label = "Rupees"; splineSeries2.LegendIcon = ChartLegendIcon.SeriesType; meterDevitionChart.Series.Add(splineSeries2); powerTrendline = new ChartTrendline() { Type = ChartTrendlineType.Power, StrokeColor = new Color(64, 64, 65), LegendIcon = ChartLegendIcon.SeriesType, VisibilityOnLegend = Visibility.Visible, Label = "Power", }; splineSeries2.Trendlines = new ChartTrendlineCollection() { powerTrendline }; }
private void GetSalseDevationChart(Context context) { salesDeviationChart = new SfChart(context); salesDeviationChart.Title.Text = "Average Sales Comparison"; salesDeviationChart.Title.TextSize = 15; salesDeviationChart.SetBackgroundColor(Color.White); salesDeviationChart.ColorModel.ColorPalette = ChartColorPalette.Natural; DateTimeAxis primaryAxis = new DateTimeAxis(); primaryAxis.Title.Text = "Months"; primaryAxis.ShowMinorGridLines = false; primaryAxis.ShowMinorGridLines = false; primaryAxis.IntervalType = DateTimeIntervalType.Months; primaryAxis.Interval = 1; primaryAxis.MajorTickStyle.StrokeWidth = 0; primaryAxis.LabelStyle.LabelFormat = "MMM"; salesDeviationChart.PrimaryAxis = primaryAxis; numericalaxis = new NumericalAxis(); numericalaxis.LineStyle.StrokeWidth = 0; numericalaxis.MajorTickStyle.TickSize = 0; numericalaxis.Title.Text = "Number of Customer"; numericalaxis.LineStyle.StrokeColor = Color.Transparent; salesDeviationChart.SecondaryAxis = numericalaxis; salesColumnSeries = new ColumnSeries(); salesColumnSeries.XBindingPath = "Date"; salesColumnSeries.YBindingPath = "YValue"; salesColumnSeries.ItemsSource = MainPage.GetTrendlineDataSource("Linear"); salesColumnSeries.Label = "Sales"; salesColumnSeries.LegendIcon = ChartLegendIcon.SeriesType; salesDeviationChart.Series.Add(salesColumnSeries); linearTrendline = new ChartTrendline() { Type = ChartTrendlineType.Linear, StrokeColor = new Color(64, 64, 65), Label = "Linear", }; salesColumnSeries.Trendlines = new ChartTrendlineCollection() { linearTrendline }; }
// GET: Trendlines public ActionResult Trendlines() { ViewBag.majorGridLines = new { width = 0.00001 }; ViewBag.lineStyle = new { width = 0.000001 }; ViewBag.majorTickLines = new { width = 0.00001 }; ViewBag.marker = new ChartMarkerSettings { Visible = true }; ViewBag.chartBorder = new ChartBorder { Color = "transparent" }; ViewBag.trendlineTypes = new string[] { "Linear", "Exponential", "Power", "Logarithmic", "Polynomial", "MovingAverage" }; List <ChartTrendline> lines = new List <ChartTrendline>(); ChartTrendline line = new ChartTrendline(); line.Type = TrendlineTypes.Linear; line.Width = 3; line.Name = "Linear"; line.Fill = "#C64A75"; lines.Add(line); ViewBag.trendLines = lines; return(View()); }