Syncfusion是一家微软生态下的第三方组件/控件供应商,除了用于HTML5和JavaScript的控件外,他们产品还涉及如下领域:

  • WEB
    • ASP.NET MVC
    • ASP.NET WebForms
    • HTML5/JavaScript
    • LightSwitch
    • Silverlight
  • MOBILE
    • iOS
    • Android
    • Windows Phone
    • WinRT
    • Xamarin
    • HTML5/JavaScript
    • Orubase
  • DESKTOP
    • Windows Forms
    • WPF
  • FILE FORMATS
    • Excel
    • PDF
    • Word
    • Presentation

主要记录下如何在Xamarin中使用Syncfusion组件

一、在官网注册一个使用账号  https://www.syncfusion.com

二、查看Syncfusion版本,Syncfusion分为社区免费版和付费版,付费版可以免费试用30天,官网有详细说明

社区免费版需要满足以下条件:年收入低于100万美元的公司和个人以及5个以下(包含5个)的开发人员。

然后用LinkedIn或者Xing登录,就可以获取社区免费版秘钥

https://www.syncfusion.com/downloads/communitylicense

三、30天试用期可以分为两种,一种是完整的安装评估,一种是通过nuget安装程序集, https://www.syncfusion.com/downloads/xamarin/confirm

四、查看官方文档,了解nuget安装程序集详细操作步骤  https://help.syncfusion.com/xamarin/licensing

五、下面详细介绍如何在Xamarin中添加一个图形报表

1、获取试用版本密钥   https://help.syncfusion.com/xamarin/nuget-packages

登录官网之后,通过地址 https://www.syncfusion.com/account/manage-trials/downloads  可以获取许可证密钥

注意选择对应的版本,然后保存生成的密钥

2、在Xamrin forms 程序启动的时候加载密钥

在nuget中引用Syncfusion.Licensing程序集,然后再App.xaml.cs文件中加入如下代码:

public App()
{
//Register Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY"); InitializeComponent(); MainPage = new App1.MainPage();
}

3、引用图表控件,创建图表页面

在nuget中引用Syncfusion.Xamarin.SfChart程序集,然后就可以使用图表控件了

添加一个示例数据视图  CategoryAxisViewModel

using System.Collections.ObjectModel;
using Xamarin.Forms; namespace SampleBrowser.SfChart
{
public class CategoryAxisViewModel
{
public ObservableCollection<ChartDataModel> CategoryData { get; set; } public CategoryAxisViewModel()
{
CategoryData = new ObservableCollection<ChartDataModel>
{
new ChartDataModel("South Korea", ),
new ChartDataModel("India", ),
new ChartDataModel("South Africa", ),
new ChartDataModel("China", ),
new ChartDataModel("France", ),
new ChartDataModel("Saudi Arabia", ),
new ChartDataModel("Japan", ),
new ChartDataModel("Mexico", )
};
}
}
}

