public SemiDoughnut() { SFChart chart = new SFChart(); chart.Legend.Visible = true; ChartViewModel dataModel = new ChartViewModel(); SFDoughnutSeries series = new SFDoughnutSeries(); series.StrokeColor = UIColor.White; series.ItemsSource = dataModel.SemiCircularData; series.XBindingPath = "XValue"; series.YBindingPath = "YValue"; series.StartAngle = 180; series.EndAngle = 360; series.DataMarker.ShowLabel = true; series.DataMarker.LabelContent = SFChartLabelContent.Percentage; series.DataMarkerPosition = SFChartCircularSeriesLabelPosition.Outside; series.EnableAnimation = true; series.ColorModel.Palette = SFChartColorPalette.Natural; chart.Series.Add(series); chart.Legend.DockPosition = SFChartLegendPosition.Bottom; chart.Legend.ToggleSeriesVisibility = true; chart.Title.Text = new NSString("Products Growth - 2015"); this.AddSubview(chart); }
public Doughnut() { SFChart chart = new SFChart(); chart.Title.Text = new NSString("Project Cost Breakdown"); chart.Legend.Visible = true; chart.Legend.ToggleSeriesVisibility = true; chart.Legend.DockPosition = SFChartLegendPosition.Bottom; chart.Legend.OverflowMode = ChartLegendOverflowMode.Wrap; chart.Legend.IconWidth = 14; chart.Legend.IconHeight = 14; ChartViewModel dataModel = new ChartViewModel(); SFDoughnutSeries series = new SFDoughnutSeries(); series.StrokeColor = UIColor.White; series.ItemsSource = dataModel.DoughnutSeriesData; series.XBindingPath = "XValue"; series.YBindingPath = "YValue"; series.DataMarker.ShowLabel = true; series.ExplodeOnTouch = true; series.DataMarker.LabelContent = SFChartLabelContent.Percentage; series.EnableAnimation = true; series.ColorModel.Palette = SFChartColorPalette.Natural; chart.Series.Add(series); this.AddSubview(chart); }
public override SFSeries GetSeries (SFChart chart, nint index) { SFDoughnutSeries series = new SFDoughnutSeries (); series.DataMarker.ShowLabel = true; series.ExplodeOnTouch = true; series.DataMarker.LabelContent = SFChartLabelContent.Percentage; return series; }
public override SFSeries GetSeries (SFChart chart, nint index) { SFDoughnutSeries series = new SFDoughnutSeries (); series.ExplodeIndex = 3; series.DataMarker.ShowLabel = true; series.DataMarkerPosition = SFChartCircularSeriesLabelPosition.OutsideExtended; return series; }
void Chart_LegendItemCreated(object sender, ChartLegendItemCreatedEventArgs e) { ChartDataModel dataModel = e.LegendItem.DataPoint as ChartDataModel; float heightAndWidth = Utility.IsIPad ? 80 : 60; UIView legendView = new UIView(); legendView.Frame = new CGRect(0, 0, 130, heightAndWidth - 10); SFChart legendChart = new SFChart(); legendChart.Frame = new CGRect(0, 0, heightAndWidth, heightAndWidth); UIImageView imageView = new UIImageView(); imageView.Image = UIImage.FromBundle(dataModel.Image); imageView.Frame = new CGRect(legendChart.Frame.X / 2, legendChart.Frame.Y / 2, Utility.IsIPad ? 30 : 20, Utility.IsIPad ? 30 : 20); SFDoughnutSeries series = new SFDoughnutSeries(); series.IsStackedDoughnut = true; series.Color = e.LegendItem.IconColor; series.ItemsSource = new List <ChartDataModel>() { dataModel }; series.XBindingPath = "XValue"; series.YBindingPath = "YValue"; series.StartAngle = -90; series.EndAngle = 270; series.MaximumValue = 100; series.Spacing = 0.2; series.DoughnutCoefficient = 0.8; series.CircularCoefficient = 1.0; series.CapStyle = DoughnutCapStyle.BothCurve; series.CenterView = imageView; legendChart.Series.Add(series); legendView.AddSubview(legendChart); UILabel yLabel = new UILabel(); yLabel.Frame = new CGRect(Utility.IsIPad ? 77 : 57, Utility.IsIPad ? 20 : 10, 80, 18); yLabel.TextColor = e.LegendItem.IconColor; yLabel.Font = UIFont.FromName("Helvetica", 14f); yLabel.Text = dataModel.YValue.ToString() + "%"; UILabel xLabel = new UILabel(); xLabel.Frame = new CGRect(Utility.IsIPad ? 77 : 57, Utility.IsIPad ? 40 : 30, 80, 18); xLabel.TextColor = UIColor.Black; xLabel.Font = UIFont.FromName("Helvetica", 12f); xLabel.Text = dataModel.XValue.ToString(); legendView.AddSubview(yLabel); legendView.AddSubview(xLabel); e.LegendItem.View = legendView; }
public override SFSeries GetSeries(SFChart chart, nint index) { SFDoughnutSeries series = new SFDoughnutSeries(); series.ExplodeIndex = 3; series.DataMarker.ShowLabel = true; series.DataMarkerPosition = SFChartCircularSeriesLabelPosition.OutsideExtended; return(series); }
public override SFSeries GetSeries (SFChart chart, nint index) { SFDoughnutSeries series = new SFDoughnutSeries (); series.StartAngle = 180; series.EndAngle = 360; series.DataMarker.ShowLabel = true; series.DataMarker.LabelContent = SFChartLabelContent.Percentage; series.DataMarkerPosition = SFChartCircularSeriesLabelPosition.Outside; return series; }
public override SFSeries GetSeries(SFChart chart, nint index) { var series = new SFDoughnutSeries(); series.DataMarker.ShowLabel = true; series.ExplodeOnTouch = true; series.DataMarker.LabelContent = SFChartLabelContent.Percentage; series.EnableAnimation = true; series.EnableDataPointSelection = true; return(series); }
public override SFSeries GetSeries(SFChart chart, nint index) { SFDoughnutSeries series = new SFDoughnutSeries(); series.StartAngle = 180; series.EndAngle = 360; series.DataMarker.ShowLabel = true; series.DataMarker.LabelContent = SFChartLabelContent.Percentage; series.DataMarkerPosition = SFChartCircularSeriesLabelPosition.Outside; return(series); }
public Doughnut() { SFChart chart = new SFChart(); chart.Title.Text = new NSString("Project Cost Breakdown"); chart.Legend.Visible = true; chart.Legend.ToggleSeriesVisibility = true; chart.Legend.DockPosition = SFChartLegendPosition.Bottom; chart.Legend.OverflowMode = ChartLegendOverflowMode.Wrap; chart.Legend.IconWidth = 14; chart.Legend.IconHeight = 14; chart.Delegate = new CenterViewUpdater(); chart.AddChartBehavior(new SFChartSelectionBehavior()); ChartViewModel dataModel = new ChartViewModel(); SFDoughnutSeries series = new SFDoughnutSeries(); series.StrokeColor = UIColor.White; series.ItemsSource = dataModel.DoughnutSeriesData; series.XBindingPath = "XValue"; series.YBindingPath = "YValue"; series.DataMarker.ShowLabel = true; series.ExplodeOnTouch = true; series.DataMarker.LabelContent = SFChartLabelContent.Percentage; series.EnableAnimation = true; series.ColorModel.Palette = SFChartColorPalette.Natural; var centerView = new UIView(); centerView.Frame = new CGRect(chart.Frame.X / 2, chart.Frame.Y / 2, 100, 40); UILabel xLabel = new UILabel(); xLabel.Text = "Tap on slice"; xLabel.Font = UIFont.FromName("Helvetica", 12f); xLabel.TextAlignment = UITextAlignment.Center; xLabel.Frame = new CGRect(5, centerView.Frame.Y, centerView.Frame.Width, centerView.Frame.Height); UILabel yLabel = new UILabel(); yLabel.TextAlignment = UITextAlignment.Center; centerView.AddSubview(xLabel); centerView.AddSubview(yLabel); series.CenterView = centerView; series.EnableDataPointSelection = true; chart.Series.Add(series); this.AddSubview(chart); }
public StackedDoughnut() { ChartViewModel viewModel = new ChartViewModel(); SFChart chart = new SFChart(); chart.Title.Text = new NSString("Percentage of Loan Closure"); chart.Title.Font = UIFont.SystemFontOfSize(15); chart.Legend.Visible = true; chart.Legend.DockPosition = SFChartLegendPosition.Bottom; chart.Legend.OverflowMode = ChartLegendOverflowMode.Wrap; chart.LegendItemCreated += Chart_LegendItemCreated;; UIImageView imageView = new UIImageView(); imageView.Image = UIImage.FromBundle("Images/Person.png"); float heightAndWidth = Utility.IsIPad ? 250 : 80; imageView.Frame = new CGRect(chart.Frame.X / 2, chart.Frame.Y / 2, heightAndWidth, heightAndWidth); SFDoughnutSeries doughnutSeries = new SFDoughnutSeries(); doughnutSeries.IsStackedDoughnut = true; doughnutSeries.ColorModel.Palette = SFChartColorPalette.Custom; doughnutSeries.ColorModel.CustomColors = NSArray.FromObjects(UIColor.FromRGBA(0.28f, 0.73f, 0.62f, 1.0f), UIColor.FromRGBA(0.90f, 0.53f, 0.44f, 1.0f), UIColor.FromRGBA(0.59f, 0.53f, 0.79f, 1.0f), UIColor.FromRGBA(0.90f, 0.40f, 0.56f, 1.0f)); doughnutSeries.ItemsSource = viewModel.StackedDoughnutData; doughnutSeries.XBindingPath = "XValue"; doughnutSeries.YBindingPath = "YValue"; doughnutSeries.StartAngle = -90; doughnutSeries.EndAngle = 270; doughnutSeries.MaximumValue = 100; doughnutSeries.Spacing = 0.2; doughnutSeries.DoughnutCoefficient = 0.6; doughnutSeries.CircularCoefficient = 1; doughnutSeries.CapStyle = DoughnutCapStyle.BothCurve; doughnutSeries.CenterView = imageView; chart.Series.Add(doughnutSeries); this.AddSubview(chart); }
public override SFSeries GetSeries(SFChart chart, nint index) { SFDoughnutSeries series = new SFDoughnutSeries (); series.DataMarker.ShowLabel = true; series.ExplodeOnTouch = true; // series.DataMarker.LabelContent = SFChartLabelContent.Percentage; // series.DataMarkerPosition = SFChartCircularSeriesLabelPosition.OutsideExtended; // series.ConnectorLineType = SFChartConnectorLineType.Bezier; return series; }
public override void AddData(List <string> data, string varName, string title, string extra) { if (m_grid != null) { if (title == "columns") { m_model.AddColumns(data); } else if (title == "item") { m_model.AddPoint(data); } } else if (m_chart != null) { var collection = new ObservableCollection <DataPoint>(); for (int i = 0; i < data.Count - 1; i += 2) { string coord = data[i]; double value = Utils.ConvertToDouble(data[i + 1]); collection.Add(new DataPoint(coord, value)); } if (SfType == SyncFusionType.DOUGHNUT_GRAPH) { SFDoughnutSeries doughnutSeries = new SFDoughnutSeries(); doughnutSeries.ItemsSource = collection; doughnutSeries.XBindingPath = "XValue"; doughnutSeries.YBindingPath = "YValue"; doughnutSeries.EnableTooltip = true; doughnutSeries.EnableAnimation = true; if (!string.IsNullOrEmpty(title)) { //doughnutSeries.Label = title; m_chart.Title.Text = (NSString)title; } doughnutSeries.DataMarker.ShowLabel = true; doughnutSeries.DataMarker.LabelContent = title == "values" ? SFChartLabelContent.YValue : SFChartLabelContent.Percentage; doughnutSeries.DataMarkerPosition = SFChartCircularSeriesLabelPosition.OutsideExtended; doughnutSeries.LegendIcon = SFChartLegendIcon.Circle; if (!string.IsNullOrEmpty(extra)) { var angles = extra.Split(new char[] { ',', ':' }); doughnutSeries.StartAngle = Utils.ConvertToDouble(angles[0]); if (angles.Length > 1) { doughnutSeries.EndAngle = Utils.ConvertToDouble(angles[1]); } } m_chart.Series.Add(doughnutSeries); } else if (SfType == SyncFusionType.SPLINE_GRAPH) { SFSplineSeries splineSeries = new SFSplineSeries(); splineSeries.ItemsSource = collection; splineSeries.XBindingPath = "XValue"; splineSeries.YBindingPath = "YValue"; splineSeries.EnableTooltip = true; splineSeries.EnableAnimation = true; splineSeries.Label = title; splineSeries.DataMarker.MarkerHeight = 5; splineSeries.DataMarker.MarkerWidth = 5; splineSeries.DataMarker.ShowMarker = true; splineSeries.LegendIcon = SFChartLegendIcon.Rectangle; if (!string.IsNullOrEmpty(extra)) { var colors = extra.Split(new char[] { ',', ':' }); splineSeries.Color = UtilsiOS.String2Color(colors[0]); if (colors.Length > 1) { var color = UtilsiOS.String2Color(colors[1]); splineSeries.DataMarker.MarkerColor = color; } } m_chart.Series.Add(splineSeries); } if (!string.IsNullOrEmpty(title)) { m_chart.Legend.Visible = true; m_chart.Legend.DockPosition = SFChartLegendPosition.Top; //m_chart.Legend. m_chart.Legend.ToggleSeriesVisibility = true; } } else if (m_picker != null) { m_strings = data; m_picker.ItemsSource = data; } }