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所示的效果。
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图表开发基础教程(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]下面实现线图的绘 ...
- Xamarin图表开发基础教程(3)OxyPlot框架
Xamarin图表开发基础教程(3)OxyPlot框架 Xamarin.Android中使用OxyPlot框架 在Xamarin.Android平台上实现图表显示需要完成以下的步骤: 1.添加OxyP ...
最新文章
- grep搜索当前目录和递归搜索子目录中文本文件的特定pattern
- vim/vi的使用(Ubuntu12.04)
- 我的世界java版袭击图片_我的世界:你mc“中毒”有多深?这8张图都能看懂,绝对是真爱粉...
- 3000 字说说跨域!面试官听完之后露出了满意的笑容
- soap方式的远程调用示例代码
- 狼的故事14:必死的狮子
- python设计模式之享元模式
- C#LeetCode刷题-树
- 4章 关键的“构建”决策
- 私域经济运营能力最关键的三个指标
- 不可重复读和幻读的区别_面试官:MySQL的可重复读级别能解决幻读吗
- cognos report上钻下钻报表处理方法(2)
- Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding'
- ORACLE VARCHAR2和NVARCHAR2的区别
- 一键安装ROS和rosdep(NO 墙)
- Spark的下一代引擎-Project Tungsten启示录
- validation参数检验 - 如何使用
- killer杀手网卡linux,板载四块Killer网卡,微星Z370 GODLIKE GAMING主板实物图赏
- 浅谈智能DNS云解析(二)
- 利用火狐浏览器伪造IP地址,把自己IP改成美国
热门文章
- 解决mantis不能上传附件问题
- 最大整数扩展欧几里得
- 【译】用图表展示未知----通向报表服务的阶梯系列(五)
- c# 图片加图片水印、文字水印和图片文字水印
- 时间管理读后记(二)
- 解决“The type initializer for‘Oracle.DataAccess.Client.OracleConnection‘ threw an exception ”异常
- Mybatis排序无效问题解决
- 使用“1”个参数调用“DownloadString”时发生异常:“操作超时”
- 错误:Parameter ‘0‘ not found.Available parameters are [arg1, arg0, param1, param2]的解决方法
- idea 2019安装完(打不开启动不了)问题解决(最全解决方法)