public TitleAndLegendSample() { InitializeComponent(); Title = AppResources.LegendSampleTitle; this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); }
public StylingSeriesSample() { InitializeComponent(); Title = AppResources.StylingSeriesTitle; this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); }
public GettingStartedSample() { InitializeComponent(); Title = AppResources.GettingStartedTitle; flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); }
public FinancialChart() { InitializeComponent(); Title = AppResources.FinancialChartTitle; List <Color> CustomPalette = new List <Color> { Color.FromHex("#3F51B5") }; this.flexChart.CustomPalette = CustomPalette; this.flexChart.Palette = Palette.Custom; this.flexChart.ItemsSource = ChartSampleFactory.FinancialData(); this.flexChart.ChartType = ChartType.Candlestick; this.flexChart.LegendPosition = ChartPositionType.None; this.flexChart.AxisY.MajorGridStyle.Fill = Color.FromRgba(50, 50, 50, 20); this.flexChart.AxisX.Format = "MM/dd/yyyy"; this.flexChart.AxisY.AxisLine = false; this.pickerChartType.Items.Add(ChartType.Candlestick.ToString()); this.pickerChartType.Items.Add(ChartType.HighLowOpenClose.ToString()); this.pickerChartType.SelectedIndex = 0; this.flexChart.AnimationMode = C1.Xamarin.Forms.Chart.AnimationMode.Point; C1Animation loadAnimation = new C1Animation(); loadAnimation.Duration = new TimeSpan(1000 * 10000); loadAnimation.Easing = Xamarin.Forms.Easing.CubicInOut; this.flexChart.LoadAnimation = loadAnimation; }
public SelectionModesSample() { InitializeComponent(); Title = AppResources.SelectionModesTitle; this.lblChartType.Text = AppResources.ChartType; this.lblSelectionMode.Text = AppResources.SelectionMode; this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); //Device.OnPlatform(Android: () => // this.flexChart.SelectedDashes = new double[] { 15, 5 } // ); //Device.OnPlatform(WinPhone: () => // this.flexChart.SelectedDashes = new double[] { 3, 1 } // ); //Device.OnPlatform(iOS: () => // this.flexChart.SelectedDashes = new double[] { 7.5, 2.5 } // ); this.pickerChartType.Items.Add(ChartType.Column.ToString()); this.pickerChartType.Items.Add(ChartType.Bar.ToString()); this.pickerChartType.Items.Add(ChartType.Scatter.ToString()); this.pickerChartType.Items.Add(ChartType.Line.ToString()); this.pickerChartType.Items.Add(ChartType.LineSymbols.ToString()); this.pickerChartType.Items.Add(ChartType.Area.ToString()); foreach (var item in Enum.GetNames(typeof(ChartSelectionModeType))) { this.pickerSelectionMode.Items.Add(item); } this.pickerChartType.SelectedIndex = 0; this.pickerSelectionMode.SelectedIndex = 1; }
public MixedChartTypesSample() { InitializeComponent(); Title = AppResources.MixedChartTypesTitle; this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); }
public BubbleChartSample() { InitializeComponent(); Title = AppResources.BubbleChartTitle; this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); //this.flexChart.LegendPosition = C1.Xamarin.Forms.Chart.ChartPositionType.Bottom; }
public TreeMapSample() { InitializeComponent(); Title = AppResources.TreeMapTitle; treeMap.ItemsSource = ChartSampleFactory.CreateHierarchicalData(); treeMap.ChartType = TreeMapType.Squarified; }
public ToggleSeriesSample() { InitializeComponent(); Title = AppResources.ToggleSeriesTitle; this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); this.flexChart.Palette = Palette.Darkly; this.flexChart.AxisX.Format = "M/dd"; }
public CustomTooltipsSample() { InitializeComponent(); Title = AppResources.CustomTooltipsTitle; this.chart.ItemsSource = ChartSampleFactory.CreateEntityList(); this.chart.Palette = Palette.Zen; //this.chart.AxisY.MajorUnit = 2000; this.chart.LegendPosition = ChartPositionType.Bottom; this.chart.Stacking = ChartStackingType.Stacked; chart.Palette = Palette.Cocoa; Device.OnPlatform(Android: () => { image.WidthRequest = 35; image.HeightRequest = 21; label1.FontSize = 17; label2.FontSize = 17; }); Device.OnPlatform(iOS: () => { image.WidthRequest = 20; image.HeightRequest = 15; }); }
public SnapshotSample() { InitializeComponent(); Title = AppResources.ExportImageTitle; snapshotFrame.Opacity = 0; this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (s, e) => { snapshotFrame.Opacity = 1; }; snapshotFrame.GestureRecognizers.Add(tapGestureRecognizer); this.SavePicture.Text = AppResources.TakeSnapshot; }
public DynamicChartsSample() { InitializeComponent(); Title = AppResources.DynamicChartTitle; this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); for (int i = 0; i < 60; i++) { list.Add(getItem()); } this.flexChart.ItemsSource = list; this.flexChart.Palette = Palette.Coral; this.flexChart.AxisX.MajorUnit = 20; this.cancellation = new CancellationTokenSource(); }
private void PrepareFinancialChart() { this.flexChart.BindingX = "Date"; this.flexChart.LegendPosition = ChartPositionType.None; this.flexChart.AxisY.MajorGridStyle.Fill = Color.FromRgba(50, 50, 50, 20); this.flexChart.AxisX.Format = "MM/dd/yyyy"; ChartSeries series = new ChartSeries(); series.SeriesName = "Sales"; series.Binding = "High,Low,Open,Close"; flexChart.Series.Clear(); flexChart.Series.Add(series); this.flexChart.ItemsSource = ChartSampleFactory.FinancialData(); }
public ThemingSample() { InitializeComponent(); Title = AppResources.ThemingTitle; this.lblTheming.Text = AppResources.Therming; this.listPalettes = new List <Palette>(); this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); foreach (var field in typeof(Palette).GetRuntimeFields()) { if (field.FieldType == typeof(Palette)) { listPalettes.Add((Palette)field.GetValue(null)); picker.Items.Add(field.Name); } } picker.SelectedIndex = 0; }
private void PrepareBubbleChart() { this.flexChart.BindingX = "Name"; ChartSeries sales = new ChartSeries(); sales.SeriesName = "Sales"; sales.Binding = "Sales,Downloads"; ChartSeries expensses = new ChartSeries(); expensses.SeriesName = "Expenses"; expensses.Binding = "Expenses,Downloads"; flexChart.Series.Clear(); flexChart.Series.Add(sales); flexChart.Series.Add(expensses); this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); }
public ChartTypesSample() { InitializeComponent(); Title = AppResources.BasicChartTypesTitle; this.lblChartType.Text = AppResources.ChartType; this.lblStacking.Text = AppResources.Stacking; this.lblRotated.Text = AppResources.Rotated; this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); foreach (var item in ChartSampleFactory.GetBasicChartTypes()) { this.pickerChartType.Items.Add(item.ToString()); } foreach (var item in Enum.GetNames(typeof(ChartStackingType))) { this.pickerStackType.Items.Add(item); } this.pickerChartType.SelectedIndex = 0; this.pickerStackType.SelectedIndex = 1; }
public LoadAnimationSample() { InitializeComponent(); Title = AppResources.LoadAnimationTitle; this.lblChartType.Text = AppResources.ChartType; this.lblStacking.Text = AppResources.Stacking; this.lblRotated.Text = AppResources.Rotated; foreach (var item in ChartSampleFactory.GetAllChartTypes()) { this.pickerChartType.Items.Add(item.ToString()); } foreach (var item in Enum.GetNames(typeof(ChartStackingType))) { this.pickerStackType.Items.Add(item); } foreach (var item in Enum.GetNames(typeof(AnimationMode))) { this.pickerAnimationMode.Items.Add(item); } ZoomBehavior z = new ZoomBehavior(); z.ZoomMode = GestureMode.X; flexChart.Behaviors.Add(z); TranslateBehavior t = new TranslateBehavior(); flexChart.Behaviors.Add(t); this.pickerChartType.SelectedIndex = 0; this.pickerStackType.SelectedIndex = 0; this.pickerAnimationMode.SelectedIndex = 3; flexChart.AnimationMode = C1.Xamarin.Forms.Chart.AnimationMode.All; C1Animation loadAnimation = new C1Animation(); loadAnimation.Duration = new TimeSpan(1500 * 10000); loadAnimation.Easing = Xamarin.Forms.Easing.CubicInOut; flexChart.LoadAnimation = loadAnimation; }
public DataLabelSample() { InitializeComponent(); Title = AppResources.DataLabelsTitle; this.lblPos.Text = AppResources.LabelPosition; this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList2(); this.flexChart.Palette = Palette.Organic; this.flexChart.DataLabel.Content = "{x} {y}"; this.flexChart.DataLabel.BorderStyle = new ChartStyle { Stroke = Color.Blue, StrokeThickness = 1 }; this.flexChart.DataLabel.Style = new ChartStyle { Stroke = Color.Red, FontSize = 20 }; foreach (var item in Enum.GetNames(typeof(ChartLabelPosition))) { this.pickPostion.Items.Add(item); } this.pickPostion.SelectedIndex = 1; }
public CustomizingAxesSample() { InitializeComponent(); Title = AppResources.CustomizingAxesTitle; this.flexChart.ItemsSource = ChartSampleFactory.CreateEntityList(); this.flexChart.LegendPosition = ChartPositionType.Top; this.flexChart.AxisX.LabelLoading += (object sender, RenderLabelLoadingEventArgs e) => { Image img = new Image(); ImageSource src = this.flagConverter.Convert(e.LabelString, typeof(ImageSource), null, CultureInfo.CurrentUICulture) as ImageSource; img.Source = src; e.Label = img; Device.OnPlatform(Android: () => { img.WidthRequest = 35; img.HeightRequest = 20; }); }; this.flexChart.AxisY.LabelLoading += (object sender, RenderLabelLoadingEventArgs e) => { Label label = new Label(); label.YAlign = TextAlignment.Center; label.XAlign = TextAlignment.End; if (e.Value > 4000) { label.TextColor = Color.Green; } else if (e.Value <= 4000) { label.TextColor = Color.Red; } label.Text = string.Format("${0}K", e.Value / 1000); Device.OnPlatform(iOS: () => label.FontSize = 12); e.Label = label; }; }
void Init() { int nStudents = 20; int nMaxPoints = 100; var data = ChartSampleFactory.GetZonesData(nStudents, nMaxPoints).ToArray(); this.flexChart.ItemsSource = data; double mean = this.FindMean(data); double stdDev = this.FindStdDev(data, mean); List <double> scores = new List <double>(); foreach (var item in data) { scores.Add(item.Score); } scores.Sort((x, y) => y.CompareTo(x)); var zones = new double[] { scores[this.GetBoundingIndex(scores, 0.95)], scores[this.GetBoundingIndex(scores, 0.75)], scores[this.GetBoundingIndex(scores, 0.25)], scores[this.GetBoundingIndex(scores, 0.05)] }; var colors = new Color[] { Color.FromRgba(255, 192, 192, 255), Color.FromRgba(55, 228, 228, 255), Color.FromRgba(255, 228, 128, 255), Color.FromRgba(128, 255, 128, 255), Color.FromRgba(128, 128, 255, 255), }; for (var i = 4; i >= 0; i--) { double y = i == 4 ? mean + 2 * stdDev : zones[i]; Point[] sdata = new Point[data.Length]; for (int j = 0; j < data.Length; j++) { sdata[j] = new Point(j, y); } var series = new ChartSeries(); series.ItemsSource = sdata; series.Binding = "Y"; series.BindingX = "X"; series.ChartType = ChartType.Area; //series.Color = colors[ i]; series.SeriesName = ((char)((short)'A' + 4 - i)).ToString(); this.flexChart.Series.Add(series); } this.flexChart.Series.Add(new ChartSeries() { Chart = this.flexChart, SeriesName = "raw score", Binding = "Score", BindingX = "Number" }); for (var i = -2; i <= 2; i++) { var y = mean + i * stdDev; string seriesName = string.Empty; if (i > 0) { seriesName = "m+" + i + "s"; } else if (i < 0) { seriesName = "m" + i + "s"; } else { seriesName = "mean"; } Point[] sdata = new Point[data.Length]; for (int j = 0; j < data.Length; j++) { sdata[j] = new Point(j, y); } var series = new ChartSeries() { Chart = this.flexChart, SeriesName = seriesName, Binding = "Y" }; series.ItemsSource = sdata; series.BindingX = "X"; series.ChartType = ChartType.Line; series.Style = new ChartStyle { StrokeThickness = 2 }; if (Device.OS == TargetPlatform.WinPhone) { series.Style.Stroke = Color.Blue; } else { series.Style.Stroke = Color.FromRgb(0x20, 0x20, 0x20); } this.flexChart.Series.Add(series); } }