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]下面实现线图的绘 ...
随机推荐
- JS 小工具 MYSQL WHERE IN条件 去掉换行符(列转行)
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...
- Python学习日记(二十八) hashlib模块、configparse模块、logging模块
hashlib模块 主要提供字符加密算法功能,如md5.sha1.sha224.sha512.sha384等,这里的加密算法称为摘要算法.什么是摘要算法?它又称为哈希算法.散列算法,它通过一个函数把任 ...
- nodejs 删除空文件
var fs = require("fs") var path = require("path") var listRealPath = path.resolv ...
- uboot中的mmc命令(转)
转载地址:https://blog.csdn.net/a624731186/article/details/37700205 一:mmc的命令如下: 1:对mmc读操作 mmc read addr b ...
- 关于header file、static、inline、variable hides的一点感想
前言 先看一段代码 #ifndef _INLINE_H #define _INLINE_H template<typename T> static inline T my_max(T a, ...
- 191017 虚拟机centos修改IP
1. 虚拟机设置 1.1 编辑-->虚拟机网络编辑器-->VMnet8-->更改设置-->DHCP设置取消打勾 -->选择NAT模式,查看网关IP 2. 本地网络设置 更 ...
- react-native npm install
--create project react-native init myapp --version 0.55.4 cd myapp -- react ui npm i react-native-el ...
- Educational Codeforces Round 64 (Rated for Div. 2)题解
Educational Codeforces Round 64 (Rated for Div. 2)题解 题目链接 A. Inscribed Figures 水题,但是坑了很多人.需要注意以下就是正方 ...
- eclipse正常启动,debug无法启动,解决办法
- MySQL之自连接
自连接就是说,在同一个表中,看做是两个表,下表表示 找每个人的领导,如果没有领导,显示无领导,eid 对应 leaderid,请看员工表 mysql> select * from emp; +- ...