添加一个图形报表页面

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:chart="clr-namespace:Syncfusion.SfChart.XForms;assembly=Syncfusion.SfChart.XForms"
xmlns:sampleBrowser="clr-namespace:SampleBrowser.SfChart"
x:Class="Mobile.Views.Overview.Listings.ListingPage">
<ContentPage.Content> <StackLayout x:Name="stack">
<StackLayout.Resources>
<ResourceDictionary>
<DataTemplate x:Key="toolTipTemplate1">
<StackLayout BackgroundColor="#404041">
<StackLayout.Padding>
<OnPlatform x:TypeArguments="Thickness" WinPhone="3,3,3,3" />
</StackLayout.Padding>
<Label Text="Users" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="White" FontAttributes="Bold" FontFamily="Helvetica" Margin="" FontSize="" Grid.Row="" />
<BoxView Color="White" HeightRequest="0.75" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" />
<StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand" BackgroundColor="#404041" Spacing="" Padding="" Margin="">
<Label Text="{Binding Name}" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand" TextColor="#CCCCCC" FontAttributes="Bold" FontFamily="Helvetica" FontSize="" />
<Label Text="{Binding Value,StringFormat=' : {0}M'}" VerticalTextAlignment="Center" HorizontalOptions="EndAndExpand" TextColor="White" FontAttributes="Bold" FontFamily="Helvetica" Margin="" FontSize="" />
</StackLayout>
</StackLayout>
</DataTemplate>
</ResourceDictionary>
</StackLayout.Resources>
<chart:SfChart x:Name="Chart" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<chart:SfChart.Margin>
<OnPlatform x:TypeArguments="Thickness" WinPhone="0,0,15,0" />
</chart:SfChart.Margin>
<chart:SfChart.Title>
<chart:ChartTitle Text="Internet Users - 2016" />
</chart:SfChart.Title>
<chart:SfChart.BindingContext>
<sampleBrowser:CategoryAxisViewModel />
</chart:SfChart.BindingContext>
<chart:SfChart.ChartBehaviors>
<chart:ChartTooltipBehavior BackgroundColor="#404041" />
</chart:SfChart.ChartBehaviors>
<chart:SfChart.PrimaryAxis>
<chart:CategoryAxis x:Name="primary" LabelPlacement="BetweenTicks" ShowMajorGridLines="false">
<chart:CategoryAxis.LabelStyle>
<chart:ChartAxisLabelStyle x:Name="axisLabelStyle" WrappedLabelAlignment="Center" TextColor="Black">
<chart:ChartAxisLabelStyle.MaxWidth>
<OnPlatform x:TypeArguments="x:Double" WinPhone="" Android="" iOS="" />
</chart:ChartAxisLabelStyle.MaxWidth>
</chart:ChartAxisLabelStyle>
</chart:CategoryAxis.LabelStyle>
</chart:CategoryAxis>
</chart:SfChart.PrimaryAxis>
<chart:SfChart.SecondaryAxis>
<chart:NumericalAxis Minimum="" Maximum="" IsVisible="false" ShowMajorGridLines="false">
</chart:NumericalAxis>
</chart:SfChart.SecondaryAxis>
<chart:SfChart.Series>
<chart:ColumnSeries x:Name="Series" ItemsSource="{Binding CategoryData}" XBindingPath="Name" YBindingPath="Value" EnableTooltip="true" TooltipTemplate="{StaticResource toolTipTemplate1}">
<chart:ColumnSeries.ColorModel>
<chart:ChartColorModel Palette="Natural"/>
</chart:ColumnSeries.ColorModel>
<chart:ColumnSeries.DataMarker>
<chart:ChartDataMarker >
<chart:ChartDataMarker.LabelStyle>
<chart:DataMarkerLabelStyle LabelPosition="Outer" LabelFormat="#.#'M'" Font="">
</chart:DataMarkerLabelStyle>
</chart:ChartDataMarker.LabelStyle>
</chart:ChartDataMarker>
</chart:ColumnSeries.DataMarker>
</chart:ColumnSeries>
</chart:SfChart.Series>
</chart:SfChart>
</StackLayout> </ContentPage.Content>
</ContentPage>

syncfusion文档:https://help.syncfusion.com/xamarin/introduction/overview

