public Pyramid() { SFChart chart = new SFChart(); chart.Title.Text = new NSString("Food Comparison Chart"); chart.Legend.Visible = true; ChartViewModel dataModel = new ChartViewModel(); SFPyramidSeries series = new SFPyramidSeries(); series.ItemsSource = dataModel.PyramidData; series.XBindingPath = "XValue"; series.YBindingPath = "YValue"; series.LegendIcon = SFChartLegendIcon.Circle; chart.Legend.IconWidth = 14; chart.Legend.IconHeight = 14; series.ColorModel.Palette = SFChartColorPalette.Natural; series.EnableTooltip = true; chart.Series.Add(series); chart.Legend.ToggleSeriesVisibility = true; var tooltip = new SFChartTooltipBehavior(); NSNumberFormatter formatter = new NSNumberFormatter(); formatter.PositiveSuffix = " cal"; tooltip.LabelFormatter = formatter; chart.AddChartBehavior(tooltip); this.AddSubview(chart); }
public Tooltip() { SFChart chart = new SFChart(); chart.Title.Text = new NSString("Efficiency of oil power Production"); //Primary Axis SFCategoryAxis primaryAxis = new SFCategoryAxis(); primaryAxis.PlotOffset = 10; primaryAxis.ShowMajorGridLines = false; primaryAxis.AxisLineStyle.LineWidth = new NSNumber(0.5); primaryAxis.Interval = new NSNumber(2); chart.PrimaryAxis = primaryAxis; // Secondary Axis SFNumericalAxis secondaryAxis = new SFNumericalAxis(); secondaryAxis.EdgeLabelsDrawingMode = SFChartAxisEdgeLabelsDrawingMode.Shift; secondaryAxis.Maximum = new NSNumber(2.701); secondaryAxis.Minimum = new NSNumber(1.5); secondaryAxis.Interval = new NSNumber(0.2); secondaryAxis.AxisLineStyle.LineWidth = new NSNumber(0); secondaryAxis.LabelStyle.Font = UIFont.FromName("Helvetica", 12f); secondaryAxis.Title.Font = UIFont.FromName("Helvetica", 15f); secondaryAxis.MajorTickStyle.LineSize = 0; secondaryAxis.MajorGridLineStyle.LineWidth = new NSNumber(0.25); chart.SecondaryAxis = secondaryAxis; ChartViewModel dataModel = new ChartViewModel(); SFSplineSeries series = new SFSplineSeries(); series.ItemsSource = dataModel.TooltipData; series.XBindingPath = "XValue"; series.YBindingPath = "YValue"; series.EnableTooltip = true; //series.Color = UIColor.Orange; series.LineWidth = 2.5f; series.DataMarker.ShowMarker = true; series.DataMarker.MarkerType = SFChartDataMarkerType.Ellipse; series.DataMarker.MarkerHeight = 5; series.DataMarker.MarkerWidth = 5; series.DataMarker.MarkerBorderColor = UIColor.Black; series.DataMarker.MarkerColor = UIColor.FromRGBA(193.0f / 255.0f, 39.0f / 255.0f, 45.0f / 255.0f, 1.0f); series.EnableAnimation = true; chart.Series.Add(series); chart.Delegate = new ChartTooltipDelegate(); SFChartTooltipBehavior behavior = new SFChartTooltipBehavior(); behavior.BackgroundColor = UIColor.FromRGBA(193.0f / 255.0f, 39.0f / 255.0f, 45.0f / 255.0f, 1.0f); chart.AddChartBehavior(behavior); this.AddSubview(chart); }
public Histogram() { SFChart chart = new SFChart(); chart.Title.Text = new NSString("Examination Result"); chart.ColorModel.Palette = SFChartColorPalette.Natural; SFNumericalAxis primary = new SFNumericalAxis(); primary.Title.Text = new NSString("Score of Final Examination"); primary.EdgeLabelsDrawingMode = SFChartAxisEdgeLabelsDrawingMode.Shift; primary.ShowMajorGridLines = false; chart.PrimaryAxis = primary; chart.SecondaryAxis = new SFNumericalAxis(); chart.SecondaryAxis.Title.Text = new NSString("Number of Students"); chart.SecondaryAxis.ShowMajorGridLines = true; chart.SecondaryAxis.Visible = true; chart.SecondaryAxis.AxisLineStyle.LineWidth = 0; chart.SecondaryAxis.MajorTickStyle.LineWidth = new NSNumber(0); ChartViewModel dataModel = new ChartViewModel(); SFHistogramSeries series1 = new SFHistogramSeries(); series1.ItemsSource = dataModel.HistogramData; series1.XBindingPath = "YValue"; series1.YBindingPath = "XValue"; series1.EnableTooltip = true; series1.Interval = 20; series1.StrokeColor = UIColor.White; series1.StrokeWidth = 1; series1.EnableAnimation = true; series1.LegendIcon = SFChartLegendIcon.SeriesType; series1.DataMarker.ShowLabel = true; series1.DataMarker.LabelStyle.LabelPosition = SFChartDataMarkerLabelPosition.Inner; series1.DataMarker.LabelStyle.BackgroundColor = UIColor.Clear; series1.DataMarker.LabelStyle.Color = UIColor.White; chart.Series.Add(series1); chart.Delegate = new HistogramTooltipFormatter(); var tooltip = new SFChartTooltipBehavior(); tooltip.BackgroundColor = UIColor.FromRGBA(64.0f / 255.0f, 64.0f / 255.0f, 65.0f / 255.0f, 1.0f); chart.AddChartBehavior(tooltip); this.AddSubview(chart); this.OptionView = new UIView(); }
public Bubble() { SFChart chart = new SFChart(); chart.Title.Text = new NSString("World Countries Details"); SFNumericalAxis primaryAxis = new SFNumericalAxis(); chart.PrimaryAxis = primaryAxis; primaryAxis.Minimum = new NSNumber(60); primaryAxis.Maximum = new NSNumber(100); primaryAxis.Interval = new NSNumber(5); primaryAxis.ShowMinorGridLines = false; primaryAxis.ShowMajorGridLines = false; chart.PrimaryAxis.Title.Text = new NSString("Literacy Rate"); chart.SecondaryAxis = new SFNumericalAxis(); chart.SecondaryAxis.Title.Text = new NSString("GDP Growth Rate"); chart.SecondaryAxis.Minimum = new NSNumber(0); chart.SecondaryAxis.Maximum = new NSNumber(10); chart.SecondaryAxis.Interval = new NSNumber(2.5); chart.SecondaryAxis.ShowMinorGridLines = false; chart.SecondaryAxis.ShowMajorGridLines = false; chart.Delegate = new TooltipFormatter(); ChartViewModel dataModel = new ChartViewModel(); SFBubbleSeries series = new SFBubbleSeries(); series.EnableTooltip = true; series.Alpha = 0.6f; series.ItemsSource = dataModel.BubbleData; series.XBindingPath = "XValue"; series.YBindingPath = "YValue"; series.Size = "Size"; series.MaximumRadius = 40; series.MinimumRadius = 5; series.ColorModel.Palette = SFChartColorPalette.Natural; series.EnableAnimation = true; chart.Series.Add(series); var tooltip = new SFChartTooltipBehavior(); tooltip.BackgroundColor = UIColor.FromRGBA(64.0f / 255.0f, 64.0f / 255.0f, 65.0f / 255.0f, 1.0f); chart.AddChartBehavior(tooltip); this.AddSubview(chart); }
public ZoomingandPanning() { chart = new SFChart(); chart.ColorModel.Palette = SFChartColorPalette.Natural; chart.Title.Text = new NSString("Height vs Weight"); chart.Delegate = new TooltipGenerator(); SFNumericalAxis primary = new SFNumericalAxis(); primary.ShowMajorGridLines = false; primary.EdgeLabelsDrawingMode = SFChartAxisEdgeLabelsDrawingMode.Shift; primary.Minimum = new NSNumber(100); primary.Maximum = new NSNumber(220); primary.Interval = new NSNumber(20); primary.Title.Text = new NSString("Height in Inches"); chart.PrimaryAxis = primary; SFNumericalAxis secondary = new SFNumericalAxis(); secondary.Title.Text = new NSString("Weight in Pounds"); secondary.ShowMajorGridLines = false; secondary.Minimum = new NSNumber(50); secondary.Maximum = new NSNumber(80); secondary.Interval = new NSNumber(5); chart.SecondaryAxis = secondary; ChartViewModel dataModel = new ChartViewModel(); SFScatterSeries series = new SFScatterSeries(); series.ItemsSource = dataModel.ScatterMaleData; series.XBindingPath = "XValue"; series.YBindingPath = "YValue"; series.EnableTooltip = true; series.ScatterHeight = 10; series.ScatterWidth = 10; series.Alpha = 0.7f; series.EnableAnimation = true; series.Label = "Male"; series.LegendIcon = SFChartLegendIcon.SeriesType; chart.Series.Add(series); SFScatterSeries series1 = new SFScatterSeries(); series1.ItemsSource = dataModel.ScatterFemaleData; series1.XBindingPath = "XValue"; series1.YBindingPath = "YValue"; series1.EnableTooltip = true; series1.ScatterHeight = 10; series1.ScatterWidth = 10; series1.ShapeType = ChartScatterShapeType.Diamond; series1.Alpha = 0.7f; series1.EnableAnimation = true; series1.Label = "Female"; series1.LegendIcon = SFChartLegendIcon.SeriesType; chart.Series.Add(series1); chart.Legend.Visible = true; chart.Legend.ToggleSeriesVisibility = true; chart.Legend.IconWidth = 14; chart.Legend.IconHeight = 14; chart.Legend.DockPosition = SFChartLegendPosition.Bottom; var tooltip = new SFChartTooltipBehavior(); tooltip.BackgroundColor = UIColor.FromRGBA(64.0f / 255.0f, 64.0f / 255.0f, 65.0f / 255.0f, 1.0f); chart.AddChartBehavior(tooltip); label = new UILabel(); label.Text = "Pinch to zoom or double tap and drag to select a region to zoom in"; label.Font = UIFont.FromName("Helvetica", 12f); label.TextAlignment = UITextAlignment.Center; label.LineBreakMode = UILineBreakMode.WordWrap; label.Lines = 2; label.BackgroundColor = UIColor.FromRGB(249, 249, 249); label.TextColor = UIColor.FromRGB(79, 86, 91); chart.AddChartBehavior(new SFChartZoomPanBehavior() { EnableSelectionZooming = true }); this.AddSubview(chart); CALayer topLine = new CALayer(); topLine.Frame = new CGRect(0, 0, UIScreen.MainScreen.ApplicationFrame.Width, 0.5); topLine.BackgroundColor = UIColor.FromRGB(178, 178, 178).CGColor; label.Layer.AddSublayer(topLine); this.AddSubview(label); }
public Scatter() { SFChart chart = new SFChart(); chart.ColorModel.Palette = SFChartColorPalette.Natural; chart.Title.Text = new NSString("Height vs Weight"); chart.Delegate = new TooltipGenerator(); SFNumericalAxis primary = new SFNumericalAxis(); primary.ShowMajorGridLines = false; primary.EdgeLabelsDrawingMode = SFChartAxisEdgeLabelsDrawingMode.Shift; primary.Minimum = new NSNumber(100); primary.Maximum = new NSNumber(220); primary.Interval = new NSNumber(20); primary.Title.Text = new NSString("Height in Inches"); chart.PrimaryAxis = primary; SFNumericalAxis secondary = new SFNumericalAxis(); secondary.Title.Text = new NSString("Weight in Pounds"); secondary.ShowMajorGridLines = false; secondary.Minimum = new NSNumber(50); secondary.Maximum = new NSNumber(80); secondary.Interval = new NSNumber(5); chart.SecondaryAxis = secondary; ChartViewModel dataModel = new ChartViewModel(); SFScatterSeries series = new SFScatterSeries(); series.ItemsSource = dataModel.ScatterMaleData; series.XBindingPath = "XValue"; series.YBindingPath = "YValue"; series.EnableTooltip = true; series.ScatterHeight = 10; series.ScatterWidth = 10; series.Alpha = 0.7f; series.EnableAnimation = true; series.Label = "Male"; series.LegendIcon = SFChartLegendIcon.SeriesType; chart.Series.Add(series); SFScatterSeries series1 = new SFScatterSeries(); series1.ItemsSource = dataModel.ScatterFemaleData; series1.XBindingPath = "XValue"; series1.YBindingPath = "YValue"; series1.EnableTooltip = true; series1.ScatterHeight = 10; series1.ScatterWidth = 10; series1.ShapeType = ChartScatterShapeType.Diamond; series1.Alpha = 0.7f; series1.EnableAnimation = true; series1.Label = "Female"; series1.LegendIcon = SFChartLegendIcon.SeriesType; chart.Series.Add(series1); chart.Legend.Visible = true; chart.Legend.ToggleSeriesVisibility = true; chart.Legend.IconWidth = 14; chart.Legend.IconHeight = 14; chart.Legend.DockPosition = SFChartLegendPosition.Bottom; var tooltip = new SFChartTooltipBehavior(); tooltip.BackgroundColor = UIColor.FromRGBA(64.0f / 255.0f, 64.0f / 255.0f, 65.0f / 255.0f, 1.0f); chart.AddChartBehavior(tooltip); this.AddSubview(chart); }