Xamarin图表开发基础教程(6)OxyPlot框架
Xamarin图表开发基础教程(6)OxyPlot框架
Xamamin iOS中绘制线图OxyPlotiOSDemo
【示例OxyPlotiOSDemo】下面将实现线图的显示。具体的操作步骤如下:
(1)打开Xamarin.iOS项目。
(2)将OxyPlot.Xamarin.iOS组件添加到项目中的引入中。
(3)打开ViewController.cs文件,完成剩余的步骤,即创建PlotView视图、绘制图表、设置显示模式以及显示PlotView。代码如下:
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. //创建PlotView视图 PlotView plotView = new PlotView { Frame = this.View.Frame }; plotView.Model=CreatePlotModel(); //设置显示模式 this.View.Add(plotView); //将PlotView视图添加到主视图上 } //绘制图表 private PlotModel CreatePlotModel() { //创建图表模式 var plotModel = new PlotModel { Title = "OxyPlot Demo" }; //添加坐标轴 plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom }); plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Maximum = 10, Minimum = 0 }); //创建数据列 var series1 = new LineSeries { Title = "Data", MarkerType = MarkerType.Circle, MarkerSize = 4, MarkerStroke = OxyColors.White }; //添加数据点 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)); //添加数据列 plotModel.Series.Add(series1); return plotModel; } …… } }
运行程序,会看到如图1.2所示的效果。
图1.2 Xamarin.iOS平台的线图效果
Xamarin图表开发基础教程(6)OxyPlot框架的更多相关文章
- Xamarin图表开发基础教程(13)OxyPlot框架支持的其它图表
Xamarin图表开发基础教程(13)OxyPlot框架支持的其它图表 除了以上提到的图表外,OxyPlot组件还包含了6种类型的其它图表,分别为等高线图.箱线图.饼图.热图.散点图和散点误差图,如图 ...
- Xamarin图表开发基础教程(12)OxyPlot框架支持的金融图表类型
Xamarin图表开发基础教程(12)OxyPlot框架支持的金融图表类型 OxyPlot组件中支持5种类型的金融图表,它们分别为销量图.高低图.股票K线图.股票走势图和旧式股票图,如图1.20~1. ...
- Xamarin图表开发基础教程(11)OxyPlot框架支持的图表类型
Xamarin图表开发基础教程(11)OxyPlot框架支持的图表类型 OxyPlot组件中支持7种类型的条型图表,分别为普通条形图.线型条形图.矩形条形图.差值图.龙卷风图.普通柱形图和柱形误差图, ...
- Xamarin图表开发基础教程(10)OxyPlot框架支持的图表类型
Xamarin图表开发基础教程(10)OxyPlot框架支持的图表类型 OxyPlot组件支持26种图表,这些图表按照功能和样式可以分为4大类,分别为线型图表.条型图表.金融图表和其它图表. 线型图表 ...
- Xamarin图表开发基础教程(9)OxyPlot框架
Xamarin图表开发基础教程(9)OxyPlot框架 OxyPlot组件构成 OxyPlot组件主要由两个类构成,分别为PlotView和PlotModel.这两个类我们在上文中也使用到了.本节将讲 ...
- Xamarin图表开发基础教程(8)OxyPlot框架
Xamarin图表开发基础教程(8)OxyPlot框架 [示例OxyPlotFormsDemo]在Xamarin.Forms中实现线图的显示. (1)打开Xamarin.Forms项目. (2)将Ox ...
- Xamarin图表开发基础教程(7)OxyPlot框架
Xamarin图表开发基础教程(7)OxyPlot框架 Xamarin.Forms中使用OxyPlot框架 在Xamarin. Forms平台上实现图表显示需要完成以下的步骤: 1.添加OxyPlot ...
- Xamarin图表开发基础教程(5)OxyPlot框架
Xamarin图表开发基础教程(5)OxyPlot框架 Xamarin.iOS中使用OxyPlot框架 在Xamarin.iOS平台上实现图表显示需要完成以下的步骤: 1.添加OxyPlot.Xama ...
- Xamarin图表开发基础教程(4)OxyPlot框架
Xamarin图表开发基础教程(4)OxyPlot框架 XamaminAndroid中绘制线图OxyPlotAndroidDemo [示例1-1:OxyPlotAndroidDemo]下面实现线图的绘 ...
随机推荐
- PHP 根据配置转换数组中的键名 方便给前端的时候改键名
/** * 根据配置转换数组中的键名 * @param array $data 数据,必须为二维数组格式 [0=>[]] * @param array $keyNameMapArr 键名转换配置 ...
- python测试开发django-rest-framework-60.使用token登录(authentication之TokenAuthentication)
前言 现在很多接口项目在登录的时候返回一个token,登录后的拿着这个token去访问访问登录之后的请求. 本篇使用djangorestframework框架写一个登陆的接口,登录成功后返回token ...
- python使用print写文件
刚刚看sumo的官方教程,有一段代码是生成配置文件,发现python中的print函数也可以写文件. with open("data/cross.rou.xml", "w ...
- CentOS7.5下搭建的SVN实现删除权限控制和必须进行注释的提示操作
需求:上传到SVN服务器的项目文件如果被普通用户误删了,虽然能恢复,但是如果删除的文件比较多,注释的内容简单,恢复的时候需要一个个的保存到本地,然后再上传到服务器上,会很麻烦,可能还会出现提交代码版本 ...
- Sql操作时间
--. 当前系统日期.时间 -- ::27.277 --.时间操作 dateadd 在向指定日期加上一段时间的基础上,返回新的 datetime 值 dateadd(datepart,number,d ...
- 持续集成学习5 jenkins自动化测试与构建
一.jenkins参数 1.主要参数类型 2.触发构建参数 3.参数值的使用 4.给git仓库配置参数,让其构建的时候可以选择分支 5.配置password参数 6.添加Choice参数 7.其它好用 ...
- .NET添加新项目-配置不同环境参数
添加新项目-配置不同环境参数 添加新项目后,需要对配置管理器进行设置.默认新加的项目只有debug和release 现加其他环境(dev.uat...)的配置[通过项目文件.csproj来加,拷贝其他 ...
- Xamarin移动开发之路
Xamarin入门 1.Xamarin开发及学习资源 2.Xamarin安装及调试 Xamarin.Forms 1.入门 [快速入门] 2.XAML 3.应用程序基础知识 [辅助功能]eg:大类型.高 ...
- Why We Changed YugaByte DB Licensing to 100% Open Source
转自:https://blog.yugabyte.com/why-we-changed-yugabyte-db-licensing-to-100-open-source/ 主要说明了YugaByte ...
- mysql ERROR 1862 (HY000): 密码超时错误解决 Your password has expired.To log in you must change it using a client that supports expired password
工具链接可能报错,使用黑窗口链接后: 1. SET PASSWORD = PASSWORD("xinmima"); 2. flush privileges; 使用新密码链接即可.