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]下面实现线图的绘 ...
随机推荐
- 用navicat操作oracle新建表空间、用户名、密码
转载从:https://www.cnblogs.com/franson-2016/p/5925593.html 首先.我们来新建一个表空间.打开Navicat for Oracle,输入相关的的连接信 ...
- MySQL备份,使用xtrabackup备份全实例数据时,会造成锁等待吗?那么如果使用mysqldump进行备份呢?
一.xtrabackup和mysqldump会造成锁等待吗? xtrabackup会,它在备份时会产生短暂的全局读锁FTWL(flush table with read lock),用于拷贝frm/M ...
- Docker基础用法篇
Docker基础用法篇 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.安装docker 1>.依赖的基础环境 64 bits CPU Linux Kerner 3.10+ ...
- PostgreSQL数据库安装
PostgreSQL数据库安装 postgresqllinux9.6.0 2018年01月31日 10时53分13秒 编译以及安装 源码编译 程序安装 数据库的启动和停止 启动数据库 关闭数据库 数据 ...
- 基于CentOS7配置ArcGIS enterprise
Centos7GUI安装过程 1.右键点击列表中的虚拟主机,打开控制台. 点击绿色开机键,开始安装. 这里有一个很关键的点,就是上一步设置中的打开电源自动连接.一开始设置的时候别忘了. 2.开机后会出 ...
- Windows 将FTP 映射到本地文件夹 --简化操作
转载自yutiantongbu Windows 将FTP 映射到本地文件夹 --简化操作 1.右键我的电脑,选择映射网络驱动器 2.选择"连接到可用与存储文档和图片的网站" 3.接 ...
- PAT甲级1002水题飘过
#include<iostream> #include<string.h> using namespace std; ]; int main(){ int n1, n2; wh ...
- 第9期《python3接口自动化测试》课程,6月29号开学!
2019年 第9期<python3接口自动化测试>课程,6月29号开学! 主讲老师:上海-悠悠 上课方式:QQ群视频在线教学 本期上课时间:6月29号-7月28号,每周六.周日晚上20:3 ...
- 微信支付之获取openid
一.准备工具 不管开发什么,官方的文档应该是第一个想到的这里把官方文档贴出来:微信网页授权文档除此之外,我们还需要一个内网穿透的工具在开发环境下让微信能访问到我们的域名.我使用的是natapp.此类工 ...
- JSON—去除JSON数据中的所有HTML标…
package com.linoer.utils; import java.util.ArrayList; import java.util.List; import java.util.regex. ...