Xamarin.Forms学习系列之Syncfusion 制作图形报表的更多相关文章

  1. Xamarin.Forms学习系列之Android集成极光推送

    一般App都会有消息推送的功能,如果是原生安卓或者IOS集成消息推送很容易,各大推送平台都有相关的Sample,但是关于Xamarin.Forms的消息推送集成的资料非常少,下面就说下Xamarin. ...

  2. Xamarin.Forms 学习系列之底部tab

    App中一般都会有一个底部tab,用于切换不同的功能,在Xamarin中应该制作底部tab了,需要把Android的TabbedPage做一次渲染,IOS的则不用,接下来说下详细步骤: 1.在共享项目 ...

  3. Xamarin.Forms 学习系列之优秀UI收集

    1.各种优秀UI例子 https://github.com/jsuarezruiz/xamarin-forms-goodlooking-UI 输入框例子 https://github.com/enis ...

  4. Xamarin.Forms学习系列之SQLite

    在App中我们通常不会实时获取服务器数据,会在用户手机中保存历史数据,这个时候就需要用到数据库SQLite,由于微软的封装,在Xamarin中操作SQLite非常简单,类似EF的操作. 1.我们需要在 ...

  5. Xamarin.Forms学习之Platform-specific API和文件操作

    这篇文章的分享原由是由于上篇关于Properties的保存不了,调用SavePropertiesAsync()方法也不行,所以我希望通过操作文件的方式保存我的需要的数据,然后我看了一下电子书中的第二十 ...

  6. Xamarin.Forms学习之Page Navigation(一)

    在最初接触Xamarin.Forms的时候,我是跟着Xamarin官方的名为“learning-xamarin-ebook”的pdf文档进行学习的,我在成功运行Hello world程序之后,我开始跟 ...

  7. Xamarin.Forms学习之XAML命名空间

    大家好,我又悄咪咪的来了,在上一篇的Xamarin文章中简单介绍了Xamarin的安装过程,妈蛋没想到很多小朋友很感激我,让他们成功的安装了Xamarin,然后......成功的显示了经典的两个单词( ...

  8. Xamarin.Forms学习之初

    微软的Build 2016结束的有段时间了,对于一个简单的小屌丝程序员--我来说,关注最大的无疑是Xamarin的免费(开源什么的让大神们上吧),内心激动啊.大会结束的周末我就迫不及待的安装了,然后. ...

  9. Xamarin.Forms学习之位图(二)

    上篇文章分享了如何加载网络图片和PCL中的图片,所以今天继续分享关于如何加载平台的内嵌图片,在这之前说一下上篇文章开头的一个问题:为什么不能加载UWP项目,这是因为我升级了UWP的SDK,而Xamar ...

随机推荐

  1. SpringBoot整合MybatisPlus3.X之SQL注入器(九)

    pom.xml <dependencies> <dependency> <groupId>org.springframework.boot</groupId& ...

  2. MySql逻辑结构简介

    结构示意图: 如上图,可把数据库的结构分成四层,见下图及文字说明  一.连接层提供客户端和连接服务,包含本地Sock通信和大多数基于客户端/服务端工具实现的类似于TCP/IP的通信,主要完成一些类似于 ...

  3. intellij idea - Project Structure 项目结构详解(简单明了)

    IDEA Project Structure 设置 可以点击  按钮,或者使用快捷键 Ctrl + Shift + Alt + S  打开 Project Structure .如下如所示: 项目的左 ...

  4. Mui 微信支付、支付宝支付

    利用mui 发起手机微信和支付宝支付 payStatement :调起微信支付接口的参数 参考文档: https://pay.weixin.qq.com/wiki/doc/api/app/app.ph ...

  5. 超融合与传统IT架构对比:成本价格优势有哪些

    之前文章中,我们已经介绍了超融合给用户 IT 基础架构带来的各个方面的价值,其中成本只是超融合架构的优势之一.但很多用户还是会非常关心这个话题,希望能有更具体的了解,所以本文整理超融合和传统 FC S ...

  6. Everything可能泄漏大量电脑敏感资料

    一款好用的文件搜索工具Everything被批露出现重大问题: Everything可以打开http服务,在没有加密的情况下任何外网电脑都可以连接的. 因此,Everything可能泄漏大量电脑敏感资 ...

  7. Font Awesome图标字体应用及相关

    作为web开发者,难免要经常要用到些小图标,给自己web增添几分活力和多样性.像这些: 而Font Awesome刚好为我们提供了这些.到目前为止,Font Awesome提供了有500多个可缩放的的 ...

  8. [模板]tarjan——最后通牒

    这么久了我还是不会板子,你们随便笑话我吧. 再不会打我实在是无能为力了. 这篇博客写的像个智障一样...写它的目的就是自嘲? 才不是,为了方便查阅,因为我真的记不住. 对于割边,要存储该点入边的编号, ...

  9. jquery获取input输入框中的值

    如何用javascript获取input输入框中的值,js/jq通过name.id.class获取input输入框中的value 先准备一段 HTML <input type="tex ...

  10. PCA降维的原理、方法、以及python实现。

    PCA(主成分分析法) 1. PCA(最大化方差定义或者最小化投影误差定义)是一种无监督算法,也就是我们不需要标签也能对数据做降维,这就使得其应用范围更加广泛了.那么PCA的核心思想是什么呢? 例如D ...