public StripLines() { SFChart chart = new SFChart(); chart.Title.Text = new NSString("Average temperature for the year 2014"); chart.Title.Font = UIFont.FromName("Helvetica neue", 14); SFCategoryAxis primaryAxis = new SFCategoryAxis(); primaryAxis.LabelPlacement = SFChartLabelPlacement.BetweenTicks; chart.PrimaryAxis = primaryAxis; chart.PrimaryAxis.Title.Text = new NSString("Months"); SFNumericalAxis numeric = new SFNumericalAxis(); numeric.Minimum = NSObject.FromObject(28); numeric.Maximum = NSObject.FromObject(52); numeric.Interval = NSObject.FromObject(2); numeric.Title.Text = new NSString("Temperature in Celsius"); SFChartNumericalStripLine strip1 = new SFChartNumericalStripLine(); strip1.Start = 28; strip1.Width = 8; strip1.Text = new NSString("Low Temperature"); strip1.BackgroundColor = UIColor.FromRGBA((nfloat)0.7843, (nfloat)0.8196, (nfloat)0.4275, (nfloat)1.0); numeric.AddStripLine(strip1); SFChartNumericalStripLine strip2 = new SFChartNumericalStripLine(); strip2.Start = 36; strip2.Width = 8; strip2.Text = new NSString("Average Temperature"); strip2.BackgroundColor = UIColor.FromRGBA((nfloat)0.9569, (nfloat)0.7804, (nfloat)0.3843, (nfloat)1.0); numeric.AddStripLine(strip2); SFChartNumericalStripLine strip3 = new SFChartNumericalStripLine(); strip3.Start = 44; strip3.Width = 8; strip3.Text = new NSString("High Temperature"); strip3.BackgroundColor = UIColor.FromRGBA((nfloat)0.9373, (nfloat)0.4706, (nfloat)0.4706, (nfloat)1.0); numeric.AddStripLine(strip3); chart.SecondaryAxis = numeric; ChartStripLineDataSource dataModel = new ChartStripLineDataSource(); chart.DataSource = dataModel as SFChartDataSource; this.control = chart; }
public StripLines () { SFChart chart = new SFChart (); chart.Title.Text = new NSString ("Average temperature for the year 2014"); chart.Title.Font = UIFont.FromName ("Helvetica neue",14); SFCategoryAxis primaryAxis = new SFCategoryAxis (); primaryAxis.LabelPlacement = SFChartLabelPlacement.BetweenTicks; chart.PrimaryAxis = primaryAxis; chart.PrimaryAxis.Title.Text = new NSString ("Months"); SFNumericalAxis numeric = new SFNumericalAxis (); numeric.Minimum = NSObject.FromObject(28); numeric.Maximum = NSObject.FromObject(52); numeric.Interval = NSObject.FromObject(2); numeric.Title.Text = new NSString ("Temperature in Celsius"); SFChartNumericalStripLine strip1 = new SFChartNumericalStripLine (); strip1.Start = 28; strip1.Width = 8; strip1.Text = new NSString("Low Temperature"); strip1.BackgroundColor = UIColor.FromRGBA((nfloat)0.7843,(nfloat)0.8196,(nfloat)0.4275,(nfloat)1.0); numeric.AddStripLine (strip1); SFChartNumericalStripLine strip2 = new SFChartNumericalStripLine (); strip2.Start = 36; strip2.Width = 8; strip2.Text = new NSString("Average Temperature"); strip2.BackgroundColor = UIColor.FromRGBA((nfloat)0.9569,(nfloat)0.7804,(nfloat)0.3843,(nfloat)1.0); numeric.AddStripLine (strip2); SFChartNumericalStripLine strip3 = new SFChartNumericalStripLine (); strip3.Start = 44; strip3.Width = 8; strip3.Text = new NSString("High Temperature"); strip3.BackgroundColor = UIColor.FromRGBA((nfloat)0.9373,(nfloat)0.4706,(nfloat)0.4706,(nfloat)1.0); numeric.AddStripLine (strip3); chart.SecondaryAxis = numeric; ChartStripLineDataSource dataModel = new ChartStripLineDataSource (); chart.DataSource = dataModel as SFChartDataSource; this.control = chart; }
public StripLines() { SFChart chart = new SFChart(); chart.Title.Text = new NSString("Weather Report"); SFCategoryAxis primaryAxis = new SFCategoryAxis(); primaryAxis.LabelPlacement = SFChartLabelPlacement.BetweenTicks; chart.PrimaryAxis = primaryAxis; chart.PrimaryAxis.Title.Text = new NSString("Months"); SFNumericalAxis numeric = new SFNumericalAxis(); numeric.Minimum = NSObject.FromObject(10); numeric.Maximum = NSObject.FromObject(40); numeric.Title.Text = new NSString("Temperature in Celsius"); SFChartNumericalStripLine strip1 = new SFChartNumericalStripLine(); strip1.Start = 10; strip1.Width = 10; strip1.Text = new NSString("Low Temperature"); strip1.BackgroundColor = UIColor.FromRGBA((nfloat)249 / 255, (nfloat)212 / 255, (nfloat)35 / 255, (nfloat)1.0); numeric.AddStripLine(strip1); SFChartNumericalStripLine strip2 = new SFChartNumericalStripLine(); strip2.Start = 20; strip2.Width = 10; strip2.Text = new NSString("Average Temperature"); strip2.BackgroundColor = UIColor.FromRGBA((nfloat)252 / 255, (nfloat)144 / 255, (nfloat)42 / 255, (nfloat)1.0); numeric.AddStripLine(strip2); SFChartNumericalStripLine strip3 = new SFChartNumericalStripLine(); strip3.Start = 30; strip3.Width = 10; strip3.Text = new NSString("High Temperature"); strip3.BackgroundColor = UIColor.FromRGBA((nfloat)254 / 255, (nfloat)81 / 255, (nfloat)47 / 255, (nfloat)1.0); numeric.AddStripLine(strip3); chart.SecondaryAxis = numeric; ChartViewModel dataModel = new ChartViewModel(); SFLineSeries series = new SFLineSeries(); series.LineWidth = 2; series.Color = UIColor.White; series.ItemsSource = dataModel.StripLineData; series.XBindingPath = "XValue"; series.YBindingPath = "YValue"; series.EnableTooltip = true; series.DataMarker.ShowLabel = false; series.DataMarker.ShowMarker = true; series.DataMarker.MarkerWidth = 10; series.DataMarker.MarkerHeight = 10; series.DataMarker.MarkerColor = UIColor.FromRGBA((nfloat)102 / 255, (nfloat)102 / 255, (nfloat)102 / 255, (nfloat)1.0); series.DataMarker.MarkerBorderColor = UIColor.FromRGBA((nfloat)255, (nfloat)255, (nfloat)255, (nfloat)1.0);; series.DataMarker.MarkerBorderWidth = 4; chart.Series.Add(series); this.AddSubview(chart); }