In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you the "Xamarin chart development in how to use the OxyPlot framework", the content is easy to understand, clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "Xamarin chart development in the OxyPlot framework how to use" this article.
Drawing Line Graph OxyPlotAndroidDemo in XamaminAndroid
[example 1-1:OxyPlotAndroidDemo] the drawing of the line graph is realized below. The specific steps are as follows:
(1) Open the Xamarin.Android project.
(2) add OxyPlot.Xamarin.Android components to the introduction in the project.
(3) Open the activity_main.axml file and use PlotView for layout. The code is as follows:
(4) Open the MainActivity.cs file and implement the remaining steps in this file, that is, drawing the chart and setting the display mode. The code is as follows:
Using Android.App;using Android.OS;using Android.Support.V7.App;using Android.Runtime;using Android.Widget;using OxyPlot.Xamarin.Android;using OxyPlot;using OxyPlot.Axes;using OxyPlot.Series;namespace OxyPlotAndroidDemo {[Activity (Label = "@ string/app_name", Theme = "@ style/AppTheme", MainLauncher = true)] public class MainActivity: AppCompatActivity {protected override void OnCreate (Bundle savedInstanceState) {base.OnCreate (savedInstanceState) / / Set our view from the "main" layout resource SetContentView (Resource.Layout.activity_main); PlotView view = FindViewById (Resource.Id.plot_view); view.Model = CreatePlotModel () / / set display mode} / / draw a chart private PlotModel CreatePlotModel () {/ / create a chart mode var plotModel = new PlotModel {Title = "OxyPlot Demo"} / / add axis plotModel.Axes.Add (new LinearAxis {Position = AxisPosition.Bottom}); plotModel.Axes.Add (new LinearAxis {Position = AxisPosition.Left, Maximum = 10, Minimum = 0}) / / create data columns var series1 = new LineSeries {Title= "Data", MarkerType = MarkerType.Circle, MarkerSize = 4, MarkerStroke = OxyColors.White}; / / add data point 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)); / / add data column plotModel.Series.Add (series1); return plotModel;}}
Run the program, and the chart shown in figure 1.1 is shown.
Figure 1.1 Graph effect of the Xamarin.Android platform
These are all the contents of this article entitled "how to use the OxyPlot Framework in Xamarin Chart Development". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 259
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.