Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use OxyPlotiO frame to draw Line Graph in Xamamin iOS

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to use the OxyPlotiO framework to draw diagrams in Xamamin iOS, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Drawing Line Graph OxyPlotiOSDemo in Xamamin iOS

[example OxyPlotiOSDemo] the display of the line graph will be realized below. The specific steps are as follows:

(1) Open the Xamarin.iOS project.

(2) add OxyPlot.Xamarin.iOS components to the introduction in the project.

(3) Open the ViewController.cs file and complete the remaining steps, that is, creating the PlotView view, drawing the chart, setting the display mode and displaying the PlotView. The code is as follows:

Using Foundation;using System;using UIKit;using OxyPlot.Xamarin.iOS;using OxyPlot;using OxyPlot.Axes;using OxyPlot.Series;namespace OxyPlotiOSDemo {public partial class ViewController: UIViewController {public ViewController (IntPtr handle): base (handle) {} public override void ViewDidLoad () {base.ViewDidLoad (); / / Perform any additional setup after loading the view, typically from a nib. / / create PlotView view PlotView plotView = new PlotView {Frame = this.View.Frame}; plotView.Model=CreatePlotModel (); / / set display mode this.View.Add (plotView) / / add the PlotView view to the main view} / / draw the chart private PlotModel CreatePlotModel () {/ / create the chart mode var plotModel = new PlotModel {Title = "OxyPlot Demo"} / / add axis plotModel.Axes.Add (new LinearAxis {Position = AxisPosition.Bottom}); plotModel.Axes.Add (new LinearAxis {Position = AxisPosition.Left, Maximum = 10, Minimum = 0}) / / create data columns var series1 = new LineSeries {Title = "Data", MarkerType = MarkerType.Circle, MarkerSize = 4, MarkerStroke = OxyColors.White}; / / add data point series1.Points.Add (new DataPoint (0.0,6.0)) Series1.Points.Add (new DataPoint (1.4,2.1); series1.Points.Add (new DataPoint (2.0,4.2)); series1.Points.Add (new DataPoint (3.3,2.3)); series1.Points.Add (new DataPoint (4.7,7.4)); series1.Points.Add (new DataPoint (6.0,6.2)) Series1.Points.Add (new DataPoint (8.9,8.9)); / / add data column plotModel.Series.Add (series1); return plotModel;}... }}

Run the program and you will see the effect shown in figure 1.2.

Figure 1.2 Graph effect of the Xamarin.iOS platform

The above is all the contents of the article "how to draw a Line Diagram using OxyPlotiO Framework in Xamamin iOS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report